The EndSaveEx method is used to end page by page saving of several documents at the same time. It works in coordination with the StartSaveEx method.
Public Function EndSaveEx(handle As Integer) As Boolean
public bool EndSaveEx(int handle)
handle
It is a handle to the newly created file.
See also the Open, OpenEx, Save, SavePage, SavePageEx, StartSave , StartSaveEx, EndSave sections.
Returns Value True if the call succeeded and False otherwise. This method launches an exception if an error occurs while saving the document.
Member of Amyuni.PDFCreator.IacDocument.
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 a new PDF document
Dim doc As New Amyuni.PDFCreator.IacDocument()
' Switch to design mode before adding objects to the document
doc.ReportState = Amyuni.PDFCreator.IacReportState.acReportStateDesign
' Create 4 additional pages
For pageNumber = 2 To 5
doc.AddPage(pageNumber)
Next
' Create page object
Dim page As Amyuni.PDFCreator.IacPage
' Create object in each Page
For pageNumber = 1 To 5
' Define first page of PDF document
page = doc.GetPage(pageNumber)
' Create a text
With page.CreateObject(Amyuni.PDFCreator.IacObjectType.acObjectTypeText, "acObjectTypeText")
.Attribute("Left").Value = 1000
.Attribute("Top").Value = 0
.Attribute("Right").Value = 3250
.Attribute("Bottom").Value = 500
.Attribute("BackColor").Value = 192
.Attribute("Hyperlink").Value = "http:// www.amyuni.com"
.Attribute("Text").Value = "Amyuni Technologies"
End With
Next
' Switch to run mode after objects to the document
doc.ReportState = Amyuni.PDFCreator.IacReportState.acReportStateRun
' Create new stream object
Dim fileWrite1 As System.IO.Stream = System.IO.File.OpenWrite("C:\temp\PDF1.pdf")
Dim fileWrite2 As System.IO.Stream = System.IO.File.OpenWrite("C:\temp\PDF1.pdf")
Dim fileWrite3 As System.IO.Stream = System.IO.File.OpenWrite("C:\temp\PDF1.pdf")
' Save PDF File
Dim handle1 As Integer = doc.StartSaveEx(fileWrite1, Amyuni.PDFCreator.IacFileSaveOption.acFileSaveView)
Dim handle2 As Integer = doc.StartSaveEx(fileWrite2, Amyuni.PDFCreator.IacFileSaveOption.acFileSaveView)
Dim handle3 As Integer = doc.StartSaveEx(fileWrite3, Amyuni.PDFCreator.IacFileSaveOption.acFileSaveView)
' Save the first 5 pages
For pageNumber = 1 To 5
doc.SavePageNumberEx(handle1, pageNumber)
doc.SavePageNumberEx(handle2, pageNumber)
doc.SavePageNumberEx(handle3, pageNumber)
Next
' End Save
doc.EndSaveEx(handle1)
doc.EndSaveEx(handle2)
doc.EndSaveEx(handle3)
' Close the stream
fileWrite1.Close()
fileWrite2.Close()
fileWrite3.Close()
' terminate library to free resources
acPDFCreatorLib.Terminate()
' destroy objects
doc.Dispose()
End Sub
static 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 a new PDF document
Amyuni.PDFCreator.IacDocument doc = new Amyuni.PDFCreator.IacDocument();
// Switch to design mode before adding objects to the document
doc.ReportState = Amyuni.PDFCreator.IacReportState.acReportStateDesign;
// Create 4 additional pages
for (int pageNumber = 2; pageNumber <= 5; pageNumber++)
{
doc.AddPage(pageNumber);
}
// Create page object
Amyuni.PDFCreator.IacPage page;
// Create object in each Page
for (int pageNumber = 2; pageNumber <= 5; pageNumber++)
{
// Define first page of PDF document
page = doc.GetPage(pageNumber);
// Create a text
using (Amyuni.PDFCreator.IacObject oText =
page.CreateObject(Amyuni.PDFCreator.IacObjectType.acObjectTypeText, "Text1"))
{
oText.Attribute("Left").Value = 1000;
oText.Attribute("Top").Value = 0;
oText.Attribute("Right").Value = 3250;
oText.Attribute("Bottom").Value = 500;
oText.Attribute("BackColor").Value = 192;
oText.Attribute("Hyperlink").Value = "http:// www.amyuni.com";
oText.Attribute("Text").Value = "Amyuni Technologies";
}
}
// Switch to run mode after objects to the document
doc.ReportState = Amyuni.PDFCreator.IacReportState.acReportStateRun;
// Create new stream object
System.IO.FileStream fileWrite1 = new System.IO.FileStream(@"C:\temp\PDF1.pdf",
System.IO.FileMode.Create,
System.IO.FileAccess.Write,
System.IO.FileShare.Read);
System.IO.FileStream fileWrite2 = new System.IO.FileStream(@"C:\temp\PDF2.pdf",
System.IO.FileMode.Create,
System.IO.FileAccess.Write,
System.IO.FileShare.Read);
System.IO.FileStream fileWrite3 = new System.IO.FileStream(@"C:\temp\PDF3.pdf",
System.IO.FileMode.Create,
System.IO.FileAccess.Write,
System.IO.FileShare.Read);
// Save PDF File
int handle1 = doc.StartSaveEx(fileWrite1, Amyuni.PDFCreator.IacFileSaveOption.acFileSaveView);
int handle2 = doc.StartSaveEx(fileWrite2, Amyuni.PDFCreator.IacFileSaveOption.acFileSaveView);
int handle3 = doc.StartSaveEx(fileWrite3, Amyuni.PDFCreator.IacFileSaveOption.acFileSaveView);
// Save the first 5 pages
for (int pageNumber = 1; pageNumber <= 5; pageNumber++)
{
doc.SavePageNumberEx(handle1, pageNumber);
doc.SavePageNumberEx(handle2, pageNumber);
doc.SavePageNumberEx(handle3, pageNumber);
}
// End Save
doc.EndSaveEx(handle1);
doc.EndSaveEx(handle2);
doc.EndSaveEx(handle3);
// Close the stream
fileWrite1.Close();
fileWrite2.Close();
fileWrite3.Close();
// terminate library to free resources
acPDFCreatorLib.Terminate();
// destroy objects
doc.Dispose();
}