mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 01:58:06 +02:00
[api-minor] Refactor fetching of built-in CMaps to utilize a factory on the display
side instead, to allow users of the API to provide a custom CMap loading factory (e.g. for use with Node.js)
Currently the built-in CMap files are loaded in `src/core/cmap.js` using `XMLHttpRequest` directly. For some environments that might be a problem, hence this patch refactors that to instead use a factory to load built-in CMaps on the main thread and message the data to the worker thread. This is inspired by other recent work, e.g. the addition of the `CanvasFactory`, and to a large extent on the IRC discussion starting at http://logs.glob.uno/?c=mozilla%23pdfjs&s=12+Oct+2016&e=12+Oct+2016#c53010.
This commit is contained in:
parent
b509a3f83c
commit
769c1450b7
10 changed files with 211 additions and 111 deletions
|
@ -729,15 +729,10 @@ var WorkerMessageHandler = {
|
|||
|
||||
ensureNotTerminated();
|
||||
|
||||
var cMapOptions = {
|
||||
url: data.cMapUrl === undefined ? null : data.cMapUrl,
|
||||
packed: data.cMapPacked === true
|
||||
};
|
||||
var evaluatorOptions = {
|
||||
forceDataSchema: data.disableCreateObjectURL,
|
||||
maxImageSize: data.maxImageSize === undefined ? -1 : data.maxImageSize,
|
||||
disableFontFace: data.disableFontFace,
|
||||
cMapOptions: cMapOptions,
|
||||
disableNativeImageDecoder: data.disableNativeImageDecoder,
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue