Replies: 4 comments 1 reply
-
I think that the only support for SVG is that it uses the SVG path format when you're drawing lines/shapes. Things like fill and stroke properties need to be specified using the pdf-lib API (which is not too dissimilar to SVG, but is not based on SVG). It doesn't support other SVG instructions, so embedding a whole SVG file probably isn't going to work. |
Beta Was this translation helpful? Give feedback.
-
I have begun porting a library which was built for jspdf to work with pdf-lib ; there is still a fair bit to figure out, but I have a good start on it I think. https://github.com/HamStudy/svg2pdf.js I'd welcome any help -- @Hopding there are probably going to be a few things with fonts and/or patterns that I may need help figuring out, if nothing else. I've been meaning to get back to this for awhile but just haven't had time until now. |
Beta Was this translation helpful? Give feedback.
-
I needed to embed a rather complicated svg image into a pdf using pdf-lib, so adding that many paths was not an option. |
Beta Was this translation helpful? Give feedback.
-
I ended up doing the same thing for mine
…On Fri, Sep 29, 2023 at 6:10 PM Sohaib Athar ***@***.***> wrote:
I needed to embed a rather complicated svg image into a pdf using pdf-lib,
so adding that many paths was not an option.
I ended up exporting the svg as pdf (in inkscape) and using embedPdf
afterwards, which was sufficient to accomplish my goal.
—
Reply to this email directly, view it on GitHub
<#1165 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABWYTRGZD6JCDSJX2FLU3LX45PO5ANCNFSM5OUFLMCA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Unless I am missing something there doesn't seem to be a way of embedding an SVG file into my document I was expecting something like pdfDoc.embedSVG(svg)?
Beta Was this translation helpful? Give feedback.
All reactions