OptionalchunkSets which chunk size to use when requesting chunks from the IRandomAccessDataSource instance.
If enableDeterministicChunkRequests is false:
If enableDeterministicChunkRequests is true:
IRandomAccessDataSource.fetchChunk() is guaranteed to be a multiple
of the chunkSize.OptionaldisableBy default fonts are converted to OpenType fonts and loaded via font face rules.
If disabled, fonts will be rendered using a built-in font renderer that constructs the
glyphs with primitive path commands. The default value is false.
Note: Only set this option to true for platforms and publications that have problems with text-rendering. It may have a major performance impact and may also cause blurrier text.
OptionalenableEnables deterministic chunk sizes and offsets when streaming the PDF file using an IRandomAccessDataSource instance.
Deterministic chunk requests are useful for caching chunks locally as the same offsets will be used in future
requests to RandomAccessDataSource.fetchChunk().
Setting enableDeterministicChunkRequests to true will consume up to 16 MB more of memory in order to prevent
multiple requests of the same chunk.
OptionalonCallback used to lazily load packed PDF CMap data on demand.
PDF.js uses CMaps (character maps) to correctly decode text for many fonts, especially for CJK and other non-Latin scripts. To keep the initial bundle size small, the framework can load these CMaps as code-split “groups” only when PDF.js requests them.
The callback receives the name of the CMap group to load and must return a Promise that resolves to the
corresponding CMap group colibrio module. The CMap group colibrio modules are prefixed with
@colibrio/colibrio-reader-framework/colibrio-core-publication-pdf-cmap-.
You can use the following callback code to lazily load CMap groups from your own code.
const options: IPdfPublicationOptions = {
onCMapModuleRequest: async (cMapGroupModuleName: PdfCMapGroupName) => {
switch (cMapGroupModuleName) {
case PdfCMapGroupName.COMMON:
return await import('@colibrio/colibrio-reader-framework/colibrio-core-publication-pdf-cmap-common');
case PdfCMapGroupName.KOREAN:
return await import('@colibrio/colibrio-reader-framework/colibrio-core-publication-pdf-cmap-korean');
case PdfCMapGroupName.JAPANESE:
return await import('@colibrio/colibrio-reader-framework/colibrio-core-publication-pdf-cmap-japanese');
case PdfCMapGroupName.SIMPLIFIED_CHINESE:
return await import('@colibrio/colibrio-reader-framework/colibrio-core-publication-pdf-cmap-simplified-chinese');
case PdfCMapGroupName.TRADITIONAL_CHINESE:
return await import('@colibrio/colibrio-reader-framework/colibrio-core-publication-pdf-cmap-traditional-chinese');
}
},
};
The framework caches loaded groups, so the callback is typically invoked at most once per group name.
OptionalpasswordUsed to decrypt a password-protected publication
Options used when creating a PdfPublication instance.