Print from webviewer,get blurry print pages

203 views
Skip to first unread message

jayas...@contentraven.net

unread,
Apr 17, 2017, 1:14:34 PM4/17/17
to PDFTron WebViewer
Hi All,
We are using the latest WebViewer to view the XOD file. We have a problem in print scenario.

1. when I print using the orginal document, then I get a very sharp and clear print. But when i print from webviewer, I get a blurry print.
2. I have some PDF pages which i want to print on A4 sheets. However, the page is not fit to A4 sheet.

Please refer the attached screenshot and orginal pdf file.

I want to fit the page to A4 size paper while printing document and print from webviewer,get a very sharp and clear print.

Please help me ASAP

Thanks
OS X Mountain Lion Pocket Guide_2.pdf
Print_error_17-04-2017.png

Justin Jung

unread,
Apr 18, 2017, 9:04:29 PM4/18/17
to PDFTron WebViewer
Hello,

Seems like the page size is small, and contains an image instead of actual texts. For better quality of XOD, you can increase the dpi in conversion with the dpi option (default is 140). For example to increase it to 500, 

--dpi 500

Also, to print to fit the page, you would have to change the followings in BaseReaderControl.js:

<From>
window.utils.setCanvasMultiplier(1); 
<To>
window.utils.setCanvasMultiplier(8);

<From>
.css({
    'max-height': '100%',
    'max-width': '100%'
})
<To>
.css({
    'max-height': '100%',
    'max-width': '100%',
    'height': '100%',
    'margin-left': '50%',
    'transform': 'translateX(-50%)'
})

Justin Jung
Software Developer
PDFTron Systems Inc.

jayas...@contentraven.net

unread,
Apr 19, 2017, 11:31:29 AM4/19/17
to PDFTron WebViewer
Hi Justin Jung,
Thank you for your response.
We updated your mentioned code from our end. Print looks like it is good, but watermark text is not printed.

Note: If  i set dpi window.utils.setCanvasMultiplier(1) ,the watermark is displayed, but i set dbi window.utils.setCanvasMultiplier(8), the watermark text is not displayed.
The below forum url is apply watermark for your reference,

Please fix this issue ASAP.

Thanks

Justin Jung

unread,
Apr 19, 2017, 3:34:33 PM4/19/17
to PDFTron WebViewer
Hello,

You can add the following code just before you start drawing your custom watermark.

var zoomOut = 1 / window.utils.getCanvasMultiplier();
ctx.scale(zoomOut, zoomOut);

jayas...@contentraven.net

unread,
May 9, 2017, 12:01:05 PM5/9/17
to PDFTron WebViewer
Hi Jsutin Jung,

We have some large documents(more than 200 pages)  that we run through the HTML5 WebViewer.  Our problem is that with the default settings, the documents were printing very low resolution.  I adjusted the window.utils.setCanvasMultiplier setting to 2, which made the page much better.  However, the memory usage on a 150 pg document is now approximately 3.2GB, and crashes the browser.


I have attached the crash issue details.


Does anyone have any tips on how to fix the memory usage, while maintaining some level of fidelity?


Thanks


On Monday, April 17, 2017 at 10:44:34 PM UTC+5:30, (unknown) wrote:
Crash.png

Justin Jung

unread,
May 9, 2017, 4:16:08 PM5/9/17
to PDFTron WebViewer
Hello,

To be able to print every page, WebViewer needs to download all the resources for the page and construct image for each page. When the canvasMutiplier is 2, each page image will use 4 times as much memory since each dimension increases by 2. When there are large number of pages, this can add up.
Unfortunately, there is no browser API to stream the page information to the printer, which is why WebViewer needs to do everything up front. To work around this, you could limit the maximum number of pages to be printed at a time.
Reply all
Reply to author
Forward
0 new messages