#1 2022-09-15 19:55:41

skamradt
Member
Registered: 2022-09-15
Posts: 3

TGDIPages.AppendRichEdit() doesn't import some PNG images

I am using AppendRichEdit to print some RTF blobs, and I'm noticing that images which were added to the RTF as a png are not being converted, yet images added as a JPEG are.  Is there some magic that has to occur that I'm missing to allow png images to render properly?  The not working images are stored in the RTF as ...\pngblip\..., the working images are stored in the RTF as ...\jpegblip\...

The images render properly to the screen if I load the blob into a TRichEdit control, and also print if I use a FastReport report.

Offline

#2 2022-09-16 06:16:22

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,552
Website

Re: TGDIPages.AppendRichEdit() doesn't import some PNG images

The RichEdit is converted using raw EMR MetaFile records, in which there is no notion of jpeg or png, only bitmaps.

SynPdf handles the regular EMR_BITBLT EMR_STRETCHBLT EMR_STRETCHDIBITS EMR_TRANSPARENTBLT records, converting the bitmaps into pdf images.
My guess is that the issue is that the RichEdit component you use is not able to render png images.

Are you sure your RichEdit is created in version 5.0 not 2.0?
https://stackoverflow.com/q/54570552/458259

Or you may try to include the image as bitmap not png and use \wbitmapN or \dibitmapN tags.
See https://www.biblioscape.com/rtf15_spec.htm

Offline

#3 2022-09-16 20:26:10

skamradt
Member
Registered: 2022-09-15
Posts: 3

Re: TGDIPages.AppendRichEdit() doesn't import some PNG images

Some oddness going on for sure.  The RichEdit (vanilla from Delphi 11 components) appears to be rendering the png images properly on the screen, its just when it goes to insert into the report that the png images are getting removed. Unfortunately I'm not able to change the format of what is in the RTF fragments, most of the time they are pasted in screen shots and I have records going back several years.  The fast report export was working, but it renders everything as an image (including text) which breaks the ability to do a text search on the document or feed the pdf through a screen reader.

Offline

#4 2024-02-29 07:45:02

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,552
Website

Re: TGDIPages.AppendRichEdit() doesn't import some PNG images

The RichEdit Windows component is a black box.
If it does not PNG export support, I do not see how to do it.

What could be done is to add images as plain bitmaps. SynPdf will save them with deflate encoding, just like a PNG.

Offline

#5 2024-04-23 16:55:19

rvk
Member
Registered: 2022-04-14
Posts: 114

Re: TGDIPages.AppendRichEdit() doesn't import some PNG images

I'm not sure about Delphi 11 (I'm still on 10.2) but TJvRichEdit supports images. They have Ole callback stuff which is probably needed to render the images to the metastream.

(I currently do have a small problem with images, not showing text after an image, but I'll open a new topic for that)

Offline

Board footer

Powered by FluxBB