Switch to: V9V8V7V6V5

VReport Class: Printing Methods

VReport.PrintToDisk()

Declaration:

PrintToDisk( 
    inLocation       as FolderItem, 
    inPrintType      as EVReportPrintType,
    inStartPageIndex as UINT = 0,
    inEndPageIndex   as UINT = 0  )

Parameters:

  • inLocation - The location for the generated file.
  • inPrintType - Specifies the format of the generated report.
  • inStartPageIndex - The index of the first page to be printed (1..N). Zero to print all records of the report.
  • inEndPageIndex - The index of the last page to be printed (1..N).

Description:

Prints all pages or the specified range of pages of the report to the disk file at the given location.

You can specify the format of the produced file with the help of the inPrintType parameter. Valid values for this parameter are enumerated in the EVReportPrintType enum type. Usually you will use these values as kToPDF, kToHTML, kToPicture_JPG.

Example:

theReport.PrintToDisk( "report_1.html", EVReportPrintType.kToHTML )

VReport.PrintToBuffer()

Declaration:

PrintToBuffer( 
    inPrintType      as EVReportPrintType,
    inStartPageIndex as UINT = 0, 
    inEndPageIndex   as UINT = 0 ) as BinaryData

Parameters:

  • inPrintType - Specifies the format of generated report.
  • inStartPageIndex - the index of the first page to be printed (1..N). Zero to print all records of the report.
  • inEndPageIndex - the index of the last page to be printed (1..N).

Description:

Prints all pages or the specified range of pages of the report to the disk file at the given location. You can specify the format of the produced file through the inPrintType parameter. Valid values for this parameter are enumerated in the EVReportPrintType enum type. Usually you will use these values as kToPDF, kToHTML, kToPicture_JPG.

NOTE: There are different types of BinaryData for different programming languages. For example for REALbasic or PHP this is String because it can keep binary data, for Obj-C this is NSData, and so on. See the example(s) of work with Report class in your Valentina ADK for details.

Example:

dim report as BinaryData
 
report = theReport.PrintToBuffer( EVReportPrintType.kToPDF, 1, 10 )

VReport.PrintToLocalPrinter()

Declaration:

PrintToLocalPrinter( 
    inPrinter        as String = "",
    inOptions        as String = "",
    inStartPageIndex as UINT   = 0, 
    inEndPageIndex   as UINT   = 0 )

Parameters:

  • inPrinter - Specifies the target local printer. Empty to print to a default printer.
  • inOptions - Specifies the printing options. Empty to use defaults.
  • inStartPageIndex - the index of the first page to be printed (1..N). Zero to print all records of the report.
  • inEndPageIndex - the index of the last page to be printed (1..N).

Description:

Prints all pages or the specified range of pages of the report to the given printer.

You can specify the printing options to tune the printer output in format:

option1=value1,option2=value2,...

Common printing options

  • collate - Specifies whether collation should be used when printing multiple copies. Possible values: yes, no.
  • copies - Selects the number of copies printed if the device supports multiple-page copies.
  • duplex - Selects duplex or double-sided printing for printers capable of duplex printing. Possible values: yes, no.
  • landscape - Selects the landscape orientation of the paper. Possible values: yes, no.
  • paper - Selects the name of the paper format to print on. For example, 'paper=A4'.
  • reverse - This option will print the pages in reverse order. Possible values: yes, no.
  • scaling - Specifies the factor by which the printed output is to be scaled. The apparent page size is scaled from the physical page size by a factor of scaling / 100. For example, 'scaling=50'.

Examples:

theReport.PrintToLocalPrinter( "LBP3000", "paper=A4" );
theReport.PrintToLocalPrinter( "LBP3000", "paper=A2", 1, 5 );
theReport.PrintToLocalPrinter( "LBP3000", "paper=A4,landscape=yes,copies=2" );

Additional printing options for OS X and Linux

On OS X and Linux systems CUPS library is used for printing therefore it is possible to specify any of it's options.

  • fit-to-page - Specifies that the document should be scaled to fit on the page. Possible values: yes, no.
  • number-up-default - Specifies the number of pages to print on each output page.

NOTE: Complete set of supported options with their descriptions can be found here.

Examples:

theReport.PrintToLocalPrinter( "LBP3000", "paper=A4,fit-to-page=yes" );
theReport.PrintToLocalPrinter( "LBP3000", "paper=A4,landscape=yes,fit-to-page=yes,copies=2" );
theReport.PrintToLocalPrinter( "LBP3000", "paper=A3,page-set=odd" );

Additional printing options for Windows

In addition to common properties, on Windows the following options can be used:

  • color - Switches between color and monochrome on color printers. The following are the possible values: yes, no.
  • papersize - Selects the size of the paper to print on. This option can be set to a device specific value or to one of the following predefined values.

Papersize predefined values

  • printquality - Specifies the printer resolution. There are four predefined device-independent values:
Value Meaning
-4High
-3Medium
-2Low
-1Draft

If a positive value is specified, it specifies the number of dots per inch (DPI) and is therefore device dependent.

Valentina Client printing details

VClient-based application running on different OS prints reports to local printer differently:

  • On Windows a custom-format vector file is generated at server side, transferred via the network and passed into VREPORT.DLL for printing.
  • On OS X and Linux a PDF file is generated at server side, transferred via the network, saved locally and passed into CUPS library for printing.

VReport.PrintToServerPrinter()

Declaration:

PrintToServerPrinter( 
    inPrinter        as String = "",
    inOptions        as String = "",
    inStartPageIndex as UINT   = 0, 
    inEndPageIndex   as UINT   = 0 )

Parameters:

  • inPrinter - Specifies the target printer in the system, where Valentina Server is running. Empty to print to a default printer.
  • inOptions - Specifies the printing options. Empty to use defaults.
  • inStartPageIndex - the index of the first page to be printed (1..N). Zero to print all records of the report.
  • inEndPageIndex - the index of the last page to be printed (1..N).

Description:

If the Valentina Server is used for reports generation, this method prints all pages or the specified range of pages of the report to the given printer, installed in the system, where server is running.

You can specify the printing options to tune the printer output in format:

option1=value1,option2=value2,...

NOTE: Learn more about available options in the description of VReport.PrintToLocalPrinter() method.