mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #8975 from overleaf/ae-pdfjs-standard-fonts
Add standardFontDataUrl to PDF.js config GitOrigin-RevId: a9304da6d8a9115056240fc3ed4897415bf6e159
This commit is contained in:
parent
b01f839831
commit
8f343be843
5 changed files with 36 additions and 9 deletions
|
@ -14,9 +14,6 @@ meta(name="ol-wikiEnabled" data-type="boolean" content=!!(settings.apis.wiki &&
|
|||
meta(name="ol-gitBridgePublicBaseUrl" content=gitBridgePublicBaseUrl)
|
||||
//- Set base path for Ace scripts loaded on demand/workers and don't use cdn
|
||||
meta(name="ol-aceBasePath" content="/js/" + lib('ace'))
|
||||
//- Set path for PDFjs CMaps and images
|
||||
meta(name="ol-pdfCMapsPath" content="/js/cmaps/")
|
||||
meta(name="ol-pdfImageResourcesPath" content="/images/")
|
||||
//- enable doc hash checking for all projects
|
||||
//- used in public/js/libs/sharejs.js
|
||||
meta(name="ol-useShareJsHash" data-type="boolean" content=true)
|
||||
|
|
|
@ -8,6 +8,7 @@ import { createWorker } from '../../../utils/worker'
|
|||
|
||||
async function importPDFJS210() {
|
||||
const cMapUrl = '/js/pdfjs-dist210/cmaps/'
|
||||
const standardFontDataUrl = '/fonts/pdfjs-dist210/'
|
||||
const imageResourcesPath = '/images/pdfjs-dist210'
|
||||
|
||||
const [PDFJS, PDFJSViewer] = await Promise.all([
|
||||
|
@ -22,11 +23,18 @@ async function importPDFJS210() {
|
|||
)
|
||||
})
|
||||
|
||||
return { PDFJS, PDFJSViewer, cMapUrl, imageResourcesPath }
|
||||
return {
|
||||
PDFJS,
|
||||
PDFJSViewer,
|
||||
cMapUrl,
|
||||
imageResourcesPath,
|
||||
standardFontDataUrl,
|
||||
}
|
||||
}
|
||||
|
||||
async function importPDFJS213() {
|
||||
const cMapUrl = '/js/pdfjs-dist213/cmaps/'
|
||||
const standardFontDataUrl = '/fonts/pdfjs-dist213/'
|
||||
const imageResourcesPath = '/images/pdfjs-dist213'
|
||||
|
||||
const [PDFJS, PDFJSViewer] = await Promise.all([
|
||||
|
@ -41,7 +49,13 @@ async function importPDFJS213() {
|
|||
)
|
||||
})
|
||||
|
||||
return { PDFJS, PDFJSViewer, cMapUrl, imageResourcesPath }
|
||||
return {
|
||||
PDFJS,
|
||||
PDFJSViewer,
|
||||
cMapUrl,
|
||||
imageResourcesPath,
|
||||
standardFontDataUrl,
|
||||
}
|
||||
}
|
||||
|
||||
async function importPDFJS() {
|
||||
|
|
|
@ -13,9 +13,13 @@ export default class PDFJSWrapper {
|
|||
}
|
||||
|
||||
async init() {
|
||||
const { PDFJS, PDFJSViewer, cMapUrl, imageResourcesPath } = await import(
|
||||
'./pdf-js-versions'
|
||||
).then(m => {
|
||||
const {
|
||||
PDFJS,
|
||||
PDFJSViewer,
|
||||
cMapUrl,
|
||||
imageResourcesPath,
|
||||
standardFontDataUrl,
|
||||
} = await import('./pdf-js-versions').then(m => {
|
||||
return m.default
|
||||
})
|
||||
|
||||
|
@ -23,6 +27,7 @@ export default class PDFJSWrapper {
|
|||
this.genPdfCachingTransport = generatePdfCachingTransportFactory(PDFJS)
|
||||
this.PDFJSViewer = PDFJSViewer
|
||||
this.cMapUrl = cMapUrl
|
||||
this.standardFontDataUrl = standardFontDataUrl
|
||||
this.imageResourcesPath = imageResourcesPath
|
||||
|
||||
// create the event bus
|
||||
|
@ -78,6 +83,7 @@ export default class PDFJSWrapper {
|
|||
url,
|
||||
cMapUrl: this.cMapUrl,
|
||||
cMapPacked: true,
|
||||
standardFontDataUrl: this.standardFontDataUrl,
|
||||
disableFontFace,
|
||||
rangeChunkSize,
|
||||
disableAutoFetch: true,
|
||||
|
|
|
@ -73,6 +73,11 @@ module.exports = merge(base, {
|
|||
chunks: false,
|
||||
modules: false,
|
||||
// Hide copied assets from output
|
||||
excludeAssets: [/^js\/ace/, /^js\/libs/, /^js\/cmaps/],
|
||||
excludeAssets: [
|
||||
/^js\/ace/,
|
||||
/^js\/libs/,
|
||||
/^js\/cmaps/,
|
||||
/^js\/standard_fonts/,
|
||||
],
|
||||
},
|
||||
})
|
||||
|
|
|
@ -304,6 +304,11 @@ module.exports = {
|
|||
|
||||
return [
|
||||
{ from: `cmaps`, to: `js/${version}/cmaps`, context: dir },
|
||||
{
|
||||
from: `standard_fonts`,
|
||||
to: `fonts/${version}`,
|
||||
context: dir,
|
||||
},
|
||||
{
|
||||
from: `legacy/web/images`,
|
||||
to: `images/${version}`,
|
||||
|
|
Loading…
Reference in a new issue