Xojo PDF Class 2020r1.1 to r2 DrawPicture

since a update to 2020 r2 the picture output into a pdf looks ugly.


the screenshot use a canvas backdrop picture property that i had paint into a pdf.
its also not possible to set a background image to a pdf because loss of quality.

Ashampoo_Snap_Donnerstag, 3. Dezember 2020_16h37m43s_002_

the method that create a pdf

Var pdf As New PDFDocument(PDFDocument.PageSizes.A4)
pdf.Author = "..."
pdf.Keywords = "..."
pdf.Landscape = True
pdf.Compressed = False

Var g As Graphics = pdf.Graphics

Var pic As Picture = CanvasChart.Backdrop

g.DrawPicture(pic,10,10,g.Width-20,g.Height-20,0,0,pic.Width,pic.Height)

Var f As FolderItem = SpecialFolder.Desktop.Child("Auslastung.pdf")
pdf.Save(f)

f.Open
1 Like

Same here.

Tried using g.AntiAliasMode = Global.Graphics.AntiAliasModes.HighQuality before DrawPicture. But there is no difference in the pdf output quality.

1 Like

@Greg_O_Lone
can someone add me to the tester / pro group here again?

is this issue also at 2020 2.1?

Hi @MarkusR, another approach:

Why don’t you go directly into the PDF context (PDFGrpahics). This would allow you to zoom into the drawing without loss. That would be an advantage over the static JPG file.

1 Like

That for the replay.

@MarkusR Yes the issue is also at 2020 2.1 :slightly_frowning_face:

@Martin_T I’m on OSX (Catalina 10.15.7) and using the PDFGraphics way. When I try to load the example projects: /PDF/Invoice or /PDF/GraphicsPath the issue is also there. Images are displayed blurry and not sharp.

My approach is the same as in the examples/PDF/Invoice.

1 Like

Maybe the Xojo Engineer for PDF @Javier_Menendez can say something about.

Hi @Carl_Lambregts

The pictures in the Invoice example are drawn as JPEG… and that means some quality loss (compression artefacts). I’ve been working on some improvements on this and will be available in the next release.

About the PDF GraphicsPath example, it is impossible that the result PDF is blurry; because that is drawn as vectors and, thus, it is resolution independent. In fact, you can open the PDF file with any editor (for example Preview on macOS) and scale it as much as you can… without quality loss.

2 Likes

hi,
i am employee at service hotline, customer care & paper work and beside i do officially a job as software developer, only a few hours a day if there is time. (employed there since 4 month.)

i had used a scanned document as background and print over some text, that was ok at print output and ready.
because this graphics issue by xojo after version update i rebuild this report in more of a half day with lines and boxes and other texts. (the picture background was quick and dirty i know …)
that was much effort that it looks same as the original document which was used in past at this company.

the chart output from mbs to picture to pdf was also good enough and ready to use.
my boss have visions and we made last year a time schedule. i try to do my best as fast as possible to start with a new software to optimize his business processes which will handle the customer base this year before Easter.

the mbs dynachart examples was based on picture output, so it get a picture first and then it draw into.
so i need to draw the picture in the pdf then. i don’t know yet if dynachart can output direct to graphics.

if me print to a 300 dpi (20 years old) printer and if me calculated it correct a A4 page width is 2480 pixels and 3507 height.
the pdf drawn image at top (from canvas backdrop ) was 3.904px × 2.167px in size,
that blurry thing came after a xojo update. my zoomed screenshot was a png.
it seems that pdf class use a fractional part of that dpi.
at least the resulution at print preview should look same as the window backbround before and not coarse.
i responded to your pm.

playing around at other pc.
different usage of DrawPicture parameters result in very different pdf image preview quality.

pic.HorizontalResolution = 72
pic.VerticalResolution = 72

pic.HorizontalResolution = 300
pic.VerticalResolution = 300

g.DrawPicture(pic,10,10,g.Width-20,g.Height-20,0,0,pic.Width,pic.Height)
g.DrawPicture(pic,10,10,g.Width-20,g.Height-20,0,0)
g.DrawPicture(pic,10,10,g.Width-20,g.Height-20,0,0,pic.Width)
g.DrawPicture(pic,10,10)

1 Like

I have the same problem with the PDF-Class. An invoice is shown correctly on the printer, but in the created pdf the logo-icon, a .png picture, is drawn invers and in a very poor quality.

The same with the invoice example from the Examples\PDF - Folder.