Page 1 of 1

convert PDF to SVG fails to create valid file

Posted: 2015-02-09T14:06:32-07:00
by jeffrey.berger
Using the command:
>convert foo.pdf foo.svg
>
produces an SVG file that, when viewed in a browser contains:
-----------------------
This page contains the following errors:

error on line 871 at column 74: Namespace prefix xlink for href on image is not defined
Below is a rendering of the page up to the first error.
-----------------------

Nothing follows the error message.

The original PDFs were produced:
- using PDFLib
- as export-to-pdf from Excel
- by the US gov (W-4 Form)

Version: ImageMagick 6.9.0-0 Q16 x86_64 2014-12-11 http://www.imagemagick.org on Mac OS 10.10.1

Re: convert PDF to SVG fails to create valid file

Posted: 2015-02-09T14:16:26-07:00
by snibgo
The command "convert foo.pdf foo.svg" should rasterize each page of the PDF, converting it to pixels, making SVG files that contain embedded bitmaps.

For someone to investigate, you should put a PDF that shows the problem somewhere like dropbox.com and paste the link here.

Re: convert PDF to SVG fails to create valid file

Posted: 2015-02-10T07:14:51-07:00
by jeffrey.berger
Sure. Here's one:
http://www.irs.gov/pub/irs-pdf/fw4.pdf

convert DOES create an SVG file, but the file cannot be opened in the browser because of the missing namespace specification.

Thanks.

Re: convert PDF to SVG fails to create valid file

Posted: 2015-02-10T08:46:44-07:00
by jeffrey.berger
Aha!
The problem is in the headers IM is creating for the SVG. I pasted in headers from an SVG created by exporting from Adobe Illustrator and the IM SVG became viewable.

Below, IM's headers are commented, Illustrator's are not:

<!-- <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN" "http://www.w3.org/TR/2001/REC-SVG-20010 ... /svg10.dtd"> -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- <svg width="648" height="918"> -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="648px" height="918px" viewBox="0 0 648 918" enable-background="new 0 0 648 918" xml:space="preserve">

Re: convert PDF to SVG fails to create valid file

Posted: 2015-02-10T09:56:30-07:00
by magick
We can reproduce the problem you posted and have a patch in ImageMagick 6.9.0-6 Beta available by sometime tomorrow. Thanks.

Re: convert PDF to SVG fails to create valid file

Posted: 2015-02-27T08:19:02-07:00
by jeffrey.berger
Just getting back to this issue. Where/how can I find info about downloading/installing the Beta? (Mac OS 10.10.1)

Thanks!

Re: convert PDF to SVG fails to create valid file

Posted: 2015-02-27T09:02:50-07:00
by dlemstra
This version has been published, you can just download the latest release.

Re: convert PDF to SVG fails to create valid file

Posted: 2015-02-27T12:11:09-07:00
by jeffrey.berger
Thanks!