File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ( function ( jsPDFAPI ) {
2+ 'use strict'
3+
4+ jsPDFAPI . autoPrint = function ( ) {
5+ 'use strict'
6+ // `this` is _jsPDF object returned when jsPDF is inited (new jsPDF())
7+ // `this.internal` is a collection of useful, specific-to-raw-PDF-stream functions.
8+ // for example, `this.internal.write` function allowing you to write directly to PDF stream.
9+ // `this.line`, `this.text` etc are available directly.
10+ // so if your plugin just wraps complex series of this.line or this.text or other public API calls,
11+ // you don't need to look into `this.internal`
12+ // See _jsPDF object in jspdf.js for complete list of what's available to you.
13+ var refAutoPrintTag ;
14+
15+ this . internal . events . subscribe ( 'postPutResources' , function ( ) {
16+ refAutoPrintTag = this . internal . newObject ( )
17+ this . internal . write ( "<< /S/Named /Type/Action /N/Print >>" , "endobj" ) ;
18+ } )
19+
20+ this . internal . events . subscribe ( "putCatalog" , function ( ) {
21+ this . internal . write ( "/OpenAction " + refAutoPrintTag + " 0" + " R" ) ;
22+ } ) ;
23+
24+ // it is good practice to return ref to jsPDF instance to make
25+ // the calls chainable.
26+ return this ;
27+ }
28+
29+ } ) ( jsPDF . API )
You can’t perform that action at this time.
0 commit comments