mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-15 21:16:03 +08:00
fix(web): pass pdf.js cMap/standard font URLs so CID-font PDFs render in preview (#18249)
This commit is contained in:
@@ -33,6 +33,7 @@ import { getAuthorization } from '@/utils/authorization-util';
|
||||
import { useCatchDocumentError } from './hooks';
|
||||
type PdfLoaderProps = React.ComponentProps<typeof PdfLoader> & {
|
||||
httpHeaders?: Record<string, string>;
|
||||
standardFontDataUrl?: string;
|
||||
};
|
||||
|
||||
const Loader = PdfLoader as React.ComponentType<PdfLoaderProps>;
|
||||
@@ -100,6 +101,9 @@ const PdfPreview = ({
|
||||
</div>
|
||||
}
|
||||
workerSrc="/pdfjs-dist/pdf.worker.min.js"
|
||||
cMapUrl="/pdfjs-dist/cmaps/"
|
||||
cMapPacked={true}
|
||||
standardFontDataUrl="/pdfjs-dist/standard_fonts/"
|
||||
errorMessage={<FileError>{error}</FileError>}
|
||||
>
|
||||
{(pdfDocument) => {
|
||||
|
||||
@@ -160,6 +160,14 @@ export default defineConfig(({ mode }) => {
|
||||
src: 'node_modules/monaco-editor/min/vs/',
|
||||
dest: './',
|
||||
},
|
||||
{
|
||||
src: 'node_modules/pdfjs-dist/cmaps/',
|
||||
dest: 'pdfjs-dist/',
|
||||
},
|
||||
{
|
||||
src: 'node_modules/pdfjs-dist/standard_fonts/',
|
||||
dest: 'pdfjs-dist/',
|
||||
},
|
||||
],
|
||||
}),
|
||||
createHtmlPlugin({
|
||||
|
||||
Reference in New Issue
Block a user