Skip to content

Commit

Permalink
fix: 部分ios机型上面无法预览pdf的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
501351981 committed Mar 12, 2024
1 parent e8be520 commit eef3140
Show file tree
Hide file tree
Showing 16 changed files with 435 additions and 5 deletions.
2 changes: 1 addition & 1 deletion core/packages/js-pdf/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@js-preview/pdf",
"type" :"module",
"version": "1.6.3",
"version": "1.6.4",
"description": "",
"main": "lib/index.js",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion core/packages/js-pdf/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class JsPdfPreview{
renderSinglePage(num){
return this.pdfDocument.getPage(num).then((pdfPage) => {
const viewport = pdfPage.getViewport({scale: 2});
const outputScale = window.devicePixelRatio || 1;
const outputScale = window.devicePixelRatio > 2 ? 1.5 : 2;
let [canvas, ctx] = this.createCanvas(num);

canvas.width = Math.floor(viewport.width * outputScale);
Expand Down
2 changes: 1 addition & 1 deletion core/packages/vue-pdf/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vue-office/pdf",
"version": "1.6.3",
"version": "1.6.4",
"description": "",
"main": "lib/index.js",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion core/packages/vue-pdf/src/main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export default defineComponent({
function renderPage(num) {
pdfDocument.getPage(num).then((pdfPage) => {
const viewport = pdfPage.getViewport({ scale: 2 });
const outputScale = window.devicePixelRatio || 1;
const outputScale = window.devicePixelRatio > 2 ? 1.5 : 2;
const canvas = rootRef.value[num - 1];
const ctx = canvas.getContext('2d');
Expand Down
1 change: 1 addition & 0 deletions examples/dist/assets/DocxDemo-08892a08.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions examples/dist/assets/ExcelDemo-681a9d30.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions examples/dist/assets/JsDocxDemo-e27dbe2c.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions examples/dist/assets/JsExcelDemo-7436075a.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions examples/dist/assets/JsPdfDemo-58990ec3.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions examples/dist/assets/PdfDemo-c77bcb61.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/dist/assets/PreviewWrapper-d36f54b3.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit eef3140

Please sign in to comment.