intercept blob and encode to base64 string for file explorer

pull/3321/head^2
Joseph Izang 2 years ago committed by Aniket
parent 04517234a3
commit 3d3d32d2d9
  1. 9
      libs/remix-ui/solidity-compiler/src/lib/contract-selection.tsx

@ -216,10 +216,11 @@ export const ContractSelection = (props: ContractSelectionProps) => {
const domParser = new DOMParser()
const element = domParser.parseFromString(payload, 'image/svg+xml').querySelector('svg')
const fileName = `${api.currentFile.split('/')[0]}/resources/${api.currentFile.split('/')[1]}.pdf`
// domToPdf(element, { filename: fileName}, function(pdf) {
// console.log({ pdf })
// });
pdfBuilder
pdfBuilder.addSvgAsImage(payload, 1.6, 1.6, 300, 300)
const result = pdfBuilder.output('datauristring', { filename: fileName })
api.writeFile(fileName, result)
console.log({ result })
setSVGPayload(payload)
setShowViewer(!showViewer)
} catch (error) {

Loading…
Cancel
Save