FastReport - display PDF in report - delphi

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.

Use TfrxPictureView and assign it with your database field

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.

Related

IFilter for JPG files

I'm using the IFilter interface to read the content of files such as .docx, .pdf, etc. For those two types (and others) this already works pretty well, but I was wondering if it is possible to use this mechanism to read the meta data of a jpg file as well.
I created a test image file and added some information to its details (Title, description, ...)
Interestingly, the Windows Indexer is able to find this file using the text that I specified as title. By using the IFilter interface, however, I retrieve only an empty string for my jpeg.
I also tested the command line tool filtdump.exe from here: https://msdn.microsoft.com/en-us/library/windows/desktop/dd940434(v=vs.85).aspx#command_line, which returned the same results as my implementation.
Does anyone know how the Windows indexer is able to see the content and how I couold use the same mechanism to achieve similar results?

PDF add stamp annotation from image

I have very specific task in Delphi 2010 with PDF. After some days fight I want to ask your help.
Task:
open pdf in embedded viewer component on a form
define a rectangle with mouse on the document
add into the rectangle stamp annotation from image file (BMP or PNG or JPG). The image must be stretched to the selected rect.
I try to use next components:
Acrobat Reader ActiveX (TAcroPDF)
Gnostice PDF Toolkit
Debenu PDF library
At the moment I have crazy mix of problems.
Acrobat can show PDF and can show annotations but has a methods to select a rectangle and to add a stamp from an image file.
Gnostice can show PDF, can select a rectangle BUT can not add annotation from image file and can not read all new 1.7 PDF files.
Debenu has no viewer but can read all files, can add a stamp fro image file.
Now I have almoust working solution with using all 3 libraries (each for own part of the task).
But some times acrobat library (or any other) raises exception like "can not save file" and other ones. I killed all concurence for processed PDF file (at one moment only one component exists, all other is destroyed).
The main question is not to help to kill the exceptions... But show me a way or library to solve the task. Maybe exist a PDF library for Delphi which I do not know... and this wonderful library can solve the task.
Thanks.
I would suggest not using TAcroPDF all together.
please see this post: TAcroPDF loses resolution after form has resized.
furthermore:
Debenu PDF library can render, modify and save PDF files as an Image - if you simply just have to show the user a preview - using debenu - create a temporary image file and show it in a TImage - Then use the rest of the Library to save the actual .PDF or do whatever you need to.

XML SDK 2.0 - Images - Excel file

With the use of the Open XML SDK 2.0, I did preformed the Reflected Code of an Excel file.
Along with other things, the Excel file has some images in some of the cells. When I run the code that was generated, the file show the images just fine.
What I need to do is to programatically inject images in place of the
images that are there now. The thing is, I cannot find where the images are at in the code that was generated. How can I figure this out? Also what is the easiest way to replace those images with new ones programmatically?
You may want to take a look at a similar question about inserting images into Excel files with OpenXML SDK: C# & OpenXML: Insert an image into an excel document.
Basically, those files are created as separate document parts. The answer I linked to should show You how to insert a new image into a document, however, in order to substitute existing images with your custom ones, you could probably just modify the binary data of appropriate ImagePart (and some other associated properties).
If You need some help with the code performing this task, let me know.

Is it possible to display a PDF in a Report Builder report?

We use report builder to generate reports on our software developed with Delphi 2010. I have a lot of reports that display an image, but:
Is it possible to display a PDF in a report builder report just like we display a JPG?
One of our customers wants to display PDFs that contains only a single page with an image (dont ask me why he did not save it as JPG). But the problem is, he has a lot of pdfs that he does not want to convert.
It is possible IF you convert the PDF to another image format.
refer to how to convert PDF to BMP/PNG/JPG etc etc
or check out http://wiki.freepascal.org/PascalMagick

Pdf modification on iOS

I am looking to be able to open a pdf file (done) and then be able to use the touch screen to sign the pdf and then save it with the modification. From what i have read this is no easy task, and i have no idea where to begin. Any of you know any tutorials or frameworks that will help me with this ?
Also if possible being able to modify fields of a pdf file, on the desktop the pdf can have fields you can click on then type in to fill out the form, without the need to ever print. If this is possible as well that would be perfect.
Thanks.
Maybe libHaru (http://libharu.org/wiki/Main_Page) does what you want, it's worth a try.
Does your starting point have to be a PDF? steipete's suggestion of using a system to create the PDF would work if your app workflow could create the PDF (sans signature) and display it, the user "signs" it in your app, and you create the PDF again this time with the signature embedded. It depends on whether this flow is an option for your app. Often it seems easier if you treat PDF as a final document and produce the PDF in it's final form each time (final meaning that you're not going to try modifying it).

Resources