[ome-users] OMERO.figure: export to PDF fails

William Moore (Staff) W.Moore at dundee.ac.uk
Tue Jan 23 12:16:41 GMT 2018


Hi Kai,

 Thanks for the info.

I switched to reportlab 3.4.0 and saw the same bug as you, using my 40-panel figure that previously exported OK
using reportlab 3.2.0.

I’ve created a card https://trello.com/c/KEIu1LhB/17-bug-reportlab-34-export
and I think I have a fix for the bug, which is caused when the PDF info section has
more than 1 page.

However, you may find that the quickest workaround for you
is to try reportlab 3.2.0.

We recently updated our install docs to recommend installing via

$ yum install python-reportlab

This is what we use on our test servers and this also works without this bug.
I believe this installs a much older version of reportlab - 2.5.

Hope that helps.

  Cheers,

  Will.



On 23 Jan 2018, at 10:12, Kai Schleicher <kai.schleicher at unibas.ch<mailto:kai.schleicher at unibas.ch>> wrote:


Hi Will,

thanks for you quick reply! Please find my answers in-line:

 I just checked and there’s certainly not a limit of 18 panels on a page. Exporting a PDF page with 40 panels worked OK for me.
Thanks for testing.


Could you let me know your reportlab version?
$ pip freeze | grep reportlab
reportlab==3.4.0


we have a higher version, could that be an issue?

Also, is this a multi-page figure?
Are all the panels within a single page?


It is a single-page figure. I also tried dividing the panels on two pages, but received the same error.

I wonder if the presence of the 19th panel would cause this bug if there were only 1 or 2 of other panels there?
no, if only 1 or 2 panels are there than the 19th does not cause the bug. In fact it does not matter which panels are present or deleted, it just fails if its more than 18. I will sent you the images in question in a separate email, maybe you can reproduce the bug this way on your end.


If you can reproduce this, especially with a simpler figure that would be great.
I did not manage to reproduce it with other data - but I could reproduce it using the exact same images from the user.


If you could send me the exported JSON “File > Export as json” that fails, and one that doesn’t, that would be handy
(either privately or remove any private names / details).
I will include the json files in the separate email together with the images that cause the bug.


Thanks again and cheers,
Kai

On 01/22/2018 06:04 PM, William Moore (Staff) wrote:
Hi Kai,

 I just checked and there’s certainly not a limit of 18 panels on a page. Exporting a PDF page with 40 panels worked OK for me.

Could you let me know your reportlab version?
I have:

$ pip freeze | grep reportlab
reportlab==3.2.0

Also, is this a multi-page figure?
Are all the panels within a single page?

I wonder if the presence of the 19th panel would cause this bug if there were only 1 or 2 of other panels there?

If you can reproduce this, especially with a simpler figure that would be great.

If you could send me the exported JSON “File > Export as json” that fails, and one that doesn’t, that would be handy
(either privately or remove any private names / details).

 Cheers,

  Will.


On 22 Jan 2018, at 16:28, Kai Schleicher <kai.schleicher at unibas.ch<mailto:kai.schleicher at unibas.ch>> wrote:

Dear OME team,

first of all, I wish you a happy new year and best of success for 2018!

Coming to my question, we were contacted by a OMERO.figure user who noticed that the "export to pdf" function failed when too many images are present in the figure (A4, vertical).

To be precises, 18 images á 512x512 pixels can still be exported, while export fails with 19 or more images of the same dimensions, see error logs below

Traceback (most recent call last):
  File "./script", line 1875, in <module>
    run_script()
  File "./script", line 1861, in run_script
    file_annotation = export_figure(conn, script_params)
  File "./script", line 1818, in export_figure
    return fig_export.build_figure()
  File "./script", line 704, in build_figure
    self.save_figure()
  File "./script", line 1372, in save_figure
    self.figure_canvas.save()
  File "/home/omeronas/omeroweb/lib/python2.7/site-packages/reportlab/pdfgen/canvas.py", line 1237, in save
    self._doc.SaveToFile(self._filename, self)
  File "/home/omeronas/omeroweb/lib/python2.7/site-packages/reportlab/pdfbase/pdfdoc.py", line 211, in SaveToFile
    raise RuntimeError("class %s instances can only be saved once" % self.__class__.__name__)
RuntimeError: class PDFDocument instances can only be saved once

Is there maybe a limitation concerning the amount of pixels/images?

I also attached an example Blitz0.log file when running the PDF export from the Figure file in question.

Thank you for your help and cheers,
Kai

--
Please note my NEW PHONE NUMBERS: +41 61 207 57 31 (direct) +41 61 207 22 50 (central)<<
Kai Schleicher, PhD | Research Associate in Advanced Light Microscopy | Biozentrum, University of Basel | Klingelbergstrasse 50/70 | CH-4056 Basel |
Phone: +41 61 207 57 31 (direct) +41 61 207 22 50 (central) | kai.schleicher at unibas.ch<mailto:kai.schleicher at unibas.ch> | www.biozentrum.unibas.ch<http://www.biozentrum.unibas.ch/> | www.microscopynetwork.unibas.ch<http://www.microscopynetwork.unibas.ch/>

<OMERO_ExportPDF_Error_Blitz.log>_______________________________________________
ome-users mailing list
ome-users at lists.openmicroscopy.org.uk<mailto:ome-users at lists.openmicroscopy.org.uk>
http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-users


The University of Dundee is a registered Scottish Charity, No: SC015096


_______________________________________________
ome-users mailing list
ome-users at lists.openmicroscopy.org.uk<mailto:ome-users at lists.openmicroscopy.org.uk>
http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-users


_______________________________________________
ome-users mailing list
ome-users at lists.openmicroscopy.org.uk<mailto:ome-users at lists.openmicroscopy.org.uk>
http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-users


The University of Dundee is a registered Scottish Charity, No: SC015096
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openmicroscopy.org.uk/pipermail/ome-users/attachments/20180123/50f82ece/attachment.html>


More information about the ome-users mailing list