Errors converting PDF to EMF

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
I.M.Newbie
Posts: 4
Joined: 2012-04-29T00:18:37-07:00
Authentication code: 13

Errors converting PDF to EMF

Post by I.M.Newbie »

I just installed ImageMagick, Windows version. I prefer the cygwin version but it doesn't convert to EMF. I then tried to convert the PDF file http://www.cra-arc.gc.ca/E/pbg/tf/t2036/t2036-11e.pdf to EMF:

Convert t2036-11e.pdf t2036-11e.emf

The output is:

Unrecoverable error: rangecheck in .setuserparams
Operand stack:
--nostringval-- --nostringval-- --nostringval--
START 0 2588256 1247145 1476808 192904 true 1138 5 <3>
END PROCS 1 2588256 1258444 1476808 194288 true 1137 5 <3>
gs_std_e.ps 2 2608352 1264505 1496904 199000 true 1137 5 <6>
gs_il1_e.ps 2 2608352 1266694 1496904 199000 true 1137 5 <9>
END FONTDIR/ENCS 2 2608352 1266872 1496904 199000 true 1137 5 <15>
END DEVS 3 2611856 1273904 1496904 199000 true 1137 5 <15>
END STATD 4 2611856 1281066 1496904 200624 true 1137 5 <39>
END GS_FONTS 5 2652048 1311966 1496904 200624 true 1138 5 <45>
END BASIC COLOR 6 2652048 1318533 1496904 200624 true 1136 5 <48>
END LEVEL 1 COLOR 7 2652048 1320267 1496904 200624 true 1136 5 <51>
END IMAGE 8 2672144 1326903 1496904 200624 true 1136 5 <54>
gs_btokn.ps 9 2672144 1330351 1496904 200624 true 995 4 <57>
gs_dps1.ps 10 2672144 1331702 1496904 200624 true 995 4 <57>
gs_dps2.ps 11 2672144 1333715 1496904 200624 true 995 4 <57>
gs_type1.ps 11 2672144 1335247 1496904 200624 true 995 4 <57>
While reading gs_lev2.ps:
%%[ Error: invalidaccess; OffendingCommand: put ]%%
START 526551 2746856 1404452 1496904 202880 true 999 7 <92>
END PROCS 526552 2746856 1415735 1496904 204264 true 997 7 <92>
gs_std_e.ps 526553 2766952 1421796 1496904 205648 true 997 7 <95>
gs_il1_e.ps 526553 2766952 1423985 1496904 205648 true 997 7 <98>
END FONTDIR/ENCS 526554 2766952 1424163 1496904 205648 true 997 7 <104>
END DEVS 526554 2770456 1431195 1496904 205648 true 997 7 <104>
END STATD 526555 2770456 1438429 1496904 207272 true 997 7 <128>
END GS_FONTS 526556 2800400 1467563 1496904 207272 true 997 7 <134>
END BASIC COLOR 526556 2820496 1477458 1496904 207272 true 995 7 <137>
END LEVEL 1 COLOR 526557 2820496 1479192 1496904 207272 true 995 7 <140>
END IMAGE 526558 2820496 1482500 1496904 207272 true 995 7 <143>
gs_btokn.ps 526558 2820496 1485948 1496904 207272 true 995 7 <146>
gs_dps1.ps 526559 2820496 1487299 1496904 207272 true 995 7 <146>
gs_dps2.ps 526560 2820496 1489312 1496904 207272 true 995 7 <146>
gs_type1.ps 526560 2840592 1494196 1496904 207272 true 995 7 <146>
While reading gs_lev2.ps:
%%[ Error: invalidaccess; OffendingCommand: put ]%%

I then get a popup window saying "ImageMagick Studio library and utility programs has stopped working".

Can anyone suggest an alternative for such a conversion?

P.S. I used ghostcript to convert the PDF to EPS, then tried ImageMagick's convert again...similar results.
I.M.Newbie
Posts: 4
Joined: 2012-04-29T00:18:37-07:00
Authentication code: 13

Re: Errors converting PDF to EMF

Post by I.M.Newbie »

I think I found the answer. After much searching, I found an ImageMagick page listing all formats: http://www.imagemagick.org/script/formats.php#supported

EMF is listed as "R" mode, which I assume means that it can only be read, not written to. If I am right, then it would be nice to have the error message reflect this.

In fact, the above webpage listing the formats seems to be overly optimistic. If I issue the command "identify -list format" from the command line, EMF is shown as "---", which means no read or write. The first dash is the position for "r" (read), the second dash is for "w" (write), and the last dash is for "+".

Not that it matters for EMF, but I'm not sure what "+" means. The documentation is rather skimpy on this:
* http://www.imagemagick.org/script/comma ... s.php#list
* From command line: identify -list format | more
Last edited by I.M.Newbie on 2012-04-29T18:49:53-07:00, edited 1 time in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Errors converting PDF to EMF

Post by fmw42 »

I suspect there is something wrong with your install. IM generally exits more gracefully. What happens when you do

convert logo: logo.gif

Or to tiff, png, jpg etc.

What do you get from

convert -version
I.M.Newbie
Posts: 4
Joined: 2012-04-29T00:18:37-07:00
Authentication code: 13

Re: Errors converting PDF to EMF

Post by I.M.Newbie »

The conversion of logo to gif, tiff, png, an pjg seem to work fine. If I issue "convert -version", I get:

Version: ImageMagick 6.7.6-7 2012-04-20 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenMP

In view of the limitations I'm facing, would anyone be able to recommend a free web service to convert the PDF in my original post to EMF? Online converters for PDF-EMF seem to be relatively rare compared to other input/output formats:
http://www.google.ca/search?q=convert-p ... ert+%2Bemf

I used http://www.go2convert.com to convert PDF to MVG (Magick Vector Graphics) but the resulting download link doesn't seem to do anything but send me to a blank webpage. In fact, another candidate http://www.pictureresize.org/online-ima ... erter.html ends up sending me to the same service.

As an alternative, any anecdotes about http://www.officeconvert.com/products/o ... e-free.htm would be appreciated. I wanted to look for an online service first because anytime I install freeware from an unknown source, I never know how conscientiously the application has been developed.

I tried pstoedit to convert PDF to EMF, but it looks coarsely rasterized. I also tried pstoedit from PDF to fig, then used xfig to export to EMF. It looks fine except that it's missing background logos that are in the original.

Finally, I creating the fig files from ps & eps files generated from the PDF. I forgot what used, might have been gs or pdf2ps or some such. At any rate, each of the ps & eps files were converted to fig using pstoedit, with the intention of using xfig to export to EMF. The conversion of eps to fig crashes with cryptic errors. On the other hand, if a fig file is generated from PS, I get the same thing as above (generating fig from PDF). So no headway there.
I.M.Newbie
Posts: 4
Joined: 2012-04-29T00:18:37-07:00
Authentication code: 13

Re: Errors converting PDF to EMF

Post by I.M.Newbie »

My mistake. The result from creating fig from pstoedit and EMF from xfig is not OK. The positioning of phrases in a sentence can be very wonky, with large horizontal gaps between some words.

In the tend, I simply used gs to rasterize the image. Not ideal, but usable. I'm just going to import it as a background into an Excel file. That way, I can create a spreadsheet for the data entry areas. |t will have to be printed out and submitted, and then manually transcribed into the target system.
Post Reply