Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delphi, QuickReport and PDFs

Status
Not open for further replies.

garwain

Programmer
Jan 30, 2002
461
0
0
CA
I currently have a quickreport in a D5 program that is printed to Acrobat PDF Writer, to create a PDF file, which works fine. My problem is I now have to append an existing PDF file to the report. From what I've read, my understanding is that PDF Writer cannot append to an existing file. Does anyone know of any (cheap) methods to append one PDF file to another, or is there a way that I can send my report and the PDFs that need to be attached as one print job?

Any ideas / suggestions are appreciated
 
Hi garwain,

You can use PowerPDF which is a powerful suite for
creating PDF Files.

WPTools is good, too, but quite expensive from
what I remember.

Cheers,

Andrew
 
Thanks for the suggestions.
I have found a different solution that works well for me. I ended up using Acrobat automation to open the file and insert the pages. Best part is it's free, downside is that Acrobat (or at least components of it) have to be installed on the computer running the program, but in my case, every client machine has Acrobat 4 installed anyway.

I'll post my code for anyone else who needs to perform a similar task. It's not the best, but it works.

procedure TForm1.Button1Click(Sender: TObject);
var
AcroApp : Variant;
PDDoc : Variant;
InsertPDDoc : Variant;
iNumberOfPagesToInsert: Integer;
iLastPage : Integer;

begin
AcroApp := CreateOleObject('AcroExch.App');
PDDoc := CreateOleObject('AcroExch.PDDoc');
InsertPDDoc := CreateOleObject('AcroExch.PDDoc');

AcroApp.Hide;
PDDoc.Open('c:\mainfile.pdf') ;
InsertPDDoc.Open('c:\insertfile.pdf') ;
iNumberOfPagesToInsert := InsertPDDoc.GetNumPages;
showMessage (intToStr(iNumberOfPagesToInsert));
PDDoc.InsertPages(iLastPage, InsertPDDoc, 0, iNumberOfPagesToInsert, True);
PDDoc.save(1,'c:\a.pdf');
AcroApp.CloseAllDocs;
AcroApp.exit;
end;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top