Two Pilots™    Home  |  Navigation  |  Site Map  |  Products  |  Download  |  Prices  |  For Partners  |  Support


All forums · Statistics · Search ·

Two Pilots forum / For software developers / Merging two PDF pages to one page
Author Message
Anonymous
# Posted: 21 Sep 2011 03:29


Hi,
we are using PDFCreatorPilot with your Virtual Printer and have to implement a new feature to our software.
We want to merge two PDFs to one. Example: We have an invoice, only text and a company letter head with graphics. Now we want to merge these two PDFs to one and the text must be shown above the graphics in the second PDF. What would be the best method for this? A code example would be highly appreciated. Thanks.
Greetings
Thomas

Artem
Member
# Posted: 21 Sep 2011 03:47


Hi,

You may use the Append method for merge two PDFs to one. The below is sample code for merging two PDFs:
http://www.colorpilot.com/pdfcreatorpilotmanual/IP DFDocument4/Append.html

If you have any other questions, please don't hesitate to contact us.

--
Best regards,
Artem Golubnichenko

Two Pilots
http://www.colorpilot.com

Anonymous
# Posted: 21 Sep 2011 04:06


Dear Thomas.

If you have blank as image (BMP/JPEG/Single TIFF/PNG) you can add it as graphic watermark and after printing some text you will obtain PDF with background image and text above the background.

For more details see colorpilot.com/readme2.pdf, section "graphic watermark settings".

Regards,
Renat.

Anonymous
# Posted: 21 Sep 2011 04:29


Hi Artem,
when using the appen method it results in a new PDF with two pages. I don't understand how to merge two PDF files to one page. I have an example here, can I upload them to you.
Greeting
Thomas

Anonymous
# Posted: 21 Sep 2011 04:43


Hi,
Artem sorry here is my email to send me an upload link: tb(at)task-it.de

Hi, (Post: 21 Sep 2011 04:06 )
Renat thx for the tip, but unfortunately our customer want's to import the company letter head as a PDF.

Greetings
Thomas

Artem
Member
# Posted: 21 Sep 2011 04:45


Hi Thomas,

The library of PDF Creator Pilot has feature for combining 2, 3, 4, etc. pages in a single page in the pdf document. See the following example, please:
http://www.colorpilot.com/blog/feature-for-groupin g-multiple-pages-on-single-page-in-the-pdf-documen t/

You may use the support form for uploading your files - http://www.colorpilot.com/support.php

If you have any other questions, please don't hesitate to contact us.

--
Best regards,
Artem Golubnichenko

Two Pilots
http://www.colorpilot.com

Anonymous
# Posted: 21 Sep 2011 05:23


Hi all,
thx for the help, I've found a solution and here is my C++ code as an example:

Information: PDF_Graphic = the company letter head

void CPDFMergeDlg::OnBnClickedMerge()
{
CPDFDocument4 l_oPDF_Text;
CPDFDocument4 l_oPDF_Graphic;

CString l_csPDF_Text = "D:ProjektetempPDFMergeText.pdf";
CString l_csPDF_Graphic = "D:ProjektetempPDFMergeGraphic.pdf";

BOOL l_fRet = FALSE;

long l_lPageCount = -1;
long l_lPageHeight = -1;
long l_lPageWidth = -1;



l_fRet = l_oPDF_Text.CreateDispatch( INX_C_PDFCREATORPILOT_GUID );
if( l_fRet != TRUE )
{
return;
}
l_oPDF_Text.SetLicenseData( INX_C_PDFCREATORPILOT_USERNAME, INX_C_PDFCREATORPILOT_PWD );

l_fRet = l_oPDF_Graphic.CreateDispatch( INX_C_PDFCREATORPILOT_GUID );
if( l_fRet != TRUE )
{
return;
}
l_oPDF_Graphic.SetLicenseData( INX_C_PDFCREATORPILOT_USERNAME, INX_C_PDFCREATORPILOT_PWD );


// Open PDF
l_oPDF_Text.Open( l_csPDF_Text, "" );
l_oPDF_Graphic.Open( l_csPDF_Graphic, "" );

l_oPDF_Text.Append( l_csPDF_Graphic, "" );

l_lPageCount = l_oPDF_Text.GetPageCount();
l_oPDF_Text.put_CurrentPage( l_lPageCount-1 );
l_lPageHeight = l_oPDF_Text.get_PageHeight();
l_lPageWidth = l_oPDF_Text.get_PageWidth();

l_oPDF_Text.DrawPageOnPage( 0, l_lPageCount-1, 0.0, 0.0, l_lPageWidth, l_lPageHeight );

l_oPDF_Text.DeletePage( 0 );
l_lPageCount = l_oPDF_Text.GetPageCount();
l_oPDF_Text.MovePage( l_lPageCount-1, 0 );

l_oPDF_Text.SaveToFile( l_csPDF_Text, TRUE );

l_oPDF_Text.ReleaseDispatch();
l_oPDF_Graphic.ReleaseDispatch();
}

 

 

Powered by miniBB 2.0 RC7 © 2001-2004 Page creation time (sec.): 0.013

 

Page top