Colibrio Reader Framework API - Cloud license
    Preparing search index...

    Options used when creating a PdfPublication instance.

    interface IPdfPublicationOptions {
        chunkSize?: number;
        disableFontFace?: boolean;
        enableDeterministicChunkRequests?: boolean;
        onCMapModuleRequest?: (
            cMapGroupModuleName: PdfCMapGroupName,
        ) => Promise<IPdfCMapGroupModule>;
        password?: string;
    }

    Properties

    chunkSize?: number

    Sets which chunk size to use when requesting chunks from the IRandomAccessDataSource instance.

    If enableDeterministicChunkRequests is false:

    • This value defines the maximum chunk size that will be used per request.
    • Smaller chunks may be requested.

    If enableDeterministicChunkRequests is true:

    • All requests will use the specified chunk size, with the exception of the last chunk which might be smaller (but still deterministic).
    • The startOffset used in the call to IRandomAccessDataSource.fetchChunk() is guaranteed to be a multiple of the chunkSize.
    128000
    
    disableFontFace?: boolean

    By 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.

    false
    
    enableDeterministicChunkRequests?: boolean

    Enables 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.

    false
    
    onCMapModuleRequest?: (
        cMapGroupModuleName: PdfCMapGroupName,
    ) => Promise<IPdfCMapGroupModule>

    Callback 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.

    null
    
    password?: string

    Used to decrypt a password-protected publication

    null