| Issue 127: | Error if images already in PDF format | |
| 1 person starred this issue and may be notified of changes. | Back to list |
If an .. image:: or .. figure:: directive refers to an image already in PDF
format, an error is returned and the image does not appear in the output.
Step-by-step test . . .
1. Create plot
from pylab import *
plot([1,2,3])
savefig('image.pdf')
2. Write test.rst file referring to image
title
=====
.. figure:: image.pdf
here's the figure caption
3. Run rst2pdf test.rst. Results in the error,
[ERROR] createpdf.py:890 Error opening "image.pdf": cannot identify image file
It looks like the error is due to neither PIL nor UniConvertor being able
to read PDFs.
One workaround to have vector figures is to convert to SVG. But for my use
case (PDFs from the Genome Browser (http://genome.ucsc.edu) converting to
SVGs causes UniConvertor to fail (which is a separate issue I'm trying to
solve).
Best case scenario would be to put PDF-format images directly in the output.
This is using version 0.10.1 on Ubuntu 8.04
|
|
,
Jun 05, 2009
I have asked in the reportlab list if there is a way to do this. So far: * PIL (which we use for raster images) doesn't support reading PDF files * uniconvertor (which we use for vectors) doesn't support reading PDF files So, so far, I see no way to do this. Even converting the pdf to ps or eps doesn't seem to work.
Status: Accepted
|
|
,
Jun 05, 2009
After some research, I could cobble something using pythonmagick. I am reluctant to add a 4th possible dependency for images, but if I can make this work with and without it, I will implement it. |
|
,
Jun 13, 2009
I have an evaluation copy of PageCatcher, I will use it to implement this. PageCatcher is not free software, however, so I will try to do the pythonmagick one, too. |
|
,
Jun 17, 2009
As of r677, this is working via pythonmagick. I have not been able to make pageCatcher do it yet, but maybe soon.
Status: Started
|
|
,
Jun 18, 2009
Thanks for this. For large PDF images, changing the image size with :width: 50% does not seem to have an effect (r692). Not sure whether to open another issue for this. Just to clarify: pythonmagick converts PDF to raster before inserting into the document. In contrast, PageCatcher would insert the vector PDF directly. Is this correct? |
|
,
Jun 18, 2009
Yes, using PageCatcher it should work just like if it was all one seamless PDF, while with pythonmagick you are embedding just a picture of the PDF. I'll take a look at the problem with :width: |
|
,
Jun 18, 2009
The :width: 50% does work for me, check test_image_units_pdf.txt in r694 |
|
,
Aug 19, 2009
This seems to work correctly, although the PageCatcher support is broken. Since PageCatcher is proprietary, this issue is now downgraded to "I keep it open just in case I am very very very bored someday".
Labels: -Priority-Medium Priority-Low
|
|
,
Sep 22, 2009
(No comment was entered for this change.)
Labels: -Type-Defect Type-Enhancement
|
|
,
Oct 13, 2009
Closing it, I will not work on this issue anymore. If someone is familiar with pagecatcher, of course, feel free to fix it :-)
Status: Fixed
|
|
|
|