KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: 4D View Pro Printing a Sheet
PRODUCT: 4D View Pro | VERSION: 17 | PLATFORM: Mac & Win
Published On: February 8, 2019

With 4D View Pro it is possible to print a specific sheet.

The following method will allow a specific sheet of a 4D View Pro area to be printed, however it will not suppress the print dialog.

// Method: VP_Print
// Description
// Prints a sheet of a VP Area
//
// Parameters
// $1 - Text VP area object name
// $2 - Integer value of sheet index (index starts at 0)
//
// ----------------------------------------------------

C_TEXT($1;$vpArea_t)
C_LONGINT($2;$sheet_l)

C_TEXT($jsCode_t)
C_TEXT($res_t)

If (Count parameters=2)
   $vpArea_t:=$1
   $sheet_l:=$2
  
   $jsCode_t:="spread.print("+String($sheet_l)+");"
   $res_t:=WA Evaluate JavaScript(*;$vpArea_t;$jsCode_t)
End if

Example of using the command:
// To print the third sheet of a VP document displayed in the
// VP Area Object "vpAreaName"

VP_Print("vpAreaName";2)

Commented by Tai Bui on February 15, 2019 at 12:26 PM
Seems to work for a 4D View document created in v16 converted using VP Convert from 4D View on Mac with v17R4. Perhaps you can try to troubleshoot the issue by looking at what properties of the document may be causing the issue.
Commented by Manuel PIQUET on February 15, 2019 at 1:03 AM
not black, read blank page
Commented by Manuel PIQUET on February 15, 2019 at 1:02 AM
Ok try a second time with 17 R4 build 17R4.233298 this work with new sheet but i f i try to print a converted 4D View area nothing is print and we have a black page only...
Commented by Tai Bui on February 14, 2019 at 3:38 PM
We tested on 10.13 and 10.14 and both seem to work printing to a Real Printer and a to PDF. Maybe it was related to the Print Driver. Or if there is no data on the sheet nothing will be printed since only the area with data is printed.
Commented by Manuel PIQUET on February 13, 2019 at 6:45 AM
Tested on macOS 10.14.3 with 4D 17R4 => result: blank page only ?!