2

I am looking into converting a large pdf file into svg (in order to create a web animation with java-script). I tried various methods which are available on my system:

The first two options visually gives me the best results. Text seems to be converted to paths and the output looks like the original. However, it is difficult to work with the source of the resulting svg. Grouped objects in the original pdf are not grouped in the output. In contrast, the third method gives an svg which seems to contain the objects grouped, in just the way I need it, each with an ID. However, here the text is obviously imported as text and the font changes, such that the result is visually not appealing (this seems to be independent of the options I use on import).

Is there another way which gives me both, proper conversion of the text as well as grouped objects? If not, how could I can isolate and adapt the mechanism Inkscape is using for this conversion? Note that I am using Linux and that the original pdf file is obtained using xelatex.

  • Just a wild guess: It could be that the font issues with the third options are plainly due to the wrong font name being used in the imported SVG. If you have a small number of fonts in your PDF, you could try to solve the problem by applying a search and replace to those wrong font names. – Wrzlprmft Jan 8 '16 at 19:14
  • How would I find these and how would I find the correct ones (can I find these in the PDF)? – highsciguy Jan 8 '16 at 21:27
  • Most PDF viewers have an option that shows you the embedded fonts, though in possibly cryptic names. Of course, if you generated the PDF yourself, you should know the fonts. To replace them, just look at what font is used in a text field of the imported SVG and perform a search and replace on the SVG’s source code. – Wrzlprmft Jan 8 '16 at 21:34
  • Ok, I will try this out. I suppose that I would have an svg that is not portable unless there is a way to also embed the fonts in the svg (they are embedded in the pdf, I think). – highsciguy Jan 8 '16 at 21:39
  • An option seems to be to first convert the fonts to path on the pdf side with gs -o target.pdf -dNoOutputFonts -sDEVICE=pdfwrite source.pdf. However, I experience that either the svg output with inkscape gets much bigger than the pdf (seems to be related to the graphics) or, if I do not embed figures the file size is ok, but it needs very long to display in a browser as it loads all the files. – highsciguy Jan 9 '16 at 17:05

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.