StartSaveEx Method

The StartSaveEx method is used to start page by page saving of several documents at the same time. It returns a handle to the file.

 

Syntax

Visual Basic .NET:

Function StartSaveEx(FileName As String, SaveOption As ACPDFCREACTIVEX.FileSaveOptionConstants) As Integer

C#:

int SavePageEx(string FileName, ACPDFCREACTIVEX.FileSaveOptionConstants SaveOption)

C++:

long StartSaveEx(BSTR FileName, enum FileSaveOptionConstants SaveOption)

 

Parameters

FileName

Name of the file where to save the document.

SaveOption

Part of the document to save.

This method, only the acFileSaveView option of FileSaveOptionConstants is supported.

Option

Value

Description

acFileSaveView

1

Save only the document view.

The document can be viewed with any PDF viewer including Amyuni PDF Creator, but all design data such as database connection, OLE objects, is lost.

 

Return Value

A handle to the newly created file.

 

Remarks

See also the Open, OpenEx, Save, SavePage, SavePageEx, StartSave , EndSave, EndSaveEx sections.

 

Example

Sub Sample()

    ' Constants for Activation codes

    Const strLicenseTo As String = "Amyuni PDF Creator Evaluation"

    Const strActivationCode As String = "07EFCDAB010001004282943F2AF19A88F332D9E781E40460727DF8A42847A1BDE06DB61C71E94E2D90424BF8762385335F9D6884E9FC"

 

    ' Initializing PDFCreativeX Object

    Dim pdf As ACPDFCREACTIVEX.PDFCreactiveX = New ACPDFCREACTIVEX.PDFCreactiveX()

 

    ' Set license key

    pdf.SetLicenseKey(strLicenseTo, strActivationCode)

 

    ' Create 4 additional pages

    For page = 2 To 5

        pdf.AddPage(page)

    Next

 

    ' Create object in each Page

    For page = 1 To 5

        ' Set the current page

        pdf.CurrentPage = page

 

        ' Create a Text in the current Page

        pdf.CreateObject(ACPDFCREACTIVEX.ObjectTypeConstants.acObjectTypeText, "Text" + page.ToString)

 

        ' Define obj as Text1

        Dim oText As ACPDFCREACTIVEX.IacObject = pdf.GetObjectByName("Text" + page.ToString)

 

        ' Set-up the Text

        oText("Left") = 1000

        oText("Right") = 5000

        oText("Top") = 0

        oText("Bottom") = 4000

        oText("BorderColor") = &HFF00FF

        oText("BorderWidth") = ACPDFCREACTIVEX.acBorderWidth.acBorderWidthDouble

 

        ' Text Attributes

        oText("Text") = "Amyuni Technologies " + page.ToString

 

    Next

    ' Save PDF with different name simultaneously using StartSaveEx, SavePageEx and EndSaveEx

    Dim handle1 As Integer = pdf.StartSaveEx("c:\temp\PDF1.pdf", ACPDFCREACTIVEX.FileSaveOptionConstants.acFileSaveView)

    Dim handle2 As Integer = pdf.StartSaveEx("c:\temp\pdf2.pdf", ACPDFCREACTIVEX.FileSaveOptionConstants.acFileSaveView)

    Dim handle3 As Integer = pdf.StartSaveEx("c:\temp\PDF3.pdf", ACPDFCREACTIVEX.FileSaveOptionConstants.acFileSaveView)

 

    For page = 1 To 5

        pdf.SavePageEx(handle1, page)

        pdf.SavePageEx(handle2, page)

        pdf.SavePageEx(handle2, page)

    Next

    pdf.EndSaveEx(handle1)

    pdf.EndSaveEx(handle2)

    pdf.EndSaveEx(handle3)

 

    ' destroy objects

    pdf = Nothing

End Sub

static void Sample()

{

    // Constants for Activation codes

    const string strLicenseTo = "Amyuni PDF Creator Evaluation";

    const string strActivationCode = "07EFCDAB010001004282943F2AF19A88F332D9E781E40460727DF8A42847A1BDE06DB61C71E94E2D90424BF8762385335F9D6884E9FC";

 

    // Initializing PDFCreativeX Object

    ACPDFCREACTIVEX.PDFCreactiveX pdf = new ACPDFCREACTIVEX.PDFCreactiveX();

 

    // Set license key

    pdf.SetLicenseKey(strLicenseTo, strActivationCode);

 

    // Create 4 additional pages

    for (int page = 2; page < 6; page++)

    {

        pdf.AddPage(page);

    }

 

    // Create object in each Page

    for (int page = 1; page < 6; page++)

    {

        // Set the current page

        pdf.CurrentPage = page;

 

        // Create a Text in the current Page

        pdf.CreateObject(ACPDFCREACTIVEX.ObjectTypeConstants.acObjectTypeText, "Text" + page.ToString());

 

        // Define obj as Text1

        ACPDFCREACTIVEX.IacObject oText = pdf.GetObjectByName("Text" + page.ToString());

 

        // Set-up the Text

        oText["Left"] = 1000;

        oText["Right"] = 5000;

 

        oText["Top"] = 0;

        oText["Bottom"] = 4000;

        oText["BorderColor"] = 0xFF00FF;

        oText["BorderWidth"] = ACPDFCREACTIVEX.acBorderWidth.acBorderWidthDouble;

 

        // Text Attributes

        oText["Text"] = "Amyuni Technologies " + page.ToString();

    }

 

    // Save PDF with different name simultaneously using StartSaveEx, SavePageEx and EndSaveEx

    int handle1 = pdf.StartSaveEx(@"c:\temp\PDF1.pdf", ACPDFCREACTIVEX.FileSaveOptionConstants.acFileSaveView);

    int handle2 = pdf.StartSaveEx(@"c:\temp\pdf2.pdf", ACPDFCREACTIVEX.FileSaveOptionConstants.acFileSaveView);

    int handle3 = pdf.StartSaveEx(@"c:\temp\PDF3.pdf", ACPDFCREACTIVEX.FileSaveOptionConstants.acFileSaveView);

 

    for (int page = 1; page < 6; page++)

    {

        pdf.SavePageEx(handle1, page);

        pdf.SavePageEx(handle2, page);

        pdf.SavePageEx(handle3, page);

    }

    pdf.EndSaveEx(handle1);

    pdf.EndSaveEx(handle2);

    pdf.EndSaveEx(handle3);

}

 

    // destroy objects

    pdf = null;

}

#import "c:\users\amyuni\pdfcreactivex.dll" no_namespace

 

using namespace std;

 

int main()

{

    // Constants for Activation codes

    bstr_t strLicenseTo = "Amyuni PDF Creator Evaluation";

    bstr_t strActivationCode = "07EFCDAB010001004282943F2AF19A88F332D9E781E40460727DF8A42847A1BDE06DB61C71E94E2D90424BF8762385335F9D6884E9FC";

 

    // Initialize the COM subsystem

    CoInitialize(0);

 

    // IPDFCreactiveXPtr is a smart pointer type defined in pdfcreactivex.tlh,

    // the type library header file generated by the #import instruction above

    IPDFCreactiveXPtr pdf;

 

    // Create the PDFCreactiveX instance

    pdf.CreateInstance(__uuidof(PDFCreactiveX));

 

    // set license key

    pdf->SetLicenseKey(_bstr_t(strLicenseTo), _bstr_t(strActivationCode));

 

    // Create 4 additional pages

    for (int page = 2; page < 6; page++)

    {

        pdf->AddPage(page);

    }

 

    // Create object in each Page

    for (int page = 1; page < 6; page++)

    {

        // Set the current page

        pdf->CurrentPage = page;

 

        // Variable for Attributes

        _variant_t varAttribute;

        varAttribute.vt = VT_I4;  // integers

 

        // Create a Text in the current Page

        pdf->CreateObject(acObjectTypeText, "Text" + _bstr_t(page));

        IacObjectPtr oText = pdf->GetObjectByName("Text" + _bstr_t(page));

        oText->Attribute["Left"] = 1000;

        oText->Attribute["Right"] = 5000;

        oText->Attribute["Top"] = 0;

        oText->Attribute["Bottom"] = 4000;

        varAttribute.lVal = 0xFF00FF;

        oText->Attribute["BorderColor"] = varAttribute;

        varAttribute.lVal = acBorderWidthDouble;

        oText->Attribute["BorderColor"] = varAttribute;

        oText->Attribute["Text"] = "Amyuni Technologies" + _bstr_t(page);

    }

 

    // ' Save PDF using StartSave, SavePage and EndSave

    long handle1 = pdf->StartSaveEx("c:\\temp\\PDF1.pdf", acFileSaveView);

    long handle2 = pdf->StartSaveEx("c:\\temp\\PDF2.pdf", acFileSaveView);

    long handle3 = pdf->StartSaveEx("c:\\temp\\PDF3.pdf", acFileSaveView);

 

    for (int page = 1; page < 6; page++)

    {

        pdf->SavePageEx(handle1, page);

        pdf->SavePageEx(handle2, page);

        pdf->SavePageEx(handle3, page);

    }

    pdf->EndSaveEx(handle1);

    pdf->EndSaveEx(handle2);

    pdf->EndSaveEx(handle3);

 

    // destroy objects

    pdf = NULL;

 

    return 0;

}