Problem with PDF export

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 your operating system and QCAD version.

Attach drawing files and screenshots.

Post one question per topic.

Post Reply
avanhove
Newbie Member
Posts: 6
Joined: Fri Aug 09, 2024 12:46 pm

Problem with PDF export

Post by avanhove » Fri Aug 09, 2024 1:12 pm

Hi there,
We're having a problem exporting a .dwg file as a PDF.
We've noticed that some of the text and lines are much too thick compared to the original. I've attached the .dwg and .pdf files for you to look at.

Thanks in advance for your help,

Have a nice day!
Alexis
Attachments
Toitures.pdf
(3.28 MiB) Downloaded 502 times
Toitures.dwg
(605.38 KiB) Downloaded 504 times

CVH
Premier Member
Posts: 4872
Joined: Wed Sep 27, 2017 4:17 pm

Re: Problem with PDF export

Post by CVH » Fri Aug 09, 2024 5:18 pm

Hi,
avanhove wrote:
Fri Aug 09, 2024 1:12 pm
We've noticed that some of the text and lines are much too thick compared to the original.
That is basically a misconception.

One of the indicated lines has a Lineweight of 0.70mm (ISO).
The PDF format is A4 and printed on A4 this line is just under 1mm wide.
The one at the opposite side are several parallel lines, one has a weight of 0.30mm and the other has a weight of 0.70mm (ISO) ...
... Together they are printed as about 1mm wide.
Meaning that the PDF export is exactly how it was configured. e_geek

PDF_Lineweight.png
PDF_Lineweight.png (36.77 KiB) Viewed 15242 times

Lineweights relate to pen sizes we used back in the days when we drew directly on paper with ink.
0.70mm is always exactly 0.70mm wide on paper, whatever the paper size and/or scale.
Physical pens don't scale.

When displaying your project in Model_Space using Screen-based Linetypes (NL) a pixel based hybrid representation is used.
Not using Screen-based Linetypes then the lines are rendered in their actual size with a minimum of 1 pixel or they would disappear.
And then 0.70mm or even 2.11mm is nothing compared to an overall size of 105000mm.

It starts to play a role when we scale everything down by a factor of about 1300.
Then 0.70mm is about 1% of the overall size.

For the record:
0.70mm scaled down by factor 1300 is 0.00054mm and that would not be printed or it would not be visible on paper. :wink:


For setting a maximum lineweight please refer to https://www.qcad.org/rsforum/viewtopic. ... 071#p45071

Regards,
CVH

CVH
Premier Member
Posts: 4872
Joined: Wed Sep 27, 2017 4:17 pm

Re: Problem with PDF export

Post by CVH » Sat Aug 10, 2024 4:06 am

Additionally:
There are no such Lineweight limitations for an PDF export with the GUI similar as for dwg2pdf.
The options are then:
- 1) Print/Export all as hairlines.
- 2) Use proper Lineweights.
- 3) A QCAD session wide tweak.

The disadvantage of 1 is that there will be no difference between any of the line-art except for polylines with a width not zero.
Option 2 may be problematic because all the weights in your drawing are defined as a custom Lineweight.
-> In CAD it is common that attributes are governed by the layer: Tutorial: Working with Layers
-> And then Layer states could be used to display things differently depending the usage: Tutorial: Working with Layer States
3) Similar as https://www.qcad.org/rsforum/viewtopic. ... 984#p39984 but then use setMaximumLineweight(double lw)


But there are more unaddressed issues in your drawing.
For example Dimension entities with a Lineweight of 0.13mm and a text height of 0.18mm
The pen size won't be scaled but the text height will be reduced by factor 1300 ...

Regards,
CVH

avanhove
Newbie Member
Posts: 6
Joined: Fri Aug 09, 2024 12:46 pm

Re: Problem with PDF export

Post by avanhove » Mon Aug 12, 2024 9:58 am

Hi there,

First of all, thanks a lot for your quick reply.
Then I have a question,
Attached is an SVG export with the same export parameters as the PDF.
Why aren't they the same? I mean with the same scaling?

I don't understand why the PDF export doesn't display the same thing as the QCAD software with the same scaling.

Thanks in advanced,

Kind Regards,

Alexis
Attachments
Capture d’écran du 2024-08-12 10-26-55.png
Capture d’écran du 2024-08-12 10-26-55.png (249.17 KiB) Viewed 14780 times

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

Re: Problem with PDF export

Post by andrew » Mon Aug 12, 2024 10:16 am

avanhove wrote:
Mon Aug 12, 2024 9:58 am
I don't understand why the PDF export doesn't display the same thing as the QCAD software with the same scaling.
It does if QCAD is in print preview. In model space, there is no paper size, no drawing scale and thus a lineweight has no meaning. A lineweight of 0.7mm prints as 0.7mm on paper or PDF, regardless of scale, paper size or zoom level.

avanhove
Newbie Member
Posts: 6
Joined: Fri Aug 09, 2024 12:46 pm

Re: Problem with PDF export

Post by avanhove » Mon Aug 12, 2024 11:34 am

Is it possible to use the hairline mode in dwg2pdf command ?

CVH
Premier Member
Posts: 4872
Joined: Wed Sep 27, 2017 4:17 pm

Re: Problem with PDF export

Post by CVH » Mon Aug 12, 2024 12:15 pm

Please attach the SVG file for comparison. (If possible, my attempt was 23.5Mb large :roll: )

Exported to SVG at scale 1:1300 or printed the SVG at scale?
Quick export or Advanced?
Preserving geometry or not?

DXF is developed by Autodesk as a type of universal format for storing CAD models.
For CAD we use a limited set of pen sizes.
For this matter PDF is a digital way to represent a paper output ... Identical as if it would be plotted/printed.
SVG is a scalable vector image.
Each serve a specific usage.

Initially the stroke in an SVG would match the pen size disregarding the export scale.
The difference is that the SVG standard is not limited to a predefined set of pens.
It might be that the stroke is scaled along with the paper size (294266.52 x 238420.12mm) to fit an A4.
Or that it is merely an artifact of your SVG renderer.

avanhove wrote:
Mon Aug 12, 2024 11:34 am
Is it possible to use the hairline mode in dwg2pdf command ?
Yes, answer and link already provided.
-max-lineweight=LW with LW below 0.05mm for example.

Regards,
CVH

avanhove
Newbie Member
Posts: 6
Joined: Fri Aug 09, 2024 12:46 pm

Re: Problem with PDF export

Post by avanhove » Mon Aug 12, 2024 1:22 pm

Hi,

I'm using the dwg2svg cmd :

Code: Select all

/opt/qcadcam/dwg2svg -f -equal-margins=0 -a -s 1:1 -min-lineweight=15mm -g -embed-images -platform offscreen -outfile='.$filename.' "'.$filename.'.dwg"
I tried to use the -max-lineweight with the dwg2pdf cmd without success

Code: Select all

opt/qcadcam/dwg2pdf -platform offscreen -a -f -max-lineweight=0.05mm -outfile='.$filename.' "'.$filename.'.dwg"
Please do not hesitate to contact us if you require any further information.

Regards,
Alexis
Attachments
Toiture.svg
(1.65 MiB) Downloaded 510 times

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

Re: Problem with PDF export

Post by andrew » Mon Aug 12, 2024 1:42 pm

avanhove wrote:
Mon Aug 12, 2024 1:22 pm
I tried to use the -max-lineweight with the dwg2pdf cmd without success
Can you please let us know what "without success" means? Was there an error? Was the output not as expected? If so, why not?

Note that -max-lineweight=0.05mm will give you a maximum lineweight of 0 as "0.05mm" is not a valid number.

The command should be:

Code: Select all

opt/qcadcam/dwg2pdf -platform offscreen -a -f -max-lineweight=0.05 -outfile='.$filename.' "'.$filename.'.dwg"
I've attached the result here for your reference.
Attachments
Toitures.pdf
(3.19 MiB) Downloaded 509 times

CVH
Premier Member
Posts: 4872
Joined: Wed Sep 27, 2017 4:17 pm

Re: Problem with PDF export

Post by CVH » Mon Aug 12, 2024 2:33 pm

The attached SVG has a page size of 282222,23 by 238435,12mm
This is not exported exactly at scale 1:1 as we may presume from the command line string.
With the QCAD GUI the SVG page is 294266,52 by 238420,12mm

Horizontally the page is exactly 1000000px or 282222,23mm wide what relates to 35,43307...px/mm or 900,0000...dpi
It seems there is an odd limit of 1000000px in 900dpi :?
That might be an Inkscape artifact because your legend is displayed outside the page area.

Because of your export switch -min-lineweight=15mm all entities have now a stroke width of 15mm.
That is a physical pen size that we can't select under CAD.
Even for this somewhat reduced SVG a stroke width of 15mm wide is about nothing compared with the overall size.
They will look very thin. :wink:

Remark that the -a switch has a different function for dwg2svg or for dwg2pdf
SVG: -a, -adjust Adjust page size to include thickest line weight
PDF: -a, -auto-fit Auto fit and center drawing to paper

For a PDF your export is first automatically scaled to the default page size.
That is not the case for your SVG export.
To have comparable outputs one has to scale both with the same factor.

Regards,
CVH

avanhove
Newbie Member
Posts: 6
Joined: Fri Aug 09, 2024 12:46 pm

Re: Problem with PDF export

Post by avanhove » Tue Aug 13, 2024 2:55 pm

andrew wrote:
Mon Aug 12, 2024 1:42 pm
avanhove wrote:
Mon Aug 12, 2024 1:22 pm
I tried to use the -max-lineweight with the dwg2pdf cmd without success
Can you please let us know what "without success" means? Was there an error? Was the output not as expected? If so, why not?

Note that -max-lineweight=0.05mm will give you a maximum lineweight of 0 as "0.05mm" is not a valid number.

The command should be:

Code: Select all

opt/qcadcam/dwg2pdf -platform offscreen -a -f -max-lineweight=0.05 -outfile='.$filename.' "'.$filename.'.dwg"
I've attached the result here for your reference.

Hello,

The parameter I gave you was incorrect.
Thank you very much, because thanks to your help, my PDF export is working perfectly and the lines are as thick as possible.

Now, I think I have everything I need to make what I want work.

Many thanks for the answers you've given me.

Have a nice day,

Sincerely

Alexis

Post Reply

Return to “QCAD Troubleshooting and Problems”