printing to pdf

Posted on

Problem :

The existing system has many reports . Using a free pdf printer like dopdf or cutepdf the user can open the report , choose the pdf printer , type in the filename and save the report as a pdf file.This seems a bit tedious

It would be nice to have the report directly saved as a pdf file just on click of a button.
Unfortunately the reporting tool component doesnt have pdf export functionality.
. Is there a way to programatically do this function using a third party component.

The printing should be silent , so that the user is not asked for a filename.Report 1 when clicked will make a file called c:1.pdf for example.
something like this
ActivatePdfPrinter(c:1.pdf);
printreport;
ClosePdfPrinter;

or any other method .

I use delphi but if you suggest any other tools that work in other programming languages then I can search in the right direction.

Solution :

The free, open source PDFCreator can function as a virtual printer but it’s also usable via COM. The default setup even includes COM examples.

You can check the COM samples in the SourceForge SVN repository right here: http://pdfcreator.svn.sourceforge.net/viewvc/pdfcreator/trunk/COM/

Delphi and ActiveX get along superbly so you should not have much trouble.

Install Adobe Acrobat Professional and choose “Adobe PDF” as the printer.

Win2PDF 10 does all of that and more.

Check out the registry functions:

https://www.win2pdf.com/doc/registryoverview.html

Feature Comparison Chart:

https://www.win2pdf.com/features.html#Win2PDF-Product-Comparison

I’ve been using Win2PDF Pro for at least 20 years at home and on my workstation at work; and have always found it reliable and speedy. I just downloaded the latest version service pack and will be updating my installation at next reboot. Enjoy.

Pragnaan has a PDF Export Device for ReportBuilder:
Report Builder Export Devices

You don’t say how you are generating your reports but Gnostice have a number of tools that may of help to you.

Following up on Stijn Sanders’s reply: The latest version of ReportBuilder from Digital Metaphors now includes native PDF export, as well as “silent” saving of the PDF, and e-mailing of the report. You are correct, however, in that you would have to convert all of your reports to ReportBuilder. It may be worth looking into, though, depending on the complexity and number of reports in your project. We converted ours from Rave Reports and never looked back.

Anna, as an aside in the comments you mention you’re using an older version of ReportBuilder – have you looked at the Waler TExtraDevices component? I don’t have it to hand but I seem to recall back in the day we used this to get output from ReportBuilder to PDF, and because of the way it makes ReportBuilder think it’s a text device, you can do this without any previewing or interaction on the part of the end user.

Having said that, you’re looking for a general-purpose method that would work with QuickReport and Excel. I really think you’re going to end up with some kind of ‘PDF Printer’ and forcing your reports to this ‘named printer’. You might be able to set-up PDF Factory such that it takes the output filename from the document title, etc – but I do think you’re always going to have a bit of user interaction no matter how hard you try. ­čÖü

Do let us know what you do, as this is a problem I’ve had myself and never managed a very satisfactory solution. I’d be interested to see what you choose to do!

I use PDFFactory. Is a software similar to others thar work like a virtual printer.
Is not very expensive.
The particularity is that you can control (using the windows registry) some parámeters to print any document without the user intervention.

I use it in my Delphi application.

  1. Select the default printer (PDFFactory)
  2. Write the FileName,… on the registry key
  3. Send to print.

The user should not write anything and not view any config window.

Win2PDF also has a registry API to print to PDF with no user interaction. From Delphi, you just need to set the “PDFFileName” registry key to the PDF file and then print to the Win2PDF printer.

Leave a Reply

Your email address will not be published. Required fields are marked *