fix(reader): add explicit PDF.js resource paths and pin foliate-js fork
foliate-js could not locate cmaps and standard_fonts at runtime because no explicit paths were provided to the PDF.js config. This caused rendering failures for PDFs using CJK fonts or standard PDF fonts. Changes: - Pass cMapUrl and standardFontDataUrl to view.open() in reader.ts - Pin foliate-js fork to commit 74c317d in package.json for reproducibility - Update build:ts script to copy cmaps/ and standard_fonts/ to web/static/vendor/pdfjs/ during build
This commit is contained in:
@@ -436,7 +436,12 @@ document.addEventListener("alpine:init", () => {
|
||||
const blob = await resp.blob();
|
||||
const fileName = new URL(config.fileUrl, window.location.origin).pathname;
|
||||
const file = new File([blob], fileName, { type: blob.type });
|
||||
await this.view.open(file);
|
||||
await this.view.open(file, {
|
||||
pdf: {
|
||||
cMapUrl: "/static/vendor/pdfjs/cmaps/",
|
||||
standardFontDataUrl: "/static/vendor/pdfjs/standard_fonts/",
|
||||
},
|
||||
});
|
||||
this.renderer = this.view.renderer;
|
||||
this.book = this.view.book;
|
||||
this.isFixedLayout = this.view.isFixedLayout;
|
||||
|
||||
Reference in New Issue
Block a user