#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: 13,504
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

Online

#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

Board footer

Powered by FluxBB