CIB pdf toolbox technical guide (EN)

18. Quick start

18.2. Integration of the CIB pdf toolbox (PRINT) als VB code example

The following example demonstrates the control of the CIB pdf toolbox under Visual Basic.

The Test.pdf used in the code example can be replaced by any PDF.

Module Print
 
‚The following program code shows the printing via the CIB pdf toolbox as a VB code example. The starting point is a finished PDF document.
,Error messages and error developments are only partially taken into account here.
‚This example was created using Visual Studio 2008, Visual Basic .NET Framework 3.5.
 
‚Declaration of the methods that are opened via the "CibPdf32.dll" and output as Long
Private Declare Function CibPdfJoin Lib “CibPdf32.dll” () As Integer
Private Declare Function CibPdfSetProperty Lib “CibPdf32.dll” (ByVal a_PropName As String, ByVal a_pPropValue As String) As Integer
Private Declare Function CibPdfGetProperty Lib “CibPdf32.dll” (ByVal a_PropName As String, ByVal a_pProbValue As String) As Integer
Private Declare Function CibPdfShowPrintDialog Lib “CibPdf32.dll” (ByVal a_ButtonID As Integer) As Integer
Private Declare Function CibPdfGetLastError Lib “CibPdf32.dll” (ByRef a_iError As Integer) As Integer
 
 
 
Sub Main()
‚ The variable t_Return has the data type Long, the return values are stored here
Dim t_Return As Integer
‚1. Defining the necessary properties
‚The input document is specified. This file is printed
t_Return = CibPdfSetProperty(„InputFilename“, „C:\test.pdf“)
‚3. Optionally show a print dialog, which allows the user to make changes
CibPdfShowPrintDialog(0)
‚Set output format. The command "FormatPrinter" prints the document to the printer.
t_Return = CibPdfSetProperty(“OutputFormat”, “FormatPrinter”)
‚2. Optional possible functionalities (only exemplary in this example)
‚Duplex printing is performed with the printer's default settings.
t_Return = CibPdfSetProperty(“DuplexPrint2”, “DuplexPrintLong”)
‚The printer prints the pages 1,2,3,4,5.
t_Return = CibPdfSetProperty(„PageSelection“, „1-5“)
‚1 additional copy is output
t_Return = CibPdfSetProperty(“PrintCopies2”, “1”)
 
 
‘Initiate output
t_Return = CibPdfJoin()
 
If (t_Return = 0) Then
‚Retrieve error number
Dim t_Fehlernummer As Integer
CibPdfGetLastError(t_Errornumber)
End If
 
 
End Sub
 
 
End Module