Posted by a ceTe Software moderator
Hello Brian,
This can be done using our DynamicPDF Merger for .NET product.
Following is the code snippet that will merge the PDF document coming as a stream to the page of an existing the PDF document:
// URL to retrieve PDF
string url = "http://www.adobe.com/products/acrobat/pdfs/docsforms.pdf";
// Create a MemoryStream from the URL
WebClient wc = new WebClient();
byte[] webPdfBytes = wc.DownloadData( url ) ;
System.IO.MemoryStream webPdf = new MemoryStream( webPdfBytes );
// Create PdfDocument object out of stream from URL
PdfDocument pdfDocument = new PdfDocument( webPdf );
MergeDocument document = new MergeDocument();
// Create first page
Page page = new Page( PageSize.Letter, PageOrientation.Portrait, 54.0f );
TextArea area = new TextArea( "Hello World", 0, 0, 504, 100, Font.Helvetica, 18, TextAlign.Center );
page.Elements.Add( area );
// Add first page to the document
document.Pages.Add( page );
// Append PDF document from URL
document.Append( pdfDocument );
// Output PDF to the browser
document.DrawToWeb( this, "HelloWorld.pdf" );
Thanks,
ceTe Software Support Team