Open junaid33 opened 2 years ago
Rendering a SVG graphic or rendering a website to SVG?
Rendering a website as SVG. I think there’s a way to use the pdf screenshot and Inkscape to get the SVG, but having that built-in would be helpful.
I think generating SVG is out of scope for this package as there's no easy way to do it. However, I'm open to adding support for generating PDF in the type
option. Puppeteer supports PDF, but it will require some changes as it's not just a simple option like the other image formats.
When PDF is supported here, you could pass it to some kind of PDF-to-SVG converter.
I was using this library to export png's and now for another project I need to export PDF's. I just changed page.screnshot
to page.pdf
and works like a charm
diff --git a/node_modules/capture-website/index.js b/node_modules/capture-website/index.js
index f380b0d..156fb01 100644
--- a/node_modules/capture-website/index.js
+++ b/node_modules/capture-website/index.js
@@ -431,7 +431,8 @@ const internalCaptureWebsiteCore = async (input, options, page, browser) => {
screenshotOptions.clip = {x, y, width, height};
}
- const buffer = await page.screenshot(screenshotOptions);
+ const buffer = await page.pdf(screenshotOptions);
return buffer;
};
Would be a cool feature to have