Bug report #15855

Composer -> Export as PDF produced bigger file/crash qgis

Added by Alain Lachance about 8 years ago. Updated over 7 years ago.

Status:Closed
Priority:High
Assignee:-
Category:Map Composer/Printing
Affected QGIS version:2.18.4 Regression?:Yes
Operating System:Windows 7 Easy fix?:No
Pull Request or Patch supplied:No Resolution:not reproducable
Crashes QGIS or corrupts data:Yes Copied to github as #:23773

Description

In QGIS 2.18.0, my exported PDF file take a very long time to display in Adobe Reader (more than 20 second for small map) and printer also take a very long time to processing it before printing (more than 5 minutes). I didn't have this problem with QGIS 2.16.0, PDF file open very quickly(less than 1 second) and printer received it in less than 30 second (I don't know how long because it is ready after I walk to the printer). I didn't have QGIS 2.16.0 installed anymore but I checked the same project with QGIS 2.12.3 and exported PDF file size is half as big than PDF file exported with QGIS 2.18.0.

pdf_size_2_18_4.m4v (2.28 MB) R. R., 2017-03-11 11:08 AM

pdf_size_2_18_4_inkscape_workaround.m4v (3.88 MB) R. R., 2017-03-11 11:08 AM

pdf_comparison_gimp_1200dpi.mp4 (1.12 MB) R. R., 2017-03-11 11:08 AM

proprietary__gis_and_pdfcreator-1-7-3.pdf (1.85 MB) R. R., 2017-03-17 03:54 AM

pdf_comparison.png (209 KB) R. R., 2017-03-17 04:35 AM

Template_Formato_A3.qpt (54.1 KB) Andre Jesus, 2017-03-17 05:13 AM

a3_300_pdfcreator_high.pdf (2.3 MB) Giovanni Manghi, 2017-05-03 12:59 PM

a3_300_qgis_raster.pdf (2.34 MB) Giovanni Manghi, 2017-05-03 12:59 PM

a3_300dpi_qgis_simply.pdf (2.2 MB) Giovanni Manghi, 2017-05-07 11:12 PM

History

#1 Updated by Alain Lachance about 8 years ago

Today in QGIS 2.18.0, I work on an heavy map and I can't use Export as PDF in composer because Memory jump to 100% and QGIS crash (Usage memory jump from 12 GB to 16 GB). I tried in QGIS 2.12.3 and it works.

#2 Updated by Nyall Dawson about 8 years ago

  • Status changed from Open to Feedback

I'm not aware of any related changes since 2.16. Can you do some troubleshooting, such as removing layers from the project one-by-one and see if you can pinpoint exactly what causes this increased file size? It may be a particular symbol style or layer which is doing it...

#3 Updated by Alain Lachance about 8 years ago

I did many tests to specify the bug. I used many .ecw raster file of aerial photograph (50 in total). In QGIS 2.16.3, when I export my print composer map the size of pdf file stay the same when I activate more raster file that wasn’t show in my composer. In QGIS 2.18.0, when I select more raster file to be visible in my project, but wasn’t visible in my composer, the size change. Thus, QGIS 2.18.0 export raster file that wasn’t visible in my map canvas extent. So I must check only visible layers that I want in my print composer otherwise the size increase drastically.

#4 Updated by Giovanni Manghi almost 8 years ago

  • Status changed from Feedback to Open
  • Priority changed from Normal to Severe/Regression

#5 Updated by Giovanni Manghi almost 8 years ago

  • Status changed from Open to Feedback

Can the reporter give feedback about QGIS 2.18.4? I just tried to print a large map (A0) with aerial images and the output pdf size seemed very reasonable in size to me (4MB at 150dpi). Thanks.

#6 Updated by R. R. almost 8 years ago

Exporting an A3 sheet containing raster images at 300 dpi crashes QGIS 2.18.4. Windows says 'not enough memory' after a few minutes. To me, this is a really severe regression. I can't even export orthophotos in a higher resolution than 150 dpi. The file size of an exported A0 .pdf sheet containing only vector layers is around 30 MB. Similar .pdf files created in a proprietary GIS software have around 2 - 3 MB.

#7 Updated by Giovanni Manghi almost 8 years ago

Reinhard Reiterer wrote:

Exporting an A3 sheet containing raster images at 300 dpi crashes QGIS 2.18.4. Windows says 'not enough memory' after a few minutes. To me, this is a really serve regression. I can't even export orthophotos in a higher resolution than 150 dpi. The file size of an exported A0 .pdf sheet containg only vector layers is around 30 MB. Similar .pdf files created in a proprietary GIS software have around 2 - 3 MB.

is that Windows 32 bit or 64?

#8 Updated by Giovanni Manghi almost 8 years ago

  • Crashes QGIS or corrupts data changed from No to Yes
  • Subject changed from Composer -> Export as PDF produced bigger file. to Composer -> Export as PDF produced bigger file/crash qgis
  • Affected QGIS version changed from 2.18.0 to 2.18.4

Reinhard Reiterer wrote:

Exporting an A3 sheet containing raster images at 300 dpi crashes QGIS 2.18.4. Windows says 'not enough memory' after a few minutes. To me, this is a really serve regression. I can't even export orthophotos in a higher resolution than 150 dpi. The file size of an exported A0 .pdf sheet containg only vector layers is around 30 MB. Similar .pdf files created in a proprietary GIS software have around 2 - 3 MB.

can you share (even privately) the project and data and layout that are causing this?

#9 Updated by R. R. almost 8 years ago

Win7 - 64bit

#10 Updated by Giovanni Manghi almost 8 years ago

Reinhard Reiterer wrote:

Win7 - 64bit

can you share (even privately) the project and data and layout that are causing this?

#11 Updated by R. R. almost 8 years ago

...sample files send by mail. Please do not share the files!

#12 Updated by Giovanni Manghi over 7 years ago

Reinhard Reiterer wrote:

...sample files send by mail. Please do not share the files!

with the provided project and data, printing a PDF in A0 at 360dpi (vector mode) produced a ~14/15mb file on both Linux and Windows, that seems very reasonable to me, or ami i wrong?

#13 Updated by R. R. over 7 years ago

As noted above, the proprietary GIS software, that we use at the moment, produces much smaller files than QGIS.

#14 Updated by R. R. over 7 years ago

Inkscape can be used to reduce the size of .pdf files created in QGIS (see screencasts).

#15 Updated by R. R. over 7 years ago

To reproduce this issue, please download sample shape files from http://data.statistik.gv.at/data/OGDEXT_GEM_1_STATISTIK_AUSTRIA_20170101.zip and export the map (1:1.500.000) as an A3 sheet. The size of the .pdf file is around 32MB (QGIS 2.18.4). Exporting the same shapes from a proprietary GIS software using PDFCreator 1.7.3, the file size is around 2MB (see attachment).

#16 Updated by R. R. over 7 years ago

#17 Updated by Andre Jesus over 7 years ago

Windows 10 64 bits

QGIS 2.8.9 32 bits
A3 300 dpi, 3.92 MB PDF, ~5 seconds
A0 160 dpi, 12.8 MB PDF, ~5 seconds

QGIS 2.18.4 64 bits
A3 300 dpi, 3.92 MB PDF, ~10 seconds (also 5% higher cpu usage)
A0 160 dpi, 12.8 MB PDF, ~10 seconds (also 5% higher cpu usage)
A0 300 dpi, 43.7 MB PDF, ~50 seconds

4 active layers, 16 GeoTIFF images (20,4 GB)

#18 Updated by Andre Jesus over 7 years ago

Now I see something interesting.

I have a composer template (Template Format A3.qpt attachment) I use since 2.x.x. If I use It to generate the PDF I get a sub-4 MB PDF, but If I create a new composer and select A3 present It creates a 29.5 MB PDF. This occurs in all versions (2.8.9+).

I tried to see what that composer template has different but I couldn't figure It out.

#19 Updated by Giovanni Manghi over 7 years ago

  • Regression? set to Yes

#20 Updated by Giovanni Manghi over 7 years ago

  • Priority changed from Severe/Regression to High

#21 Updated by Giovanni Manghi over 7 years ago

  • Easy fix? set to No

#22 Updated by Giovanni Manghi over 7 years ago

Reinhard Reiterer wrote:

To reproduce this issue, please download sample shape files from http://data.statistik.gv.at/data/OGDEXT_GEM_1_STATISTIK_AUSTRIA_20170101.zip and export the map (1:1.500.000) as an A3 sheet. The size of the .pdf file is around 32MB (QGIS 2.18.4). Exporting the same shapes from a proprietary GIS software using PDFCreator 1.7.3, the file size is around 2MB (see attachment).

The export from QGIS is ~32MB if you export as vector, if you export as raster the size produced by QGIS is exactly the same as the one created by PDF creator using the option "high quality". See attached files. PDFcreator seems to only export as raster, so this explains a lot (of not everything).

#23 Updated by Giovanni Manghi over 7 years ago

Andre Jesus wrote:

Now I see something interesting.

I have a composer template (Template Format A3.qpt attachment) I use since 2.x.x. If I use It to generate the PDF I get a sub-4 MB PDF, but If I create a new composer and select A3 present It creates a 29.5 MB PDF. This occurs in all versions (2.8.9+).

I tried to see what that composer template has different but I couldn't figure It out.

is the template configured to print as raster?

#24 Updated by Giovanni Manghi over 7 years ago

The crash is not replicable here on 2.18.7 (Windows, Linux) even with large projects and heavy data. Can the reporter add further informations? a project with data would help a lot.

#25 Updated by Andre Jesus over 7 years ago

Giovanni Manghi wrote:

is the template configured to print as raster?

It is configured to print as raster. Trying to replicate using 2.14.14 and 2.18.7 they all performed the same: Vector= ~5.6 MB and Raster= ~1.4 MB.

Adding satellite background raised the sizes to: Vector= ~9.6 MB and Raster= ~2.9 MB. Still way smaller than those near 30 MB it created before.

#26 Updated by Giovanni Manghi over 7 years ago

Andre Jesus wrote:

Giovanni Manghi wrote:

is the template configured to print as raster?

It is configured to print as raster.

so this explains the reduced size.

#27 Updated by R. R. over 7 years ago

Giovanni Manghi wrote:

The export from QGIS is ~32MB if you export as vector, if you export as raster the size produced by QGIS is exactly the same as the one created by PDF creator using the option "high quality". See attached files. PDFcreator seems to only export as raster, so this explains a lot (of not everything).

Hi Giovanni,

proprietary__gis_and_pdfcreator-1-7-3.pdf contains vector geometries. You can check this using Inkscape. I noticed that the exported PDF file contains simplified geometries. This explains the small file size.

Have yo tried to save the QGIS PDF export again using Inkscape? (see # 15)

#28 Updated by Giovanni Manghi over 7 years ago

Hi Giovanni,

proprietary__gis_and_pdfcreator-1-7-3.pdf contains vector geometries. You can check this using Inkscape. I noticed that the exported PDF file contains simplified geometries. This explains the small file size.

´
I simplified your vector, and created with QGIS a A3, 300dpi, 2.2MB, printed as vector PDF (attached).
It seems to me that we can close this:

your software simplifies the geometries (possibly without telling you, in case this is a bug to me)
QGIS does not so any simplification in the print compose, but you can do easily with the Processing toolbox.

#29 Updated by Giovanni Manghi over 7 years ago

  • Resolution set to not reproducable
  • Status changed from Feedback to Closed

The size comparison is now pretty much explained to me now.

If you can print (as vector) a NOT simplified version of the vector and still get sizes well below the ones created by QGIS then reopen this ticket.

About crashes:
be sure you are using a 64bit version of QGIS. Remove all 3rd party plugins and if this does not yet help then post here a project+data+layouts to allow use replicate locally.

Also available in: Atom PDF