intercept blob and encode to base64 string for file explorer

pull/5370/head
Joseph Izang 2 years ago committed by Aniket
parent 27d323daac
commit badf2ff705
  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