Doc Append Function. Appends a PDF to the end of the document. ABCpdf .NET PDF Library.

ABCpdf .net

 
   

Appends a PDF to the end of the document.

 

   
Syntax  

[C#]
void Append(Doc doc)

[Visual Basic]
Sub Append(doc As Doc)

 

   

Params
 
Name Description
doc

The document to add to the end of this one.

 

   

Notes
 

Use this method to append one PDF to the end of another one.

Individual pages from one PDF can be drawn into another using the AddImageDoc method.

If you are inserting a number of pages it is much faster to use the Append method than to draw pages individually. It also has the advantage of maintaining other information such as bookmarks.

If you are inserting pages that contain form fields, you may want to call MakeFieldsUnique to avoid sharing fields across pages.

The Refactor setting determines whether new/modified redundant objects are eliminated. The Preflight setting determines whether objects in the destination document are validated before this operation is performed. Unless the document and the pages are big in terms of memory use and have many common objects, it is faster to disable refactor and preflight for adding the pages and enable them for saving the document. You can use SetInfo to change these settings.

 

   

Example
 

The following code snippet illustrates how one might join two PDF documents together.

[C#]
Doc theDoc1 = new Doc();
theDoc1.FontSize = 192;
theDoc1.TextStyle.HPos = 0.5;
theDoc1.TextStyle.VPos = 0.5;
theDoc1.AddText("Hello");
Doc theDoc2 = new Doc();
theDoc2.FontSize = 192;
theDoc2.TextStyle.HPos = 0.5;
theDoc2.TextStyle.VPos = 0.5;
theDoc2.AddText("World");
theDoc1.Append(theDoc2);
theDoc1.Save(Server.MapPath("docjoin.pdf"));
theDoc1.Clear();
theDoc2.Clear();

[Visual Basic]
Dim theDoc1 As Doc = New Doc()
theDoc1.FontSize = 192
theDoc1.TextStyle.HPos = 0.5
theDoc1.TextStyle.VPos = 0.5
theDoc1.AddText("Hello")
Dim theDoc2 As Doc = New Doc()
theDoc2.FontSize = 192
theDoc2.TextStyle.HPos = 0.5
theDoc2.TextStyle.VPos = 0.5
theDoc2.AddText("World")
theDoc1.Append(theDoc2)
theDoc1.Save(Server.MapPath("docjoin.pdf"))
theDoc1.Clear()
theDoc2.Clear()


docjoin.pdf [Page 1]


docjoin.pdf [Page 2]