Search code examples
c#abcpdf

WebSupergoo ABCPDF Automatic pdf generation - Adding pages on the fly?


I have a question regarding building dynamic PDF documents with ABCPDF.dll.

I understand the basics and have a solid solution working. I have a new requirement where I need to dynamically add pages to a PDF doc.

Specifically, my PDF doc is a two pager. The second page needs to be a separate PDF file where one or more pages will be added by the user.

I've looked at the docs and code samples and see a AddPage() method. It doesn't seem liek this would work per my need.

Here is a code sample:

         void Page_Load( object sender, System.EventArgs e )
    {
        int theID = 0;
        string theText = "This PDF file is generated by WebSupergoo ABCpdf.NET on the fly";
        Doc theDoc = new Doc();

        theDoc.Width = 4;
        theDoc.FontSize = 32;
        theDoc.Rect.Inset( 20, 20 );
        theDoc.FrameRect();
        theID = theDoc.AddHtml( theText );

        while ( theDoc.GetInfo( theID, "Truncated" ) == "1" )
        {
            theDoc.Page = theDoc.AddPage();
            theDoc.FrameRect();
            theID = theDoc.AddHtml( "", theID );
        }
        theDoc.Save( Server.MapPath( "textflow.pdf" ) );
        theDoc.Clear();

        Response.Write( "PDF file written<br>" );
        Response.Write( "<a href=\"textflow.pdf\">View PDF File</a>" );
    }

Can someone suggest a method for adding pages to a PDF document using ABC PDF? The above sample may be using AddPage, but I need to specify another PDF file to dynamical add on the fly. The PDF file name can change.

Thank you.

Thank you.


Solution

  • If I'm understanding your question, you want to add a PDF to the end of a different PDF. If that is what you need, it looks like the Append method is what you need.