如何提高pdf.js中的显示质量 [英] How to improve display quality in pdf.js

查看:320
本文介绍了如何提高pdf.js中的显示质量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用来自mozilla(pdf.JS)的PDF文档的开源库. 当我尝试打开质量差的pdf文档时,查看器会以非常差的质量显示它.

I'm using open source library for PDF documents from mozilla(pdf.JS). When i'm trying to open pdf documents with bad quality, viewer displays it with VERY BAD quality.

但是,如果我在阅读器或浏览器中将其打开(将其拖放到新窗口中),文档显示效果会很好

But if I open it in reader, or in browser (drag/drop into new window), whis document displays well

是否可以更改? 这是此库在github mozilla pdf.js

Is it possible to change? Here is this library on github mozilla pdf.js

推荐答案

也许这是与像素比率有关的问题,当设备的像素比率大于1时(例如iPhone,iPad等),它经常发生在我身上.您可以阅读此问题以获取更好的解释.

Maybe it's an issue related with pixel ratio, it used to happen to me when device pixel ratio is bigger than 1 (for example iPhone, iPad, etc.. you can read this question for a better explanation.

只需在 PDF.js查看器上尝试该文件.如果工作正常,则必须检查像素比率> 1

Just try that file on PDF.js Viewer. If it works like expected, you must check how PDF.js works with pixel ratio > 1 here. What library basically does is:

canvas.width = viewport.width * window.devicePixelRatio;
canvas.styles.width = viewport.width + 'px'; // Note: The px unit is required here

但是您必须检查PDF.js如何工作以获得更好的性能

But you must check how PDF.js works for better perfomance

这篇关于如何提高pdf.js中的显示质量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆