0
votes

I try to display a PDF file (stored in the DB as image field) in my report. When I display it in an image object, the image object appears empty.

What am I doing wrong or is there another way to display PDFs in a FastReport report?

I'm using Delphi Embarcadero XE6 and FastReport V5.1.

2
You might use TfrxOleView.bummi
Then I get an error message that the streaming format is not correct.Cvijetin Kujundzic
what format this image is saved? TfrxPictureView accepts only bmp, jpg, png, ico, wmf and emfkabstergo
The image is saved as jpg.Cvijetin Kujundzic

2 Answers

0
votes

Use TfrxPictureView and assign it with your database field

0
votes

If you have already converted all PDFs to JPEG and then stored them as JPEGs in the DB, then TfrxOleView will be able to display them.

If not, you need to create a custom report component derived from TfrxReportComponent and handle its Draw event. The Draw event should get the PDF blob, convert it as a metafile/bitmap, and then draw the metafile/bitmap on the canvas of the custom control. This custom component needs to be used in your report instead of the TfrxPictureView control. (Check FastReport's Developer manual for more information.)

You will need a PDF library to convert the PDFs to metafile/bitmap. (I recommend my company's product PDFtoolkit for this.)

PDF-to-JPEG conversion takes time and may slow down your reports. So, I would advise you to first run the conversion on your DB and store the images in another column. That way, you don't have to write any custom report component. You just refer the images column/field.