Skip to content

Commit

Permalink
+ fix rendering bug
Browse files Browse the repository at this point in the history
  • Loading branch information
GeoffreyChen777 committed Aug 31, 2022
1 parent 3a40ff0 commit 96e0a3a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/preload/interactors/render-interactor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ export class RenderInteractor {
markdownIt: MarkdownIt;
pdfWorker: Worker | null;
renderingPage: PDFPageProxy | null;
renderingPDF: pdfjs.PDFDocumentProxy | null;

constructor(preference: Preference) {
this.preference = preference;

this.pdfWorker = null;
this.renderingPage = null;
this.renderingPDF = null;
this.createPDFWorker();

this.markdownIt = new MarkdownIt().use(tm, {
Expand All @@ -47,8 +49,12 @@ export class RenderInteractor {

async render(fileURL: string) {
this.createPDFWorker();
// @ts-ignore
if (this.renderingPDF) {
this.renderingPDF.destroy();
}
const pdf = await pdfjs.getDocument(fileURL).promise;
this.renderingPDF = pdf;

const page = await pdf.getPage(1);
this.renderingPage = page;
var scale = 0.25;
Expand Down

0 comments on commit 96e0a3a

Please sign in to comment.