viewerpreferences

Adds the ability to set ViewerPreferences and by thus controlling the way the document is to be presented on the screen or in print.

Source:

Methods

(inner) viewerPreferences(options, doReset)

Source:

Set the ViewerPreferences of the generated PDF

Example
var doc = new jsPDF()
doc.text('This is a test', 10, 10)
doc.viewerPreferences({'FitWindow': true}, true)
doc.save("viewerPreferences.pdf")

// Example printing 10 copies, using cropbox, and hiding UI.
doc.viewerPreferences({
  'HideWindowUI': true,
  'PrintArea': 'CropBox',
  'NumCopies': 10
})
Parameters:
Name Type Description
options Object

Array with the ViewerPreferences
Example: doc.viewerPreferences({"FitWindow":true});

You can set following preferences:

HideToolbar (boolean)
Default value: false

HideMenubar (boolean)
Default value: false.

HideWindowUI (boolean)
Default value: false.

FitWindow (boolean)
Default value: false.

CenterWindow (boolean)
Default value: false

DisplayDocTitle (boolean)
Default value: false.

NonFullScreenPageMode (string)
Possible values: UseNone, UseOutlines, UseThumbs, UseOC
Default value: UseNone

Direction (string)
Possible values: L2R, R2L
Default value: L2R.

ViewArea (string)
Possible values: MediaBox, CropBox, TrimBox, BleedBox, ArtBox
Default value: CropBox.

ViewClip (string)
Possible values: MediaBox, CropBox, TrimBox, BleedBox, ArtBox
Default value: CropBox

PrintArea (string)
Possible values: MediaBox, CropBox, TrimBox, BleedBox, ArtBox
Default value: CropBox

PrintClip (string)
Possible values: MediaBox, CropBox, TrimBox, BleedBox, ArtBox
Default value: CropBox.

PrintScaling (string)
Possible values: AppDefault, None
Default value: AppDefault.

Duplex (string)
Possible values: Simplex, DuplexFlipLongEdge, DuplexFlipShortEdge Default value: none

PickTrayByPDFSize (boolean)
Default value: false

PrintPageRange (Array)
Example: [[1,5], [7,9]]
Default value: as defined by PDF viewer application

NumCopies (Number)
Possible values: 1, 2, 3, 4, 5
Default value: 1

For more information see the PDF Reference, sixth edition on Page 577

doReset boolean

True to reset the settings

Returns:

jsPDF jsPDF-instance