Open labman003 opened 3 months ago
import { PdfLoaderPlugin, FontManager } from "@x-viewer/x-viewer";
const config = {
containerId: "myCanvas",
enableSpinner: true,
enableLayoutBar: true,
};
const viewer = new Viewer2d(config);
const fontFiles = ["./libs/fonts/simplex.shx", "./libs/fonts/hztxt.shx"];
await viewer.setFont(fontFiles);
const modelCfg = {
modelId: "id_0",
name: "my sample",
src: "http://www.abc.com/path/to/my-sample.pdf",
merge: true,
}
const onProgress = (event) => {
const progress = (event.loaded * 100) / event.total;
console.log(`Loading '${modelCfg.modelId}' progress: ${progress.toFixed(1)}%`);
};
const pdfLoader = new PdfLoaderPlugin(viewer, { font: viewer.fontManager, pdfWorker: "libs/pdf/pdf.worker.min.js" });
const model = await pdfLoader.loadAsync(modelCfg, onProgress);
viewer.addModel(model);
How is this exception fixed? x-viewer.esm.min.js:6 Uncaught (in promise) DataCloneError: Failed to execute 'put' on 'IDBObjectStore': #
2.Excuse me, do you provide pds.worker.js? I downloaded 2.5.207 but it didn't work
thanks!
pdf.zip please try this
hello Can you provide some load pdf demo?