4D v16.3

BLOB to print settings

Home

 
4D v16.3
BLOB to print settings

BLOB to print settings 


 

BLOB to print settings ( printSettings {; params} ) -> Function result 
Parameter Type   Description
printSettings  BLOB in BLOB containing print settings
params  Longint in 0=Restore saved values for number of copies and page range, 1=Reset to default values
Function result  Longint in Status code: 1=Operation successful, 0=No current printer, -1=Incorrect parameters, 2=Printer changed

The BLOB to print settings command replaces the current 4D print settings with the parameters stored in the printSettings BLOB. This BLOB must have been generated by the Print settings to BLOB command or the _o_AP Print settings to BLOB 4D Pack command (see below).

The params parameter allows you to define how to handle the basic "number of copies" and "page range" settings:

  • If you pass 0 or omit this parameter, the values stored in the BLOB are restored,
  • If you pass 1, the values are reset to default: the number of copies is set to 1 and the page range is set to "all pages".

The print settings are applied to the current printer and for the whole session, as long as no command such as PAGE SETUP, SET PRINT OPTION or PRINT SELECTION without the > parameter modifies them. The parameters set are used more particularly by the PRINT SELECTION, PRINT LABEL, PRINT RECORD, Print form and QR REPORT commands, as well as by the menu commands of 4D, including those of the Design environment.

The PRINT SELECTION, PRINT LABEL, and PRINT RECORD commands must be called with the > parameter (if applicable) in order for the settings defined by BLOB to print settings to be kept.

The command returns one of the following status codes:

  • -1: the BLOB is incorrect,
  • 0: no current printer is selected (in this case the command does nothing),
  • 1: the BLOB has been correctly loaded,
  • 2: the BLOB has been correctly loaded but the current printer name has changed(*).
    Note: Code (2) is always returned if the BLOB was created by the _o_AP Print settings to BLOB 4D Pack command, even if the printer name did not actually change, since this information was not included in the 4D Pack BLOBs.

(*) Settings depend on the currently selected printer at the moment the BLOB was saved. Applying these settings to a another printer is supported if both printers are of the same model. If the printers are different, only common parameters will be restored.

The printSettings BLOB can be saved and read on both platforms. However, even if some print settings are common, some others are platform-specific and depend on the drivers and system versions. If the same printSettings BLOB is shared between both platforms, you may lose parts of the information.
When used in a heterogeneous environment, in order to restore the maximum settings available for each platform (and not only the common part), it is recommended that you work with two printSettings BLOBs, one for each platform.

The print settings BLOBs generated by the legacy _o_AP Print settings to BLOB command from 4D Pack can be loaded and used by the BLOB to print settings command. Note however that if they are saved using Print settings to BLOB, they are converted and can no longer be opened using _o_AP BLOB to print settings. The BLOB to print settings command stores much more printing information than _o_AP Print settings to BLOB.

Example  

You want to apply print settings previously saved to disk to the current 4D printing context: 

 C_BLOB(curSettings)
 DOCUMENT TO BLOB(Get 4D folder(Active 4D Folder)+"current4Dsettings.blob";curSettings)
  //current4Dsettings has been created by Print settings to BLOB
 $err:=BLOB to print settings(curSettings;0)
 Case of
    :($err=1)
  //everything is OK
    :($err=2)
       CONFIRM("Printer has changed!\n\nCheck the print settings?")
       If(OK=1)
          PRINT SETTINGS
       End if
    :($err=0)
       ALERT("There is no current printer.")
    :($err=-1)
       ALERT("Invalid settings file.")
 End case



See also 

Print settings to BLOB

 
PROPERTIES 

Product: 4D
Theme: Printing
Number: 1434

This command has platform-specific behaviorThis command has platform-specific behavior

 
HISTORY 

New
Created: 4D v16

 
ARTICLE USAGE

4D Language Reference ( 4D v16)
4D Language Reference ( 4D v16.1)
4D Language Reference ( 4D v16.2)
4D Language Reference ( 4D v16.3)