我试图使用pdfjs渲染PDF。我做得很好,但是现在我希望PDF页面在缩放时也必须清晰。请查看并让我知道如何将PDF页面作为SVG导入以保持清晰度。保持页面清晰的任何其他选择将受到高度赞赏
我的代码
__PDF_DOC.getPage(page_no).then(function (page) {
pdfPage = page;
var canvas1 = document.getElementById('c');
var scale_required = 1;//__CANVAS.width / page.getViewport(1).width;
// Get viewport of the page at required scale
var viewport = page.getViewport(canvas.width / page.getViewport(1.0).width);
renderContext = {
canvasContext: canvas.getContext(),//__CANVAS_CTX,
viewport: viewport,//viewport,
};
// Render the page contents in the canvas
page.render(renderContext).then(function () {
var bg = canvas1.toDataURL("image/svg",1);
canvas.setBackgroundImage(bg, canvas.renderAll.bind(canvas));
canvas.renderAll();
});