1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Desktop: Fix pdf text blurry (#6843)

This commit is contained in:
asrient 2022-09-12 20:37:39 +05:30 committed by GitHub
parent 907dc7601b
commit d07788607c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 3 deletions

View File

@ -993,6 +993,9 @@ packages/app-mobile/components/screens/UpgradeSyncTargetScreen.js.map
packages/app-mobile/components/screens/encryption-config.d.ts
packages/app-mobile/components/screens/encryption-config.js
packages/app-mobile/components/screens/encryption-config.js.map
packages/app-mobile/components/searchNotes.d.ts
packages/app-mobile/components/searchNotes.js
packages/app-mobile/components/searchNotes.js.map
packages/app-mobile/components/useStyles.d.ts
packages/app-mobile/components/useStyles.js
packages/app-mobile/components/useStyles.js.map

3
.gitignore vendored
View File

@ -981,6 +981,9 @@ packages/app-mobile/components/screens/UpgradeSyncTargetScreen.js.map
packages/app-mobile/components/screens/encryption-config.d.ts
packages/app-mobile/components/screens/encryption-config.js
packages/app-mobile/components/screens/encryption-config.js.map
packages/app-mobile/components/searchNotes.d.ts
packages/app-mobile/components/searchNotes.js
packages/app-mobile/components/searchNotes.js.map
packages/app-mobile/components/useStyles.d.ts
packages/app-mobile/components/useStyles.js
packages/app-mobile/components/useStyles.js.map

View File

@ -74,6 +74,10 @@ export default function Page(props: PageProps) {
const renderPage = async () => {
try {
if (canvasRef.current) {
canvasRef.current.style.height = '100%';
canvasRef.current.style.width = '100%';
}
const renderRequest: RenderRequest = {
pageNo: props.pageNo,
scaledSize: props.scaledSize,

View File

@ -90,6 +90,7 @@ export default class PdfDocument {
checkCancelled();
const canvas = this.document.createElement('canvas');
canvas.classList.add('page-canvas');
const viewport = page.getViewport({ scale: scaledSize.scale || 1.0 });
canvas.width = viewport.width;
canvas.height = viewport.height;
@ -124,9 +125,6 @@ export default class PdfDocument {
textLayerDiv.appendChild(textFragment);
}
canvas.style.height = '100%';
canvas.style.width = '100%';
return { canvas, textLayerDiv };
};

View File

@ -85,3 +85,14 @@ hr {
background-color: rgb(54, 54, 54);
}
.page-canvas {
position: absolute;
top: 0px;
left: 0px;
}
.textLayer {
position: absolute;
top: 0px;
left: 0px;
}