6

Is there a free (i.e. gratis) way to convert a PDF file to Windows EMF (Enhanced Meta File) in such a way that text which uses fonts embedded in the PDF will be rendered the same way in MS Office PowerPoint? I guess one would have to replace the text with a filled path, but that would be all right since I only want to show the result, not edit it.

I tried pstoedit, but the font embedding seems to be tricky. Looking at the manual on font handling it seems as if -dt should turn text into filled paths, but in this case the paths are apparently really just polygons, connecting segment end points but not doing any Bézier curves in between. So the result looks strange, e.g. with diamonds as the dots of all the ‘i’.

I've read in several places (e.g. here) that inkscape could be used to convert PDF to EMF. But on Windows the PDF import hangs without showing a dialog. On Linux, I get an import dialog but the only option for text handling is to leave text as text; I can't convert to paths so without the embedded fonts I'm forced to use system fonts instead.

I've also tried ImageMagick convert, but that seems to rasterize the image so the result looks blurry.

For one application, namely embedding LaTeX formulas into PowerPoint, this post suggests alternatives (at least some of which work via DVI instead of PDF, and MHTML instead of EMF. But there are many more tools which can create PDF but not EMF, so the general problem remains.

I have access to Windows, Linux and OS X, so a suggested answer may use any combination of OS if that helps. If you don't have a complete solution, then a partial solution may still help. E.g. some PDF-to-PDF converter which replaces text with filled paths. Or some tool to extract fonts from PDF and save them in separate files, where other tools (like pstoedit or inkscape) might pick them up and use them to render the texts. Or anything else you consider a significant step towards a solution.

6

I had been facing the same problem as you: I had a number of .pdf files (two pages each) that I wanted to transform into something that I could import into a Word file; something just happened to be an .emf in the end (all other formats were not accepted).

This answer assumes you are comfortable in using the console.

The tool of choice to convert vector format X into vector format Y seems to be inkscape. However, when importing a .pdf file directly into inkscape

  • you can only access the first page on console (to the best of my knowledge)
  • even if you select the text-to-paths option flag -T, the text is not well-transformed.

Therefore, I found it necessary to pre-convert the .pdf file into something inkscape is able to use. I found this answer very useful, especially the mention of pdf2svg. My final sequence was the following:

pdf2svg input_filename.pdf interim_filename_%d.svg all
inkscape -T interim_filename_1.svg --export-emf=interim_filename_1.emf
(repeat for all additional pages of the .pdf)

To the best of what I can see on screen, transferring those .emf files to a Windows machine and opening them using the Windows image viewer, the result is identical to the input. Plus, having tried a test case with a custom-made LaTeX document using a font not present on my Windows machine, I also found the result identical. Skipping the initial pdf2svg step meant that the spacing was completely messed up after inkscape’s conversion.

In my case, I did not need to remove the .pdf page boundaries (I was dealing with full-page files). You may require such an intermediate step if you are interested in only a small part of the .pdf page. Pulling from this answer, pdfcrop seems to be able to do that.

  • Nice. I already had pdf2svg installed, but hadn't realized it can handle fonts. Looking at its output, I see that the glyphs from the font get expressed as <symbol>s in the svg. Bad for copy&paste, but good for font fidelity, so this is what I'm after here. Great! – MvG Feb 7 '17 at 8:38
  • For me, inkscape always adds a small white margin (bottom and right side) in the svg to wmf step. It's not there in the svg. Any idea why? And how to suppress that? – NichtJens Feb 19 at 10:38
0

If you need to write formulars in PPT you could use IguanaTex Add-In for PPT.

It depends on a Latex Distribution and if you want to also generate Tikz Plots it will need ImageMagick. Which is used to convert the resulting PDF of PDFLatex to an PNG which looks fairly nice in the PPT.

If you need Higher Quality Pictures you can use the Standalone Class and use convert ( also needs ImageMagick). Here you can generate PNG or JPG with defined DPI. Or a PDF as Vector Format.

Or you can use Standalone and call pstoedit to generate WMF Files.

\documentclass[
   convert={command=\unexpanded{
     pstoedit\space-v \space -f\space emf \space convert.pdf \space convert.emf
   }}]{standalone}

seems you have to edit the output and input filename from hand.

  • I'm really looking for a scaleable vector WMF, not a raster PNG, so IguanaTex doesn't seem to fit my requirements. The standalone class is nice for its cropping, but not that different from calling pstoedit manually. On my system, the code you gave results in a message No output format specified (-f option) and format could not be uniquely deduced from suffix .wmf of output file followed by a list of supported formats which lacks wmf but contains emf. Using that instead, I get an EMF file which refers to fonts like CIWQJE+CMMI10. Won't work without the fonts in question. – MvG Sep 10 '15 at 15:43
  • maybe you have to update your pstoedit. – josarn May 12 '16 at 14:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.