PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → WD21 - PDF in imagecontrol bad quality
WD21 - PDF in imagecontrol bad quality
Débuté par Arie, 15 sep. 2017 11:32 - 8 réponses
Posté le 15 septembre 2017 - 11:32
Hi,

In one of our applications we are showing images like jpg, png but also pdf.
Most of the pdf's are perfectly readable, but some are not.
See below the first example is the pdf opened with Irfanview (same quality as for example in the Edge-browser).
The second example is in an WD image control. Bad quality.

Do I have any options to improve the quality of the PDF shown in an image control?

[attachment 2438 Clip31.png]
[attachment 2439 Clip32.png]

BTW: the imagecontrol is used to extract al individual pages of the PDF and save them als JPG files. I can use Irfanview for that, but that means on every client an extra tool has to be installed. I prefer not to.
Posté le 15 septembre 2017 - 16:33
Hi Arie,

there are 2 componants to your question:

1. the display quality problem
2. the page extractions

The answer is different for the 2 parts :

1. In order to have a better image DISPLAYED quality, you need to change the settings of the image field to something like homethetic/centered/+High Quality

2. In order to have a good quality when extracting pages from your pdf you need something completely different (which is why I'm using a HIDDEN image field to do this part):
- set your hidden image field as 100%
- get the size in pixel of the pdf page using the infobitmap function
- RESIZE your hidden image field to the exact value found (..width and ..height). You may want to also change ..X to push it further out left
- THEN load the image in the field, and loop on the pages to save each page as images

The SIZE of the image control has to be EXACTLY the size of the page, or SCALING will occur and make the resulting image blurry/low quality.

Best regards
Posté le 15 septembre 2017 - 20:46
Thanks Fabrice,

but I'm already doing both. It works for most (in fact all) pdf's, for quite some time. Until recently with pdf's coming from the one particular customer. I guess these pdf's differ from most others in some way, but I cannot see how.

I already send an example to PCSoft. They should be able to see the difference behind the scenes. Hope they are willing to do so as well.

For those interested: here is on of the bad guys
http://www.ariezona.nl/upload/959097.pdf

Try to load in an imagecontrol. No need for a compiled executable, it even goes wrong in the IDE.
Posté le 16 septembre 2017 - 14:54
Hi Arie,

I looked at your file, and it's not a version problem (1.7, and others of that version are ok)

However, I found out that your pdf seems to have multiple layers (by the way, I could read easily what's under the black rectangles). You can see that by opening it in acrobat readers: first the bad quality/thumbnail layer is displayed, then the good quality on top of it. and that's probably what is not supported in the image field.

So, it looks like you need to find a way to flatten that pdf (or ask your customer to stop playing with layers).

Best regards
Posté le 18 septembre 2017 - 12:52
Thanks Fabrice,

I didn't know about the layers, so that explains the problem. I send pcsoft an example. Waiting for an answer now....
Posté le 18 septembre 2017 - 19:30
Hi Arie,

Whats funny is that the "sender" (GPC) in your form has a WinDev system for shipping fish (FlyFish) delivered from me. :)

Cheers
Tor-Bjarne
Posté le 18 septembre 2017 - 20:42
Hi Tor-Bjarne,

it's a great world and small at the same time!

Is the PDF also generated by your application? If so, then I could make a small sample for pcsoft and let them see their image control can not handle pdf's created by themselves. It would simplify their taks to solve this problem.

btw: I thought I had hidden all names for privacy reasons, but obviously I missed some pieces. So I removed the pdf.
Posté le 19 septembre 2017 - 18:05
Hi Arie,

good thing that you removed it, because ALL masked information was clearly visible in my pdf editor (once again, it looked like you had just added a layer of masking tape on top, but you didn't merge the different layers.

Best regards
Posté le 21 septembre 2017 - 20:58
Quote
Arie

Is the PDF also generated by your application?

Yes, but I use List and Label to generate PDF`s and do not use any image to show PDF`s (We only ship PDF`s)

Cheers
Tor-Bjarne