I'm trying use embeddSVG.py to embed an SVG in a PDF, but Adobe Acrobat Reader doesn't show svg content in my pdf.
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
Maybe you can use svglib to convert your svg to pdf and then include it using pyPdf. Note that svglib seems to use reportlab so you can probably use their api to manipulate your file.
You're probably better off first converting the SVG to PDF.
Apache Batik includes SVG Rasterizer, which, despite its name, can convert SVG to PDF.
This is used by Apache FOP to convert Docbook documents that include SVG graphics to PDF.
Save the SVG as a PDF, and then open the PDF in Acrobat.
For example, if you create the SVG in Inkscape, then you would go to File -> Save a copy -> Save as PDF, and then open it up in Acrobat. This method should preserve text and vector paths.
If you instead choose Print -> Print to File as PDF, then the image will become rasterized (pixelated) and lose its vector powers.
You may also save your SVG image as a DWG file or as an EMF file, both of which are easier formats to open/import into Acrobat than an SVG. (Note to Adobe: "Hey, Adobe, it's time to start supporting direct SVG imports into Acrobat!")
If you are working with SVGs, Inkscape or a similar program (Illustrator or CorelDraw) is essential. Inkscape is free.