I have a problem with merging 2 PDF files using Delphi.
I'm having problems while trying to merge 2 PDF's together using the Delphi code below:
Code (Delphi):
Var OldPDF : hPDF;
OV : hPDF;
CPI : Array of LPPXCp_ContentPlaceInfo;
SetLength(CPI,NumberOfPages);
for i:=0 to NumberOfPages-1 do
begin
New(CPI[I]);
CPI[Lauf].DestPage:=I;
CPI[Lauf].SrcPage:=0;
CPI[Lauf].Alignment:=CPA_HorFit or CPA_VerFit or CPA_Foreground;
end;
Err:=pxcp_placeContents(OldPDF,OV,NumberOfPages,CPI[0],0);
OV is a pdf with only one page, that should overlay all the pages in OldPDF.
I have tried this with a pdf with 3 pages.
The resulting pdf have the overlay only at page 1.
With a OldPDF of 100 pages, the overlay are on pages 1,10,15,18 (random?)
You are using wrong declaration for CPI variable - it must be an array of PXCp_ContentPlaceInfo structures, not pointers to them. See corrected code below:
Code (Delphi):
CPI : Array of PXCp_ContentPlaceInfo;
....
SetLength(CPI,NumberOfPages);
for i:=0 to NumberOfPages-1 do
begin
CPI[i].DestPage:=i;
CPI[i].SrcPage:=0;
CPI[i].Alignment:=CPA_HorFit or CPA_VerFit or CPA_Foreground;
end;
Err:=pxcp_placeContents(OldPDF,OV,NumberOfPages,@CPI[0],0);
You can contact us by phone, email or our social media accounts — we are here to assist you.