function arrayContainsElement(array, element) {
      var iterator;
      var result = false;

      for (iterator = 0; iterator < array.length; iterator += 1) {
        if (array[iterator] === element) {
          result = true;
        }
      }

      return result;
    }
Set the ViewerPreferences of the generated PDF

@name viewerPreferences
@function
@public
@param {Object} options Array with the ViewerPreferences<br />
Example: doc.viewerPreferences({"FitWindow":true});<br />
<br />
You can set following preferences:<br />
<br/>
<b>HideToolbar</b> <i>(boolean)</i><br />
Default value: false<br />
<br />
<b>HideMenubar</b> <i>(boolean)</i><br />
Default value: false.<br />
<br />
<b>HideWindowUI</b> <i>(boolean)</i><br />
Default value: false.<br />
<br />
<b>FitWindow</b> <i>(boolean)</i><br />
Default value: false.<br />
<br />
<b>CenterWindow</b> <i>(boolean)</i><br />
Default value: false<br />
<br />
<b>DisplayDocTitle</b> <i>(boolean)</i><br />
Default value: false.<br />
<br />
<b>NonFullScreenPageMode</b> <i>(string)</i><br />
Possible values: UseNone, UseOutlines, UseThumbs, UseOC<br />
Default value: UseNone<br/>
<br />
<b>Direction</b> <i>(string)</i><br />
Possible values: L2R, R2L<br />
Default value: L2R.<br />
<br />
<b>ViewArea</b> <i>(string)</i><br />
Possible values: MediaBox, CropBox, TrimBox, BleedBox, ArtBox<br />
Default value: CropBox.<br />
<br />
<b>ViewClip</b> <i>(string)</i><br />
Possible values: MediaBox, CropBox, TrimBox, BleedBox, ArtBox<br />
Default value: CropBox<br />
<br />
<b>PrintArea</b> <i>(string)</i><br />
Possible values: MediaBox, CropBox, TrimBox, BleedBox, ArtBox<br />
Default value: CropBox<br />
<br />
<b>PrintClip</b> <i>(string)</i><br />
Possible values: MediaBox, CropBox, TrimBox, BleedBox, ArtBox<br />
Default value: CropBox.<br />
<br />
<b>PrintScaling</b> <i>(string)</i><br />
Possible values: AppDefault, None<br />
Default value: AppDefault.<br />
<br />
<b>Duplex</b> <i>(string)</i><br />
Possible values: Simplex, DuplexFlipLongEdge, DuplexFlipShortEdge
Default value: none<br />
<br />
<b>PickTrayByPDFSize</b> <i>(boolean)</i><br />
Default value: false<br />
<br />
<b>PrintPageRange</b> <i>(Array)</i><br />
Example: [[1,5], [7,9]]<br />
Default value: as defined by PDF viewer application<br />
<br />
<b>NumCopies</b> <i>(Number)</i><br />
Possible values: 1, 2, 3, 4, 5<br />
Default value: 1<br />
<br />
For more information see the PDF Reference, sixth edition on Page 577
@param {boolean} doReset True to reset the settings
@function
@returns jsPDF jsPDF-instance
@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
})