Default Options
Overriding Options
You can fine-tune the behavior of the PDF viewer by modifying the default options. Most options are very advanced or covered by regular attributes of <ngx-extended-pdf-viewer />
, so use the options at your own risk.
TypeScript
import { pdfDefaultOptions } from 'ngx-extended-pdf-viewer';
@Component({ ... })
export class DefaultOptionsComponent {
constructor() {
pdfDefaultOptions.assetsFolder = 'bleeding-edge';
}
}
Available Options
Below you find an interactive list of all available options.
enableHWA | Enable hardware acceleration. The default value is true . If you're running into rendering issues, try setting this flag to false . Note that this flag is only available in pdf.js 4.4 and above, and that it's the exact opposite of the flag activateWillReadFrequentlyFlag that has been removed in version 21. | |
assetsFolder | URL of the assets folder (relative to the index.html ). Changing this attribute modifies the value of the default options cMapUrl and workerSrc . | |
annotationEditorMode | ||
annotationMode | Setting this flag to 0 disables forms. | |
defaultZoomDelay | When you zoom a page using a pinch gesture, it's initially zoomed using fast but inaccurate CSS. After the defaultZoomDelay , the page is re-rendered. The default is 400 milliseconds. | |
cursorToolOnLoad | What happens when you click and move the mouse while keeping the mouse button pressed?
| |
disablePageLabels | Ignore the page numbers defined by the author of the PDF file; default value: false | |
disableHistory | Stop storing the user settings of PDF files; default value: false . Note that this flag does something different from in pdf.js. With ngx-extended-pdf-viewer, it disables using the LocalStore entirely. | |
enablePermissions | Evaluate the permission granted by the author of the PDF file; currently only the "copy" permission is implemented; default value: false | |
enablePrintAutoRotate | Rotates landscape page to portrait page when printing; default value: true | |
externalLinkRel | Specifies the rel attribute for external links. Defaults to stripping the referrer | |
externalLinkTarget | Documented here | |
ignoreDestinationZoom | Ignore the zoom argument in the destination array. Among other things, this flag is useful if the PDF author has added the zoom factor to the table of contents. You can see this in the "simple demo": each time you click an entry of the table of contents, the zoom is set to "page fit". Setting ignoreDestinationZoom=true prevents this. The default value is false . | |
imageResourcesPath | Path for image resources, mainly for annotation icons. Include trailing slash | |
locale | Allows you to set the default language of the pdf viewer. However, the recommended way to do this in ngx-extended-pdf-viewer is using the attribute [language]="'pl'" . | |
maxCanvasPixels | The maximum supported canvas size in total pixels, i.e. width * height. Use -1 for no limit. The default value is 4096 * 4096 (16 mega-pixels). The canvas size is also limited by your browser. | |
forcePageColors | Not supported by ngx-extended-pdf-viewer | |
pageColorsBackground | Not supported by ngx-extended-pdf-viewer | |
pageColorsForeground | Not supported by ngx-extended-pdf-viewer | |
rangeChunkSize | Let's you fine-tune page-loading by defining the size of the chunks that are loaded. The default value is 65536 bytes. Modify this setting only when you know what you're doing. | |
cMapPacked | Specifies if the Adobe CMaps are binary packed or not; the default value is true | |
cMapUrl | URL of the CMap files; ngx-extended-pdf-viewer ships with the CMap files, so usually you can stick with the default value. Change this value if your application doesn't run in the root folder. More precisely, ngx-extended-pdf-viewer computes the URL automatically from the default option assetsFolder , so in general it's better to modify assetsFolder . | |
disableAutoFetch | Caveat: this feature seems to be broken. Disable pre-fetching of PDF file data. When range requests are enabled PDF.js will automatically keep fetching more data even if it isn't needed to display the current page. The default value is false . NOTE: It is also necessary to disable streaming, see below, in order for disabling of pre-fetching to work correctly. | |
disableFontFace | 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 . | |
disableRange | Caveat: this feature seems to be broken. Disable range request loading of PDF files. When enabled, and if the server supports partial content requests, then the PDF will be fetched in chunks. The default value is false . | |
disableStream | Disable streaming of PDF file data. By default, PDF.js attempts to load PDF files in chunks. The default value is false . | |
docBaseUrl | The base URL used when a link or an outline item uses a relative URL. These elements are supposed to use absolute URLs, but if they don't, use docBaseUrl as a work-around. | |
fontExtraProperties | Include additional properties, which are unused during rendering of PDF documents, when exporting the parsed font data from the worker-thread. This may be useful for debugging purposes (and backwards compatibility), but note that it will lead to increased memory usage. The default value is false . | |
isEvalSupported | Determines if we can evaluate strings as JavaScript. Primarily used to improve performance of font rendering, and when parsing PDF functions. The default value is true . | |
maxImageSize | The maximum allowed image size in total pixels, i.e. width * height. Images above this value will not be rendered. Use -1 for no limit, which is also the default value. Note that the browser also limits the image size. ngx-extended-pdf-viewer tries to reduce the size of images that are larger than the browser allows, but this doesn't always work. | |
scrollModeOnLoad | Default scroll direction:
| |
viewOnLoad | Tries to restore the settings of the last PDF file; almost every setting is overwritten by the attributes of ngx-extended-pdf-viewer, so viewOnLoad is probably useless.
| |
workerPort | Port of the URL of the worker.min.js file; used in combination with workerSrc ; you don't need this option because the library is bundled with and loaded by ngx-extended-pdf-viewer | |
workerSrc | URL of the worker file. By default, it's ./assets/pdf.worker-x.y.z.min.js . You can modify this option if your worker file is at a different location or if the resolution of the relative path doesn't work for some reason. This value can either be a string or a lambda. The default implementation takes pdfDefaultOptions.assetsFolder , [minifiedJSLibraries] , and [forceUsingLegacyES5] into account to determine the path. | minifiedJSLibraries and assetsFolder |
doubleTapZoomFactor | Tapping twice (or clicking twice) on a PDF file enlarges it. By default, the target zoom is "page-width" . You can use this attribute to use a different zoom factor, such as "150%" . | |
doubleTapZoomsInHandMode | By default, this toggle activates the double-tap zoom feature in hand mode. Set it to false to deactivate it. | |
doubleTapZoomsInTextSelectionMode | By default, this toggle deactivates the double-tap zoom feature in hand mode. Set it to true to activate it. | |
doubleTapResetsZoomOnSecondDoubleTap | By default, the second double-tap doesn't do anything. Setting this toggle to true causes the double-tap to toggle between an enlarged scale and the previous scale. | |
enableXfa | Enables support for XFA forms. Since pdf.js 2.11, this feature is active by default. | |
defaultCacheSize | Maximum number of rendered pages. Reducing this number may help you if you're running on tight memory requirements. By default, ngx-extended-pdf-viewer keeps up to 50 pages in memory. | |
defaultUrl | Covered by [src] | [src] |
defaultZoomValue | Covered by [zoom] | [zoom] |
printResolution | Covered by [printResolution] | [printResolution] |
sidebarViewOnLoad | Covered by [sidebarVisible] | [sidebarVisible] |
spreadModeOnLoad | Covered by [spread] | [spread] |
textLayerMode | Covered by [textLayer] | [textLayer] |
verbosity | Covered by [logLevel] | [logLevel] |