3

I'm trying to use pdf content (mathematics) in my webpage. I basically want to convert the pdf to some vector image. Converting the pdf to swf does the job very well, but as flash isn't supported on every platform, I'm trying to find another solution.

I read about svg, but as those pdf's contain a lot of mathematics, the result of the converters I found is really ugly and incorrect.

I've also thought about retyping the latex, and displaying it using mathjax, in some way this is the best solution, but also very time consuming.

The only thing I want is to convert it to a nice vector image, I don't want to change the content, or anything else. Besides converting to swf or retyping it, is there any other solution ?

Edit: this is svg output
and here original pdf

Kasper
  • 12,594
  • 12
  • 41
  • 63
  • Without any knowledge of what is stored inside the PDF for the equations, isn't that an impossible question to answer? Is the equation inside the PDF represented using fonts and characters? Or is the equation inside the PDF represented actually as an image? – Kevin Brown Jun 21 '13 at 04:40

3 Answers3

2

The only solution I could find is illustrator. Just open the pdf, save as svg, and choose to embed all used glyphs. Result is perfect:

https://dl.dropboxusercontent.com/u/58922976/Sol-10.1.svg

Kasper
  • 12,594
  • 12
  • 41
  • 63
  • Inkscape is open source and can do the same. It can only handle one page at a time, so some scripting might be needed for a fluent workflow. – Bert Jun 15 '16 at 08:04
1

what about using flash + raster image in case of platform without flash, if flash mostly works for you?

Hugo Moreno
  • 150
  • 7
1

Your PDF is a little difficult for reasons that are probably not apparent to you.

The core problem with it is that some of the graphics in the document are actually drawn using custom glyphs. You can see this if you copy and paste the text out of Acrobat. There are a variety of unusual characters in there that don't seem to serve any useful purpose. That's those squares at the bottom of your SVG with EEs and FFs in them.

However these characters are actually custom glyphs for things like the braces around the matrices at the bottom of the page. So they are both fairly important and also very specific to this document.

I tried ABCpdf .NET to convert your PDF to SVG. It worked fine apart from these custom glyphs at the bottom. The output was about 90KB. It looked very similar to your inkscape SVG output but just a bit smaller (the inkscape one is 160KB).

The only way to get rid of these non-Unicode glyphs is to vectorize the text. I did this using ABCpdf and the output looked fine in SVG. But... vectorized text is big and SVG isn't a particularly efficient medium. The output was about 1MB! Zipped it goes down to half that but it's still no-where near as efficient as the original PDF.

The problems I am seeing here are going to be universal whatever format you use. These custom characters are always going to be problematic whether you output to SVG, SWF, HTML canvas, VML or indeed any vector format.

So what would I suggest? Well the obvious vector format that is widely used on the web is... PDF!

I know it's not quite what you're looking for but I think this is the realistic solution given the constraints above. :-)

  • the file contains only embedded Type1 fonts, and these fonts don't have /ToUnicode streams with corresponding CMaps. I'm sure all these "custom glyphs" have representation in unicode(http://www.unicode.org/notes/tn28/UTN28-PlainTextMath-v3.pdf) so they could be copied using copy-paste if iText library(the producer of this file) would have created such entries.These are not "custom" characters, and their export to SVG might be much simpler if fonts were embedded another way.And I agree with you that PDF is the most commonly used vector format on the web) – Hugo Moreno Jun 21 '13 at 17:02
  • But the problem with pdf is, I can't really use it as an vector image. I think I could crop the pdf to the right format I want it. But I don't think I can embed it like an image. – Kasper Jun 21 '13 at 17:37
  • You may try another PDF generator and export to SVG again, it might help.May I ask why do you need this file vectorized and its original PDF format doesn't work for you? – Hugo Moreno Jun 21 '13 at 18:22
  • Not really an answer! this poster is only ranting, and does not prove he actually knows what PDF and SVG is. Just check the facts. – scrat.squirrel Apr 02 '20 at 15:10