How to set PDF resolution in DPI(or PPI )

PDF-XChange Editor SDK for Developers

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
baranyviki
User
Posts: 7
Joined: Fri Feb 08, 2019 4:10 pm

How to set PDF resolution in DPI(or PPI )

Post by baranyviki »

Hello!

I would like to create a pdf with a given resolution, e.g. 300 DPI/PPI. How can I achieve this without changing the actual size of the pdf?

Thanks,
Viki
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17824
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: How to set PDF resolution in DPI(or PPI )

Post by Tracker Supp-Stefan »

Hello Viki,

The PDF page's sizes are specified in points, and usually it's 72 points per inch (this can be different but for 99.9% of all PDF files this is the case).

So e.g. an Letter / Ansi A page is 612 x 792 pt (8.5 x 11 inches).

Then you just 'place' objects in the coordinate system of the page.
So as such vector objects will be with indefinite resolution, and will need to have their dimensions specified in the term of the coordinate system of the page, and raster objects and images you will need to calculate to make sure they are 300 DPI - so e.g. if you do have a 500 x 500 px image - you need to place it as 120 x 120pt big (1.66 x 1.66 inches) on the PDF page for it to be exactly 300 DPI. So if your input images are of varying pixel dimensions - you will need to capture those, and from there calculate the size they need to be on your pages to be the desired pixel density (and this is of course provided that the page on which you will place those images will then be printed 1:1 on paper, as the PDF page can easily be scaled further at print time).

Regards,
Stefan
baranyviki
User
Posts: 7
Joined: Fri Feb 08, 2019 4:10 pm

Re: How to set PDF resolution in DPI(or PPI )

Post by baranyviki »

Hello Stefan!

Thank you for the thorough explanation, it was very helpful. I was a little confused about PDF resolution, but it's clear now. :)

Regards,
Viki
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: How to set PDF resolution in DPI(or PPI )

Post by Sasha - Tracker Dev Team »

:)
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Mpoor
User
Posts: 7
Joined: Wed Feb 20, 2019 10:52 pm

Re: How to set PDF resolution in DPI(or PPI )

Post by Mpoor »

Hi guys!

"The PDF page's sizes are specified in points, and usually it's 72 points per inch (this can be different but for 99.9% of all PDF files this is the case). "

Can I make it different with the EditorSDK? I mean can I change that 72 ppi to 300?

Thanks in advance,

Michael
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: How to set PDF resolution in DPI(or PPI )

Post by Sasha - Tracker Dev Team »

Hello Michael,

No you can't change the PPI, if you want to specify your own coordinate system - specify your own Current Transformation Matrix for each content generation, in your case with the scale coefficient of 72 / 300.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Mpoor
User
Posts: 7
Joined: Wed Feb 20, 2019 10:52 pm

Re: How to set PDF resolution in DPI(or PPI )

Post by Mpoor »

Hi Alex!

I'm a bit lost here.

If I scale each content with the scale coefficient of 72 / 300 but set the page size to lets say A4, doesn't that mean that every content will appear smaller?

Thanks,

Michael
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: How to set PDF resolution in DPI(or PPI )

Post by Sasha - Tracker Dev Team »

Hello Michael,

What exactly do you want to achieve? Please read Stefan's post carefully - i think he clarified this well enough.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Mpoor
User
Posts: 7
Joined: Wed Feb 20, 2019 10:52 pm

Re: How to set PDF resolution in DPI(or PPI )

Post by Mpoor »

Hi Alex!

My problem is that we have some clients who are using old printers with old drivers that they can't update anymore. If I put a 0.2 mm thick line in our pdf and they print it, it just looks fuzzy on the paper. If they print another pdf containing a 0.2 mm thick line (not made by us with the EditorSDK) it looks perfect. Both of the pdf files have the same paper size set (lets say A4) and they both contain the same line.

I don't know if there's a solution to this.

Cheers,

Michael
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: How to set PDF resolution in DPI(or PPI )

Post by Sasha - Tracker Dev Team »

Hello Michael,

Can you give us a sample of such a PDF - it's not a DPI related problem at all.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
baranyviki
User
Posts: 7
Joined: Fri Feb 08, 2019 4:10 pm

Re: How to set PDF resolution in DPI(or PPI )

Post by baranyviki »

Hi Alex!

I'm Michael's colleague, and I could create two sample PDFs in Bullzip, with 300dpi and 72dpi resolution.The two drawings are alike (same size and line thickness in [mm]). As you can see in the samples, the PDF with higher resolution produces a thinner line. We'd like to achieve this with your SDK. Is it possible somehow?

Regards,
Viki
Attachments
samples.7z
(1.7 KiB) Downloaded 65 times
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: How to set PDF resolution in DPI(or PPI )

Post by Sasha - Tracker Dev Team »

Hello Viki,

We don't need PDFs generated by some 3rd party programs. We need the information on how and from where exactly are you printing. Also, we will need the PDF that prints correctly on your user's printer, and we need the PDF with SAME content that does not print correctly and is created by our SDK.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
baranyviki
User
Posts: 7
Joined: Fri Feb 08, 2019 4:10 pm

Re: How to set PDF resolution in DPI(or PPI )

Post by baranyviki »

Hello Alex!

I've created the same drawing with your SDK, and attached the output (xchangeSample). The other attached pdf is printed correctly on our user's printer. Our user have a HP Design Jet 110 printer, and uses Adobe Acrobat Reader for printing the PDF.

Regards,
Viki
Attachments
xchangesample.7z
(5.11 KiB) Downloaded 67 times
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: How to set PDF resolution in DPI(or PPI )

Post by Sasha - Tracker Dev Team »

Hello Viki,

The file that prints correctly has CM of 0.24 and line width of 1. The file that you are generating with our SDK has a line width of 0. Thus the resemblance. You have two possible solutions:
1) Set the line width to 0.24 (72/300) without the usage of matrix.
2) Set the CM to 0.24 and the line width to 1.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply