PDF to HTML file conversion #18414
Mohantech123
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
const pdfUrl = 'https://www.tutorialspoint.com/nodejs/nodejs_tutorial.pdf'; // Update this to the correct path
const pdf = await this.pdfToSvgService.getDocument(pdfUrl);
this is component code
import { Injectable } from '@angular/core';
import { getDocument, GlobalWorkerOptions, version, PDFDocumentProxy, PDFPageProxy } from 'pdfjs-dist';
import * as pdfjsLib from 'pdfjs-dist';
// Ensure the correct worker is loaded
GlobalWorkerOptions.workerSrc =
https://cdnjs.cloudflare.com/ajax/libs/pdf.js/${version}/pdf.worker.min.js
;@Injectable({
providedIn: 'root',
})
export class PdfToSvgService {
constructor() {}
async getDocument(pdfUrl: string): Promise {
return getDocument(pdfUrl).promise;
}
}
I got the error.
ERROR
Error: Uncaught (in promise): TypeError: Promise.withResolvers is not a function
TypeError: Promise.withResolvers is not a function
at new PDFDocumentLoadingTask (https://angular-15-starter-pack-nqrnwd.stackblitz.io/turbo_modules/[email protected]/build/pdf.mjs:10735:36)
what can I do.
Beta Was this translation helpful? Give feedback.
All reactions