BIAPStartPrintingEx

#include "BiAutoPrint.h"

 

BOOL BIAPStartPrintingEx(LPCSTR pPrinter, LPCSTR pInputFileName, DWORD dwOutputMode, LPCSTR pOutputPath);

 

Description

This function starts printing a document. This function can handle Microsoft Word (docx, doc, dot, docm, dotx, rft), Microsoft Excel (xlsx, xls, xlsm, xlsb, csv), Microsoft Power Point (ppsx, pptx, pps, ppt, ppsm, pptm), Microsoft Visio (vs*, v*x), AutoCAD (dwg) documents, Adobe and Foxit PDF (pdf), HTML (html, htm), Text (txt) and several image formats (tif, tiff, jpg, jpeg, bmp, gif, png). The function prints through the proper application (for example Word in case of doc file). The printing application will not appear on screen.

 

This function is the extended version of the BIAPStartPrinting function.

Note: The BIAPEndPrinting must be called after every document is printed.

 

Parameters

Input value: pPrinter  

- Name of the Black Ice printer to print (string).

Input value: pFileName

- Path and name of the file to print (string).

Input value: dwOutputMode

- Output file name generation mode.

Possible values:

0: Use printer settings (Use the printer settings for the output directory and output filename generation).

Note: This value (0) does not support the email print settings in the AutoPrint.ini. The following settings in the AutoPrint.ini will be ignored:

 

[Email Settings]

Print Mode=0

Merge=1

Create Directory=0

 

1: Set output folder (Use the pOutputPath as the output directory and use the printer settings for the output filename generation).

2: Set output filename (Use the pOutputPath as the output filename with path and file extension). If the file exists, overwrite the file.

6: Set output filename without extension (Use the pOutputPath as the output filename with path and without extension. In this case the BIAPStartPrintingEx will add the file extension what belongs to the printer output file format setting). If the file exists, overwrite the file.

10: Set output filename (Use the pOutputPath as the output filename with path and file extension). If the file already exists and the output file format supports it, append the pages to the existing file.

14: Set output filename without extension (Use the pOutputPath as the output filename with path and without extension. In this case the BIAPStartPrintingEx will add the file extension what belongs to the printer output file format setting). If the file already exists and the output file format supports it, append the pages to the existing file.

 

Note: The dwOutputMode values 3-5, 7-9 and 11-13 are reserved for future use.

 

Input value: pOutputPath

- Output directory or file path depends on the dwMode parameter.

If dwOutputMode is 0 pOutputPath is always NULL

If dwOutputMode is 1 pOutputPath contains the path of the output directory

If dwOutputMode is 2 or 10, pOutputPath contains the path and name of the output file with file extension

If dwOutputMode is 6 or 14, pOutputPath contains the path and name of the output file without file extension.

 

Example:

Convert a file and specify output filename without file extension:

 

BIAPStartPrintingEx(_T("Black Ice ColorPlus X1"),  _T("c:\test\abc.doc"), 6,  _T("c:\test\converted"));

 

In this case if the "Black Ice ColorPlus X1" printer output file format is PDF the function converts the "c:\test\abc.doc" to PDF and the output filename will be "c:\test\converted.PDF"

 

Return values

TRUE on success, otherwise FALSE.

 

Programming notes

You can print only to a Black Ice printer using this function.

 

Requirements

You have to initialize the BiAutoPrint.dll with BIAPInitialize function before using this function.

 

Header:

BiAutoPrint.h

Library:

BiAutoPrint32.lib (for 32 bit)

BiAutoPrint64.lib (for 64 bit)

DLL:

BiAutoPrint32.dll (for 32 bit)

BiAutoPrint64.dll (for 64 bit)

 

Code Example

 

VB.NET Example

The following example demonstrates how to print a document, using the Auto-print SDK components in VB.NET:

 

   

    Public BiAutoPrintPrint As BIAUTOPRINTLib.BiAutoPrint

    Private Sub Printing()

 

        'Loading the BiAutoPrint component

        BiAutoPrintPrint = New BIAUTOPRINTLib.BiAutoPrint()

 

        'Configuring the Printer Driver name

        Dim sPrinter As String = "Black Ice ColorPlus"

 

        'Setting up the input file which has to be printed

        Dim sFileName As String = "c:\Test\test.jpg"

 

        'OutputMode - Use Printer Settings - For more information please refer

        'to the BIAPStartPrintingEx() function specification in the documentation.

        Dim OutputMode As Short = 0

        Dim OutPutName As String = Nothing

 

        'Initializing the BiAutoPrint component

        BiAutoPrintPrint.BIAPInitialize()

 

        'Calling the BIAPStartPrintingEx() function, which prints the input document.

        If Not BiAutoPrintPrint.BIAPStartPrintingEx(sPrinter, sFileName, OutputMode, OutPutName) Then

            MessageBox.Show(BiAutoPrintPrint.BIAPLastError & ": " & BiAutoPrintPrint.BIAPGetErrorString(BiAutoPrintPrint.BIAPLastError))

 

        End If

        'Calling the BIAPEndPrinting() function.

        'Returns with TRUE on success, otherwise FALSE

        BiAutoPrintPrint.BIAPEndPrinting()

        'Uninitializing the BiAutoPrint component

        BiAutoPrintPrint.BIAPUnInitialize()

 

    End Sub

 

 

C# Example

 

The following example demonstrates how to print a document, using the Auto-print SDK components in C#:

 

        public BIAUTOPRINTLib.BiAutoPrint BiAutoPrintPrint;

 

        private void Printing()

        {

            //Loading the BiAutoPrint component

            BiAutoPrintPrint = new BIAUTOPRINTLib.BiAutoPrint();

 

            //Configuring the Printer Driver name

            string sPrinter = "Black Ice ColorPlus";

 

            //Setting up the input file which has to be printed

            string sFileName = "c:\\Test\\test.jpg";

 

            //OutputMode - Use Printer Settings - For more information please refer

            //to the BIAPStartPrintingEx() function specification in the documentation.

            short OutputMode = 0;

            string OutPutName = null;

 

            //Initializing the BiAutoPrint component

            BiAutoPrintPrint.BIAPInitialize();

 

            //Calling the BIAPStartPrintingEx() function, which prints the input document.

            if (!BiAutoPrintPrint.BIAPStartPrintingEx(sPrinter, sFileName, OutputMode, OutPutName))

            {

                MessageBox.Show(BiAutoPrintPrint.BIAPLastError + ": " + BiAutoPrintPrint.BIAPGetErrorString(BiAutoPrintPrint.BIAPLastError));

 

            }

            //Calling the BIAPEndPrinting() function.

            //Returns with TRUE on success, otherwise FALSE

            BiAutoPrintPrint.BIAPEndPrinting();

            //Uninitializing the BiAutoPrint component

            BiAutoPrintPrint.BIAPUnInitialize();

 

        }