Capitalised pdfJsDocument and pdfLibDocument

This commit is contained in:
Saud Fatayerji
2023-11-15 02:38:07 +03:00
parent 5f23491189
commit 57415bea85
10 changed files with 21 additions and 21 deletions

View File

@@ -44,7 +44,7 @@ export class PdfFile {
this.representationType = RepresentationType.Uint8Array;
}
get pdflibDocument() : Promise<PDFLibDocument> {
get pdfLibDocument() : Promise<PDFLibDocument> {
switch (this.representationType) {
case RepresentationType.PDFLibDocument:
return new Promise((resolve, reject) => {
@@ -56,17 +56,17 @@ export class PdfFile {
var pdfLibDoc = await PDFLibDocument.load(uint8Array, {
updateMetadata: false,
});
this.pdflibDocument = pdfLibDoc;
this.pdfLibDocument = pdfLibDoc;
resolve(pdfLibDoc);
});
}
}
set pdflibDocument(value: PDFLibDocument) {
set pdfLibDocument(value: PDFLibDocument) {
this.representation = value;
this.representationType = RepresentationType.PDFLibDocument;
}
get pdfjsDocument() : Promise<PDFJSDocument> {
get pdfJsDocument() : Promise<PDFJSDocument> {
switch (this.representationType) {
case RepresentationType.PDFJSDocument:
return new Promise((resolve, reject) => {
@@ -75,12 +75,12 @@ export class PdfFile {
default:
return new Promise(async (resolve, reject) => {
const pdfjsDoc = await PDFJS.getDocument(await this.uint8Array).promise;
this.pdfjsDocument = pdfjsDoc;
this.pdfJsDocument = pdfjsDoc;
resolve(pdfjsDoc);
});
}
}
set pdfjsDocument(value: PDFJSDocument) {
set pdfJsDocument(value: PDFJSDocument) {
this.representation = value;
this.representationType = RepresentationType.PDFJSDocument;
}
@@ -111,7 +111,7 @@ export class PdfFile {
static async cacheAsPdfLibDocuments(files: PdfFile[]): Promise<Map<PdfFile, PDFLibDocument>> {
const docCache = new Map<PdfFile, PDFLibDocument>();
await Promise.all(files.map(async (file) => {
const pdfLibDocument = await file.pdflibDocument;
const pdfLibDocument = await file.pdfLibDocument;
docCache.set(file, pdfLibDocument);
}));
return docCache;
@@ -119,7 +119,7 @@ export class PdfFile {
static async cacheAsPdfJsDocuments(files: PdfFile[]): Promise<Map<PdfFile, PDFJSDocument>> {
const docCache = new Map<PdfFile, PDFJSDocument>();
await Promise.all(files.map(async (file) => {
const pdfLibDocument = await file.pdfjsDocument;
const pdfLibDocument = await file.pdfJsDocument;
docCache.set(file, pdfLibDocument);
}));
return docCache;