pdf-to-png-converter
Version:
Node.js utility to convert PDF file/buffer pages to PNG files/buffers. No build-time compilation required — pre-built native binaries included for all major platforms.
24 lines (23 loc) • 1.17 kB
TypeScript
import type * as pdfApiTypes from 'pdfjs-dist/types/src/display/api';
import type { NormalizedPdfToPngOptions } from './normalizePdfToPngOptions.js';
/**
* Maps a fully-validated `NormalizedPdfToPngOptions` to a pdfjs `DocumentInitParameters`.
*
* Starts from `DOCUMENT_INIT_PARAMS_DEFAULTS` (cMap paths and standard font data URL) and
* overlays the following fields. Because the caller has already run all defaulting through
* `normalizePdfToPngOptions`, this mapper performs **no** fallback resolution — it is a pure
* field rename:
*
* - `verbosityLevel` → `verbosity`
* - `disableFontFace` → `disableFontFace`
* - `useSystemFonts` → `useSystemFonts`
* - `enableXfa` → `enableXfa`
* - `pdfFilePassword` → `password`
*
* The cMap and standard-font asset paths are resolved at call time so that any
* `process.chdir()` between import and invocation is correctly reflected.
*
* @param opts - Already-normalized options.
* @returns A `DocumentInitParameters` object ready to be passed to pdfjs `getDocument()`.
*/
export declare function propsToPdfDocInitParams(opts: NormalizedPdfToPngOptions): pdfApiTypes.DocumentInitParameters;