问题:
我使用pdf.js打印PDF文档时,纸上的文字不像直接打印PDF那样清晰。
如何解决?
问题:
我使用pdf.js打印PDF文档时,纸上的文字不像直接打印PDF那样清晰。
如何解决?
beforePrint
函数,并对viewer.js进行以下更改。
viewer.js
// increase to improve quality
var viewport = pdfPage.getViewport(4);
// Use the same hack we use for high dpi displays for printing to get
// better output until bug 811002 is fixed in FF.
var DPI = 72; // increase to improve quality
var PRINT_OUTPUT_SCALE = DPI/72;
var canvas = document.createElement('canvas');
// The logical size of the canvas.
canvas.width = Math.floor(viewport.width * PRINT_OUTPUT_SCALE);
canvas.height = Math.floor(viewport.height * PRINT_OUTPUT_SCALE);
// The rendered size of the canvas, relative to the size of canvasWrapper.
canvas.style.width = '100%';
CustomStyle.setProp('transform' , canvas, 'scale(1,1)');
CustomStyle.setProp('transformOrigin' , canvas, '0% 0%');
var canvasWrapper = document.createElement('div');
canvasWrapper.style.width = '100%';
canvasWrapper.style.height = '100%';
canvasWrapper.appendChild(canvas);
printContainer.appendChild(canvasWrapper);