SetPrintOptions method
This method can be used to customize the print options.
The set parameters are only taken into account when a PDF is printed.
int SetPrintOptions(int nPageScaling, int nAutoRotateCenter);
long SetPrintOptions(long nPageScaling, long nAutoRotateCenter);
|
Parameter
|
In |
Out |
Possible Values |
Description |
|---|---|---|---|---|
|
nPageScaling |
✔️ |
|
0 |
No scaling |
|
1 |
Page is scaled to paper size (default) |
|||
|
2 |
Trim the larger document pages |
|||
|
nAutoRotateCenter |
✔️ |
|
0 |
No automatic turning and centering |
|
1 |
The document page is automatically rotated and centred to best fit the output medium (default) |
|
Return value |
Description |
|
|---|---|---|
|
0 |
Method was executed successfully |
|
|
< 0 |
An error has occurred |
|
|
|
-1 |
The loaded document is not a PDF |
|
|
-2 |
One of the parameters contains an invalid value |
SetPrinterCopyCount method
This method can be used to set the number of copies for printing a PDF document.
The parameter that is set is only used for dialog-free printing using the PrintDirect method.
int SetPrinterCopyCount(short nCopyCount);
long SetPrinterCopyCount(short nCopyCount);
|
Parameter
|
In |
Out |
Possible Values |
Description |
|---|---|---|---|---|
|
nCopyCount |
✔️ |
|
1 - 1000 |
Number of copies to be made |
|
Return value |
Description |
|
|---|---|---|
|
1 |
Method was executed successfully |
|
|
<= 0 |
An error has occurred |
|
|
|
-2 |
Incorrect or invalid parameter |
SetPrinterPaperBin method
This method sets the ID of the printer paper bin to be used.
The value for the paper bin ID must be retrieved from the installed printer driver, e.g., using the WinAPI “DeviceCapabilities” function. See also the MSDN link on the topic of DEVMODEA structure / wingdi.h.
int SetPrinterPaperBin(int nPaperBinID);
long SetPrinterPaperBin(long nPaperBinID);
|
Parameter
|
In |
Out |
Possible Values |
Description |
|---|---|---|---|---|
|
nPaperBinID |
✔️ |
|
1 - 70000 |
Printer output tray ID |
|
Return value |
Description |
|
|---|---|---|
|
1 |
Method was executed successfully |
|
|
<= 0 |
An error has occurred |
|
|
|
-2 |
Incorrect or invalid parameter |
PrintWithDialog method
This method deletes the currently stored printer name and all set print parameters. The next time a document is printed, PrintPDFWithAcrobat causes the Windows printer selection to be displayed.
void PrintWithDialog();
void PrintWithDialog();
SetPrinterName method
This method can be used to set the name of the printer to be used so that displaying the Windows printer selection can be bypassed when an Adobe application is used for printing (see PrintPDFWithAcrobat).
int SetPrinterName(string bstrPrinterName);
long SetPrinterName(BSTR bstrPrinterName);
|
Parameter
|
In |
Out |
Possible Values |
Description |
|---|---|---|---|---|
|
bstrPrinterName |
✔️ |
|
!= NULL |
Printer name |
|
Return value |
Description |
|---|---|
|
0 |
Method was executed successfully |
|
< 0 |
An error has occurred |
PrintPDFWithAcrobat method
Activates or deactivates printing via Adobe Acrobat Reader or Adobe Acrobat. To do this, Adobe Acrobat Reader or Adobe Acrobat must be installed on the system. This method is only available for documents that have been loaded directly from a file on the hard disk using LoadDocument.
The printer is selected only once via the Windows printer selection. The selected printer is then used for all following calls as long as the application is open. Optionally, the name can also be set using the SetPrinterName method. To display the printer selection again after printing, please use the PrintWithDialog method. The printing process itself can be started by clicking the printer icon in the toolbar of the control (see also ShowToolbar).
int PrintPDFWithAcrobat(int nOptions);
long PrintPDFWithAcrobat(long nOptions);
|
Parameter
|
In |
Out |
Possible Values |
Description |
|---|---|---|---|---|
|
nOptions |
✔️ |
|
1 |
Print via Acrobat |
|
0 |
Print with STImgCtl |
|
Return value |
Description |
|
|---|---|---|
|
1 |
Method was executed successfully |
|
|
<= 0 |
An error has occurred |
|
|
|
0 |
No compatible Adobe application could be found |
PrintDirect method
This method starts a printing procedure that does not require any further user input.
int PrintDirect(short nStartPage, short nEndPage, string bstrPrintername);
long PrintDirect(short nStartPage, short nEndPage, BSTR bstrPrintername);
|
Parameter
|
In |
Out |
Possible Values |
Description |
|---|---|---|---|---|
|
nStartPage |
✔️ |
|
>= 1 |
First page |
|
-1 |
Select all pages |
|||
|
nEndPage |
✔️ |
|
>= 1 |
Last page |
|
-1 |
Select all pages |
|||
|
bstrPrintername |
✔️ |
|
!= NULL |
Printer name |
|
Return value |
Description |
|
|---|---|---|
|
0 |
Method was executed successfully |
|
|
< 0 |
An error has occurred |
|
|
|
-2 |
Empty printer name |
|
|
-3 |
The printer is not present or is not available |