The Append method can be used to append or concatenate a PDF file to the current document.
Public Function Append(document As Amyuni.PDFCreator.IacDocument) As Boolean
Public Function Append(stream As Stream) As Boolean
public bool Append(Amyuni.PDFCreator.IacDocument document)
public bool Append(System.IO.Stream stream)
document
Reference to the second document that should be appended to the current one.
stream
.NET stream object containing the PDF or XPS document.
Returns Value True if the Append succeeds, False otherwise.
Member of Amyuni.PDFCreator.IacDocument.
The document to be appended has to be opened by the caller before it can be appended. If the document is password protected, the owner’s password will be needed to append.
Private Sub Sample()
' Constants for Activation codes
Const strLicenseTo As String = "Amyuni PDF Creator .NET Evaluation"
Const strActivationCode As String = "07EFCDAB0100010025C3B7B351579FF94C49112EAF7368612744C7237C2F6A215A53E83A9ECCFFE54C52063CB05338BDE555773D7B1B"
' Initialize library
' This should be done once
acPDFCreatorLib.Initialize()
' set license key This is needed only with licensed version
acPDFCreatorLib.SetLicenseKey(strLicenseTo, strActivationCode)
' Create new stream object
Dim fileRead As System.IO.Stream = System.IO.File.OpenRead("C:\temp\PDFDocument.pdf")
' Create a new PDF document
Dim doc As New Amyuni.PDFCreator.IacDocument()
' Open stream
Dim Password As String = ""
doc.Open(fileRead, Password)
' Create new stream object
Dim fileRead2 As System.IO.Stream = System.IO.File.OpenRead("C:\temp\PDFDocument.pdf")
' Create a new PDF document
Dim doc2 As New Amyuni.PDFCreator.IacDocument()
' Open stream
Password = ""
doc2.Open(fileRead2, Password)
' Append
doc.Append(doc2)
' Create new stream object
Dim fileWrite As System.IO.Stream = System.IO.File.OpenWrite("C:\temp\CreatePDFDocument_resulting.pdf")
' Save stream
doc.Save(fileWrite, Amyuni.PDFCreator.IacFileSaveOption.acFileSaveView)
' Close the stream
fileRead.Close()
fileRead2.Close()
fileWrite.Close()
' terminate library to free resources
acPDFCreatorLib.Terminate()
' destroy objects
doc.Dispose()
doc2.Dispose()
End Sub
public void Sample()
{
// Constants for Activation codes
const string strLicenseTo = "Amyuni PDF Creator .NET Evaluation";
const string strActivationCode = "07EFCDAB0100010025C3B7B351579FF94C49112EAF7368612744C7237C2F6A215A53E83A9ECCFFE54C52063CB05338BDE555773D7B1B";
// Initialize library
// This should be done once
acPDFCreatorLib.Initialize();
// set license key This is needed only with licensed version
acPDFCreatorLib.SetLicenseKey(strLicenseTo, strActivationCode);
// Create new stream object
System.IO.FileStream fileRead = new System.IO.FileStream("C:\\temp\\PDFDocument.pdf",
System.IO.FileMode.Open,
System.IO.FileAccess.Read,
System.IO.FileShare.Read);
// Create a new PDF document
Amyuni.PDFCreator.IacDocument doc = new Amyuni.PDFCreator.IacDocument();
// Open stream
String password = "";
doc.Open(fileRead, password);
// Create new stream object
System.IO.FileStream fileRead2 = new System.IO.FileStream("C:\\temp\\PDFDocument2.pdf",
System.IO.FileMode.Open,
System.IO.FileAccess.Read,
System.IO.FileShare.Read);
// Create a new PDF document
Amyuni.PDFCreator.IacDocument doc2 = pdfCreator1.Document;
// Open stream
String password2 = "";
doc2.Open(fileRead2, password);
// Append
doc.Append(doc2);
// Create new stream object
System.IO.FileStream fileWrite = new System.IO.FileStream("C:\\temp\\CreatePDFDocument_resulting.pdf",
System.IO.FileMode.Create,
System.IO.FileAccess.Write,
System.IO.FileShare.Read);
// Save stream
doc.Save(fileWrite, Amyuni.PDFCreator.IacFileSaveOption.acFileSaveView);
// Close the stream
fileRead.Close();
fileRead2.Close();
fileWrite.Close();
// terminate library to free resources
acPDFCreatorLib.Terminate();
// destroy objects
doc.Dispose();
doc2.Dispose();
}