PDF Class - DrawPicture problems

Upgrading to the latest XOJO release i was looking forward to the new PDF-Class.
I was generating an invoice form where everything works fine, beside the company-Logo which is drawn in a very poor quality and invers. It happens with .png and also .jpg
On the same invoice form is a barcode generated with the Monkeybread-Plugin. This graphic is also in very poor quality.
Displaying the code in a canvas both the logo and the barcode are lookin good.

By the way… the same problems happens with the invoice example from the examples/PDF-folder.

Anybody else with the same problem, or even better with a solution?

You could try MBS Xojo DynaPDF Plugin as a replacement. The Starter one (enough to write PDF), can do images and is currently available as part of OmegaBundle.

Hi @Kai_Mummert1

Has been said in other threads about this same topic, currently all the images (pictures) are rendered in the PDF document as JPEG, what means compression and, thus, loss in quality.

its not about loss quality because jpeg, it was about hires get lores so images looks 1/4 size in quality for some reason. i guess that was the meaning of his wroting “very poor quality”
it could maybe the picture settings VerticalResolution of 72 dpi by default and printer use 300,600,1200 dpi.
good pictures drawn in pdf preview at window looks like they have a poor quality.

with Monkeybread plugin and qr code i have no issue, it looks good.

its not about loss quality because jpeg, it was about hires get lores so images looks 1/4 size in quality for some reason.

Yes Markus, as been told in other threads about this same topic (and you probably know), PDF has not notion of “resolution” on any of the objects used in the document; that is because it is resolution independent. Thus, currently the images are stored always at 75 dpi (you can’t set the “output” dpi for images in a PDF). The loss of quality is because the compression.

Probably other solutions are storing images without compression of the data.

Everything will come along the path… :slight_smile:

Why 75dpi? (And why JPEG?)

I can’t believe that is required by the PDF spec because I see plenty of PDF’s with what look to have significantly higher resolution embedded pictures (both on screen or printed), including some I create in Xojo with a plugin.

-Karen

2 Likes

Unless changed the standard coordinate system is 72 dpi for points.
We have a function to change that in case you need more than 65535 * 2.54 / 72 = 1857 cm big pages.

If you place an image with MBS Xojo DynaPDF Plugin, you can put in pictures with any resolution.
Usually we scale them down to 150 dpi, unless you call SetResolution or ask for pass through mode. Then you can of course get 600 dpi or more.

I’m using the Einhugur PDF plugin and have no issues with picture resolution.

1 Like

BTW I think PDFs are specified in Points Per inch and a point is not necessarily the same as a pixel or “dot”

Minimum “image print quality” is 300DPI. If you want to force it to the limit of the low quality you can reach 150 for a pixelated result. 75 you are playing in the field of the useless content. Please reconsider your options.

2 Likes

And no matter what a lossless format should be supported… If the tradeoff is size of the PDF file, we should be the ones to decide that depending on what we need for what we are doing.

-Karen

At 300DPI even a lossy JPEG well calibrated can render good results. Maybe even barcodes aren’t affected, they need to study the combinations. An XObject (PDF content, in this case, image content) can be compressed lossy or lossless (DCTEncode or LZWEncode), and even the lossy option can be adjusted to near to lossless quality. Some images, like barcodes, must have a very good fidelity.

@Javier_Menendez you have a pm with test project.

how it looks at my windows 10 pc. (look at 1:1 on monitor that source code looks clear)
at least i expect it looks at screen almost same as the screenshot taken before and not so much blurry.
this blurry effect came after an xojo update in 2020.

1 Like

DynaPDF can easily to 1200 dpi lossless if needed.

SHEESH! The cost is way too rich for us nobody’s (MBS license link only allows pro version purchase). In no way am I saying MBS DynaPDF isn’t worth the money, I’m sure it is. I guess I’m doomed to crappy graphics with black backgrounds in my PDF’s.
To quote Marvin the Martian: “Well, it’s back to the ol’ drawing board”. LOL

Hey, 2 years has passed. Still have problems?

As I understand it, solving the bad graphics in PDF’s isn’t really do-able without DynaPDF, so yes…still having problems. It all comes down to the money for me. ie: I literally ain’t gots none, y’all. LOL
Heck, I consider it a miracle that I can manage to create a PDF at all. Poor old brain just ain’t what it used to be.

This is pure current Xojo PDF:

I actually have the relevant blog post open right now. Sadly, it’s the same story…no $$$ to update Xojo.
It’s fine though, we all have to live within our limitations. :wink: