Delphi

About the programming interface for the virtual PDF printer driver.

Moderator: jr

Fixfinn
Posts: 4
Joined: Mon Jan 11, 2010 11:19 am

Delphi

Post by Fixfinn »

Does anyone know how to programm Pdfprinter from Delphi?


Best regards
Bullzipper
Posts: 1
Joined: Thu Mar 11, 2010 5:34 am

Re: Delphi

Post by Bullzipper »

Yes, I have the same problem. Have you made any progress with this?

Thanks;
Fixfinn
Posts: 4
Joined: Mon Jan 11, 2010 11:19 am

Re: Delphi

Post by Fixfinn »

I just make different *.ini files in notepad and then copy/move them in delphi, depending on which I have to use.
It is not so elegant, but it works.

Now I have to find out how to see when making the pdf-file is finish?
riley.carrier
Posts: 1
Joined: Wed Apr 27, 2011 6:13 pm

Re: Delphi

Post by riley.carrier »

If you haven't imported the type library that's the first step. Once that's been done, you can use something similar to what is below:

The following fragment assumes you've created the PDFPrinterSettings as a VCL object in a datamodule or form i.e., PDFPrinterSettings1: TPDFPrinterSettings;

procedure setuppdfprinter;
var
pi : integer;
begin
try

pi := printer.Printers.IndexOf('Bullzip PDF Printer [SOA]');
printer.PrinterIndex := pi;

PDFPrinterSettings1.Connect;
PDFPrinterSettings1.SetPrinterName('Bullzip PDF Printer [SOA]');
PDFPrinterSettings1.LoadSettings(FALSE);
oppfn := '\\' + OppOutFileNodeName + '\' + JobFile.GetInstance + '$\' + ExtractFileName(UnixPathToDosPath(OppOutFileName));
PDFPrinterSettings1.SetValue('output', oppfn);

{$IFDEF WATERMARK}
if JobFile.GetInstance <> 'xxxxxxx' then
begin
PDFPrinterSettings1.SetValue('WatermarkText', 'TEST DOCUMENT');
PDFPrinterSettings1.SetValue('WatermarkTransparency', '70');
end;
{$ENDIF}

PDFPrinterSettings1.WriteSettings(TRUE);
PDFPrinterSettings1.Disconnect;
except
writeln('Error connecting to OLE');
end;
end;

Since you've selected the PDF printer as your output device it will create a PDF document when you print using begindoc/enddoc or whatever process you are using. The jobfile class is custom and unique, just make sure you specify the output filename for the pdf document. If you are multi-threaded then you will need to synchronize writing the printer settings.

I also set the document title before physically printing it. I hope this helps.
clear1140
Posts: 2
Joined: Wed Sep 21, 2011 2:53 am

Re: Delphi

Post by clear1140 »

Good Day,

I'm new to delphi and i tried the code above. I was wondering how to
1.) un-check the "open the document after creation" checkbox
2.) to automatically "save" without showing the "Bullzip PDF Printer - Create File" form after sending the file to print

hoping for a response, thank you in advance.
clear1140
Posts: 2
Joined: Wed Sep 21, 2011 2:53 am

Re: Delphi

Post by clear1140 »

ah forget about my previous post .. found it out by configuring the gui.exe
Post Reply