Dev Direct Solution Center

For more information and to buy this product...

Printing existing PDF documents

  For a copy of the sample project please click here to download and install the product evaluation.

Introduction

Our Amyuni PDF Creator products (available as an ActiveX control, a .NET component or a .NET library) will allow a developer to print existing PDF documents to hardware printers.

Detail

The developer simply needs pragmatically open a PDF document, selects a printer and issues a Print() command. This is done in the background with no user intervention and without any visible activity on the screen.

Below is C# code snippet using our .NET library
private void cmdPrintDoc_Click(object sender, EventArgs e)
{
    //initailize library
    //This should be done once
    acPDFCreatorLib.Initialize();

    //set license key 
    acPDFCreatorLib.SetLicenseKey("...", "...");

    // Open the PDF document file.
    string strFilePathAndName = @"c:\temp\pdf1.pdf";

    //need to open a file stream 
    System.IO.FileStream fs = new System.IO.FileStream(strFilePathAndName, 
                                                       FileMode.Open, 
                                                       FileAccess.Read, 
                                                       FileShare.Read);

    //need to create a document object
    using (Amyuni.PDFCreator.IacDocument doc = new Amyuni.PDFCreator.IacDocument(null))
    {
    try
    {
        doc.Open(fs, "");

        //Parameters
        //      PrinterName
        //If no printer name is specified, the document is printed to the default printer.
        //      Prompt
        //If this parameter is set to True, the user is prompted with the printer selection dialog box.
        doc.Print ( "", false);
    }
    catch (Exception ev)
    {
        MessageBox.Show(ev.Message);
    }

}
Visit Amyuni Technologies Inc for more information and more samples.