javascript - PDF.js How do you print a multi-page pdf? -


i'm trying add print functionality multi-page pdf embedded in web page using pdf.js library. it's problematic because have 1 page rendered @ time when user viewing , page rendered image in canvas element.

this question not in case because single page pdf printing current contents of canvas acceptable. same this question. want avoid opening pdf in tab/window , telling user print themselves, defeats purpose of embedding page.

looking through documentation mozilla, haven't found native functions print pdf, however, start playing around renderingintent seems can set 'print'.

edit: redingintent doesn't seem affect , pdf stills renders same way whether set 'display' or 'print'.

remember pdf.js web page. atm, @ least not in standard html5 apis, there no way web page push random information directly printers (but can push cloud printing service) -- can print "see". "see" means what's in dom, , css can used hide information screen or printer. dom can changed beforeprint/afterprint events.

in case, since pdf view in embedded, need fake dom have pdf's pages/canvases on main web page, make them visible print , hide screen (see e.g. [4]). few different problems needs solved might off-topic here: removing margins , non-rasterizing canvas. firefox dealing via moznomarginboxes [1] , mozprintcallback [2] -- both created in support of pdf.js , not supported other browsers. (see polyfill latter [3])


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -