1

I have a 18000x18000px PDF file I generate via matplotlib. Before printing I would like to preview it, at least at 20% zoom. Sadly nothing I have tried so far works:

  • evince will only open it at a maximum zoom level of 1.3%. This is after I have increased the cache size (via the dconf editor) to ~500MB - further increases (I have tried up to 8 GB) do not improve the maximum zoom. I believe there is some other bottleneck that I am unaware of.
  • mupdf fails with malloc of array (153904 x 615616 bytes) failed (integer overflow)
  • Inkscape just takes up all of my RAM (16 GB) and then freezes.

I have alternatively tried to export it as a SVG and open it with inkscape, but that too fills up my RAM and then freezes (but does so more slowly).

Also, I have tried to divide the file into complementary tiles, with the first iteration being:

pdfcrop --verbose --margins "10 10 10000 10000" --clip g.pdf out1.pdf

This has been taken a few hours now, and does not seem to make much progress, on the plus side, it is not eating up all my RAM.

Matplotlib also has the capacity to export PS - but given the larger size of PS, I suspect that would go even worse.

Can you help me find a way to preview my file under Linux?

In case you want to give the file a go you can find it here.

4
  • What is the resolution of the image you produce? Try increasing it to something around 300 ppi. Acrobat Reader should then be able to display it.
    – Max Wyss
    Sep 18, 2016 at 9:30
  • 18000x18000px (~300dpi) - also, I am looking for a linux solution. and Adobe has long been discontinued for linux.
    – TheChymera
    Sep 18, 2016 at 12:22
  • What is the resolution of the image? The size is 18000 x 18000 px; that's its absolute size. It is very likely that the application creating the image did set the resolution to 72 ppi, which then turns the image into a size which the PDF viewer can not display. So, check the output options of the creating software, and increase the resolution of the image to 300 ppi (maybe even 600). Also, I am fully aware of the Linux requirement. In order to display and print, Adobe Reader 9 (that's the latest from Adobe for Linux) does work.
    – Max Wyss
    Sep 18, 2016 at 18:03
  • Have you tried cropping a section to a PNG or other image format with ghostscript? See e.g. here. -dDownScaleFactor and -r may also be useful to get down memory usage.
    – dirkt
    Sep 19, 2016 at 5:43

1 Answer 1

0

As indicated in the comments, the best solution thus far was to crop the PDF into PNG tiles. The a basic command to do that using ghost script is:

gs -o out.png -sDEVICE=pngalpha -g2000x2000 -dLastPage=1 -c "<</Install {-1000 -10000 translate}>> setpagedevice" -f in.pdf

I went ahead and wrote a script that can take the name and resolution of the PDF and the tile size as inputs, and outputs numbered tiles. It is fairly basic and assumes the image and tiles are square. You can find it on GitHub.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .