IacDocument.StartPrint Method

 

This method can also be accessed by querying the document object for an IacPrint interface and calling the IacPrint.StartPrint method.

 

The StartPrint method starts printing the document to a specified printer. This method is used to start the printing process and takes the same parameters as the Print method.

 

Syntax

Visual Basic .NET:

Public Overrides Function StartPrint(printerName As String, prompt As Boolean) As Boolean

C#:

public override bool StartPrint(string printerName , bool prompt)

 

Parameters

printerName

If no printer name is specified, the document is printed to the default printer.

prompt

If Prompt is set to True, the user is prompted with the printer selection dialog box.

 

Remarks

Multiple documents can be printed as one print job by using the StartPrint, PrintPage, PrintPageIndex and EndPrint methods.

 

Member of Amyuni.PDFCreator.IacDocument.

Example

Public 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)

 

    ' Start printing to the default printer the document

    doc.StartPrint("", False)

 

    ' Printing each page

    For i = 1 To doc.PageCount

        doc.PrintPage(doc.GetPage(i))

    Next

 

    ' End printing

    doc.EndPrint()

 

    ' Close the stream

    fileRead.Close()

 

    ' terminate library to free resources

    acPDFCreatorLib.Terminate()

 

    ' destroy objects

    doc.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);

 

    // Start printing to the default printer the document

    doc.StartPrint("", false);

 

    // Printing each page

    for(int i=1; i<=doc.PageCount; i++){

        doc.PrintPage(doc.GetPage(i));

    }

 

    // End printing

    doc.EndPrint();

 

    // Close the stream

    fileRead.Close();

 

    // terminate library to free resources

    acPDFCreatorLib.Terminate();

 

    // destroy objects

    doc.Dispose();

}