(solved) PDF export on linux 53 times bigger than on Windows

If you are having problems with QCAD, post here. Please report bugs through our Bug Tracker instead.

Always attach your original DXF or DWG file and mentions your QCAD version and the platform you are on.

Moderator: andrew

Forum rules
Always indicate Operating system, QCAD version
Attach Drawing files, Screenshots
Post Reply
Gaz
Newbie Member
Posts: 7
Joined: Mon Sep 30, 2013 9:17 am

(solved) PDF export on linux 53 times bigger than on Windows

Post by Gaz » Tue Jun 02, 2015 1:56 pm

I have a fairly small drawing of 333 KB in size (attached), but when I export to PDF, the PDF size is 12.6 MB! e_surprised
This is even after I have turned off the auxilary layer and removed some peripheral details.

I tried the QCAD export, and well as printing to the linux PDF printer, and both gave the large 12.6MB .pdf file.
I've read every post on the forum that may help but I couldn't find any fixes there.

As a test I tried the Windows version and it's PDF export was perfect at 234 KB, which is a huge difference, about 53 x smaller.

So at least I have a work around - run a Windows PC just for exporting to PDF, but I would obviously prefer to use just my primary linux PC.

Can anyone please give any ideas as to what is causing the PDF bloat on linux and what I may try to rememdy it?

-------- CONFIGURATION --------
Versions
QCAD version: 3.9.4.0 Date: May 25 2015
Qt version: 4.8.4
Compiler version: gcc 4.4.3
OS: Linux, openSUSE 13.1 (x86_64)
----------------------------------------

Regards
Gaz e_ugeek
Perth, Australia
Attachments
Front porch_paving_plan.dxf
(333.05 KiB) Downloaded 198 times

User avatar
andrew
Site Admin
Posts: 6909
Joined: Fri Mar 30, 2007 6:07 am

Re: PDF export from linux is 53 times bigger than on Windows

Post by andrew » Tue Jun 02, 2015 2:44 pm

PDF export is handled between the Qt tool kit which QCAD is based on and the operating system's PDF driver.
Unfortunately, QCAD is too far away from all of that to be able to influence the file size.

I've tested this also with the latest Qt version 5.4.1 (on Mac OS X) and the file size is still around 13MB, so no fix can be expected for this from the Qt side, sorry.

Gaz
Newbie Member
Posts: 7
Joined: Mon Sep 30, 2013 9:17 am

Re: PDF export from linux is 53 times bigger than on Windows

Post by Gaz » Tue Jun 02, 2015 3:18 pm

OK, so if QT is the problem, would this also explain why using the Print option and selecting the "PDF printer" gives the same bloated PDF?

Gaz
Newbie Member
Posts: 7
Joined: Mon Sep 30, 2013 9:17 am

Re: PDF export from linux is 53 times bigger than on Windows

Post by Gaz » Tue Jun 02, 2015 3:24 pm

andrew wrote:PDF export is handled between the Qt tool kit which QCAD is based on and the operating system's PDF driver.
Unfortunately, QCAD is too far away from all of that to be able to influence the file size.

I've tested this also with the latest Qt version 5.4.1 (on Mac OS X) and the file size is still around 13MB, so no fix can be expected for this from the Qt side, sorry.
Do you think it is worth me trying to solve this with a newer operating system PDF driver?
Or even a different flavour of linux? Though I am a little disheartened by your OSX testing, which didn't make a difference.

Is anyone else using linux and getting small PDF export file sizes? If so, can you please post details of your linux and QCAD version.

--
Gaz

Gaz
Newbie Member
Posts: 7
Joined: Mon Sep 30, 2013 9:17 am

Re: PDF export from linux is 53 times bigger than on Windows

Post by Gaz » Tue Jun 02, 2015 4:56 pm

After looking for .dxf file viewers I came across LibreCAD, and it could view my QCAD .dxf file nicely and export as PDF with a file size of just 1.1 MB, which is much better than QCAD's 12.6MB.

LibreCAD uses Qt too, so Qt alone can't be the cause of QCAD's PDF bloat on linux. :?:

So there are workarounds: Use QCAD (Windows) for PDF exports, or other .dxf drawing/viewing software such as LibreCAD. I'll see if there are any other light weight .dxf viewers for linux that may also work.
--
Gaz

spatz
Junior Member
Posts: 16
Joined: Sun Mar 11, 2012 12:25 pm

Re: PDF export from linux is 53 times bigger than on Windows

Post by spatz » Tue Jun 02, 2015 4:57 pm

Hello,

got attached pdf files with Debian GNU/Linux (testing) and the CUPS pdf driver (printer-driver-cups-pdf, version 2.6.1-20) and QCAD 3.9.2.0 / Qt 4.8.6.

Regards
Stephan
Attachments
Front porch_paving_plan_colored.pdf
(260.07 KiB) Downloaded 189 times
Front porch_paving_plan.pdf
(260.18 KiB) Downloaded 175 times

User avatar
andrew
Site Admin
Posts: 6909
Joined: Fri Mar 30, 2007 6:07 am

Re: PDF export from linux is 53 times bigger than on Windows

Post by andrew » Wed Jun 03, 2015 9:44 am

I've had a look again and found the culprit. There's a simple and logical explanation and fix after all:

- Load your drawing
- Zoom in to the area with an orange rectangle:
Screen Shot 2015-06-03 at 10.34.20.png
Screen Shot 2015-06-03 at 10.34.20.png (189.07 KiB) Viewed 5163 times
- The rectangle that seems to be solid filled contains really four extremely dense hatch patterns on top of each other (patterns NET and HOUND)
- These hatch patterns cause the large file size since lots of tiny lines are being (correctly) exported to PDF
- Delete three of those hatches and change the last one to solid:
Screen Shot 2015-06-03 at 10.37.30.png
Screen Shot 2015-06-03 at 10.37.30.png (60.95 KiB) Viewed 5163 times
- Export to PDF -> file size will be about 150kB

Librecad quite likely simply does not know or support the hatch patterns called NET or HOUND and therefore can't render those hatches at all.
I haven't quite figured out what QCAD under Windows does differently, but at least this should fix your problem.

Gaz
Newbie Member
Posts: 7
Joined: Mon Sep 30, 2013 9:17 am

Re: PDF export from linux is 53 times bigger than on Windows

Post by Gaz » Wed Jun 03, 2015 3:17 pm

spatz wrote:Hello,

got attached pdf files with Debian GNU/Linux (testing) and the CUPS pdf driver (printer-driver-cups-pdf, version 2.6.1-20) and QCAD 3.9.2.0 / Qt 4.8.6.

Regards
Stephan
:lol: Fantastic Stephan! So there is hope for me to stick with QCAD on linux. Did you modify the original drawing at all, or just open it and print to PDF. Andrew, above found an issue with Hatching, so I am curious if you had to 'clean' things up first.

I installed CUPS pdf driver, but I am having some problems with it after modifying one of it's .conf files to set the default print directory. I'll work and try to get it going because the file size you produced is perfectly acceptable to quickly print or email.

-- Gaz
Last edited by Gaz on Wed Jun 03, 2015 3:31 pm, edited 1 time in total.

Gaz
Newbie Member
Posts: 7
Joined: Mon Sep 30, 2013 9:17 am

Re: PDF export from linux is 53 times bigger than on Windows

Post by Gaz » Wed Jun 03, 2015 3:30 pm

andrew wrote:I've had a look again and found the culprit. There's a simple and logical explanation and fix after all:
- The rectangle that seems to be solid filled contains really four extremely dense hatch patterns on top of each other (patterns NET and HOUND)
- These hatch patterns cause the large file size since lots of tiny lines are being (correctly) exported to PDF
- Delete three of those hatches and change the last one to solid:
- Export to PDF -> file size will be about 150kB
.
Andrew,

That is legendary sleuthing of you.
I am intrigued. How did you determine the location of the problem?
From your experience are hatches often a potential issue like this?
Is there anything in QCAD that would help me identify such issues, like a "Drawing checker" function? Or if not, is there a way to list hatches, so that I could manually check them?

Regards, Gaz

User avatar
andrew
Site Admin
Posts: 6909
Joined: Fri Mar 30, 2007 6:07 am

Re: (SOLVED) PDF export on linux 53 times bigger than on Win

Post by andrew » Wed Jun 03, 2015 3:49 pm

Hatches could often be the cause of slow rendering (or in this case large PDF exports).

One of the hatches in the marked area is a rectangle shaped hatch of about 400x300 units with pattern HOUND and a scale factor of 0.05. This could easily take several seconds to render. If the factor would be even smaller, minutes or hours. For this reason, QCAD has a configurable timeout for rendering hatches (default is 2s).

Your Linux machine was able to render the extremely dense hatch and exported it, creating the big (correct) PDF file.
Your Windows machine (and Stephan's Linux machine) are a bit slower than your Linux machine, so the extremely dense hatch caused a time out and was not exported, creating the smaller (incomplete) PDF file.

The selection filter can be useful to find such hatches:
View > Selection Filter
Screen Shot 2015-06-03 at 16.45.24.png
Screen Shot 2015-06-03 at 16.45.24.png (33.92 KiB) Viewed 5147 times
I agree that some general tool to find all problem areas (zero length entities, huge entities, duplicate entities, dense hatch patterns, dense line patterns, etc) in a drawing would be helpful.

Gaz
Newbie Member
Posts: 7
Joined: Mon Sep 30, 2013 9:17 am

Re: (SOLVED) PDF export on linux 53 times bigger than on Win

Post by Gaz » Wed Jun 03, 2015 4:53 pm

andrew wrote:Hatches could often be the cause of slow rendering (or in this case large PDF exports).

One of the hatches in the marked area is a rectangle shaped hatch of about 400x300 units with pattern HOUND and a scale factor of 0.05. This could easily take several seconds to render. If the factor would be even smaller, minutes or hours. For this reason, QCAD has a configurable timeout for rendering hatches (default is 2s).
I just followed through your post and located the offending hatches using the select filter you described and there they are!! How bizarre, I can't recall how this could have come about. :oops:
4 layers of hatches!! OMG!
andrew wrote: Your Linux machine was able to render the extremely dense hatch and exported it, creating the big (correct) PDF file.
Your Windows machine (and Stephan's Linux machine) are a bit slower than your Linux machine, so the extremely dense hatch caused a time out and was not exported, creating the smaller (incomplete) PDF file.
Well explained. I feel very happy that it was (ab)user caused, and not some bug waiting to haunt me again. My Windows machine is a virtual one, and has a very basic virtual graphics controller, so it would have certainly timed out if asked to work that hard to render 4 layers of dense hatching.
andrew wrote: I agree that some general tool to find all problem areas (zero length entities, huge entities, duplicate entities, dense hatch patterns, dense line patterns, etc) in a drawing would be helpful.
In the previous hours I spent researching and trying to resolve this issue, apart from pruning and cropping my drawing, I used "Block | Purged Unused Blocks", which found a couple of extraneous things, but still did not help with my main issue.

I am glad that I eventually asked on the forum, and I am VERY HAPPY that the root cause of this has been found. Mistaken dense hatches were the last thing I was looking for. I dread to think of the further hours I would have spent looking at the pdf engine of the OS. Thanks VERY much Andrew for your expert insight! If I see such a thing again, at least now I know where to start looking.

Regards, Gaz (QCAD noob)

spatz
Junior Member
Posts: 16
Joined: Sun Mar 11, 2012 12:25 pm

Re: (SOLVED) PDF export on linux 53 times bigger than on Win

Post by spatz » Wed Jun 03, 2015 7:09 pm

Interesting. So my old machine has maybe saved me some disk space :-) .

Post Reply

Return to “QCAD Troubleshooting and Problems”