Pdf image quality is bad using pdf.js

前端 未结 4 1993
执笔经年
执笔经年 2021-02-13 05:49

I am using pdf.js.

But, image quality of PDF is low quality.

Please tell me solution method.

var TARGET_PAGE = 1; 
var PAGE_SCALE = 1; 

function         


        
4条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-13 06:33

    I let it work by zooming the scale in getViewport, an then de-zooming the canvas with css style:

    var viewport = page.getViewport(10);//paint with zoom 10X to reach "high definition" PDF drawing
    canvas.width = viewport.width;//keep high definition drawing canvas
    canvas.style.width = "100%";//de-zoom canvas with style (maybe you can directly use CSS), reaching de-zoom of higher definition PDF
    

提交回复
热议问题