Merging PDFs with Acro Fields

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF CoreSuite for .NET (v8)  /  Merging PDFs with Acro Fields

DynamicPDF CoreSuite for .NET (v8) Forum

 Mar 12 2015 10:14 AM
I need to merge two PDFs together. One will be an overlay file containing artwork and some Acro fields, and the other will contain invoice data.

I am using the following code for testing:

        private void MergePDF()
        {
            string dataPDF = @"C:\Data.Pdf";
            string overlayPDF = @"C:\Overlay.Pdf";
           
            var overlayPage = new ImportedPageArea(overlayPDF, 1, 0, 0) { Contents = { ClipLeft = 0, ClipTop = 0, ClipRight = 0, ClipBottom = 0 }};            
            var dataPage = new ImportedPageArea(dataPDF, 1, 0, 0) { Contents = { ClipLeft = 0, ClipTop = 0, ClipRight = 0, ClipBottom = 0 }};

            var page = new ceTe.DynamicPDF.Page(PageSize.A4, PageOrientation.Portrait) { Dimensions = { LeftMargin = 0, TopMargin = 0 }};
            page.Elements.Add(overlayPage);
            page.Elements.Add(dataPage);

            var document = new ceTe.DynamicPDF.Document();
            document.Pages.Add(page);
            document.Draw(@"C:\Result.pdf");
        }

The Acro fields not appearing on the merged Pdf.

Can anyone help me with this please?
 Mar 12 2015 12:20 PM
Posted by a ceTe Software moderator
Hello,

You are seeing this behavior because of using ImportedPageArea to import the data from a PDF that contains acro fields. The ImportePageArea is not capable of importing acro fields. You have to use ImportePage object and below is the code sample for it. 

            string dataPDF = @"C:\Data.Pdf";
            string overlayPDF = @"C:\Overlay.Pdf";
            ImportedPage page = new ImportedPage(overlayPDF, 1);
           var dataPage = new ImportedPageArea(dataPDF, 1, 0, 0) { Contents = { ClipLeft = 0, ClipTop = 0, ClipRight = 0, ClipBottom = 0 } };
            page.Elements.Add(dataPage);
            var document = new ceTe.DynamicPDF.Document();
            document.Pages.Add(page);
            document.Draw(@"C:\Result.pdf");

Thanks,
ceTe Software support Team.
 Mar 12 2015 12:35 PM
Thank you.  That is working now.

All times are US Eastern Standard time. The time now is 12:43 AM.