Page 1 of 1

Delphi

Posted: Mon Jan 11, 2010 11:54 am
by Fixfinn
Does anyone know how to programm Pdfprinter from Delphi?


Best regards

Re: Delphi

Posted: Thu Mar 11, 2010 7:09 pm
by Bullzipper
Yes, I have the same problem. Have you made any progress with this?

Thanks;

Re: Delphi

Posted: Wed Apr 21, 2010 2:57 pm
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?

Re: Delphi

Posted: Wed Apr 27, 2011 6:27 pm
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.

Re: Delphi

Posted: Wed Sep 21, 2011 3:01 am
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.

Re: Delphi

Posted: Wed Sep 21, 2011 3:40 am
by clear1140
ah forget about my previous post .. found it out by configuring the gui.exe