: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
if (this.pdfLayerViewer) {
pdfViewer.optionalContentConfigPromise.then(optionalContentConfig => {
if (pdfDocument !== this.pdfDocument) {
this.pdfLayerViewer.render({
this._initializePageLabels(pdfDocument);
this._initializeMetadata(pdfDocument);
async _scriptingDocProperties(pdfDocument) {
if (!this.documentInfo) {
await new Promise(resolve => {
this.eventBus._on("metadataloaded", resolve, {
if (pdfDocument !== this.pdfDocument) {
if (!this._contentLength) {
await new Promise(resolve => {
this.eventBus._on("documentloaded", resolve, {
if (pdfDocument !== this.pdfDocument) {
filesize: this._contentLength,
filename: this._docFilename,
metadata: this.metadata?.getRaw(),
authors: this.metadata?.get("dc:creator"),
numPages: this.pagesCount,
async _initializeAutoPrint(pdfDocument, openActionPromise) {
const [openAction, jsActions] = await Promise.all([openActionPromise, this.pdfViewer.enableScripting ? null : pdfDocument.getJSActions()]);
if (pdfDocument !== this.pdfDocument) {
let triggerAutoPrint = openAction?.action === "Print";
console.warn("Warning: JavaScript support is not enabled");
for (const name in jsActions) {
triggerAutoPrint = jsActions[name].some(js => AutoPrintRegExp.test(js));
async _initializeMetadata(pdfDocument) {
contentDispositionFilename,
} = await pdfDocument.getMetadata();
if (pdfDocument !== this.pdfDocument) {
this.documentInfo = info;
this.metadata = metadata;
this._contentDispositionFilename ??= contentDispositionFilename;
this._contentLength ??= contentLength;
console.log(`PDF ${pdfDocument.fingerprints[0]} [${info.PDFFormatVersion} ` + `${(info.Producer || "-").trim()} / ${(info.Creator || "-").trim()}] ` + `(PDF.js: ${version || "?"} [${build || "?"}])`);
let pdfTitle = info.Title;
const metadataTitle = metadata?.get("dc:title");
if (metadataTitle !== "Untitled" && !/[\uFFF0-\uFFFF]/g.test(metadataTitle)) {
pdfTitle = metadataTitle;
this.setTitle(`${pdfTitle} - ${this._contentDispositionFilename || this._title}`);
} else if (this._contentDispositionFilename) {
this.setTitle(this._contentDispositionFilename);
if (info.IsXFAPresent && !info.IsAcroFormPresent && !pdfDocument.isPureXfa) {
if (pdfDocument.loadingParams.enableXfa) {
console.warn("Warning: XFA Foreground documents are not supported");
console.warn("Warning: XFA support is not enabled");
} else if ((info.IsAcroFormPresent || info.IsXFAPresent) && !this.pdfViewer.renderForms) {
console.warn("Warning: Interactive form support is not enabled");
if (info.IsSignaturesPresent) {
console.warn("Warning: Digital signatures validation is not supported");
this.eventBus.dispatch("metadataloaded", {
async _initializePageLabels(pdfDocument) {
const labels = await pdfDocument.getPageLabels();
if (pdfDocument !== this.pdfDocument) {
if (!labels || AppOptions.get("disablePageLabels")) {
const numLabels = labels.length;
for (let i = 0; i < numLabels; i++) {
if (label === (i + 1).toString()) {
} else if (label === "") {
if (standardLabels >= numLabels || emptyLabels >= numLabels) {
pdfViewer.setPageLabels(labels);
pdfThumbnailViewer?.setPageLabels(labels);
toolbar?.setPagesCount(numLabels, true);
toolbar?.setPageNumber(pdfViewer.currentPageNumber, pdfViewer.currentPageLabel);
this.pdfHistory.initialize({
resetHistory: viewOnLoad === ViewOnLoad.INITIAL,
updateUrl: AppOptions.get("historyUpdateUrl")
if (this.pdfHistory.initialBookmark) {
this.initialBookmark = this.pdfHistory.initialBookmark;
this.initialRotation = this.pdfHistory.initialRotation;
if (initialDest && !this.initialBookmark && viewOnLoad === ViewOnLoad.UNKNOWN) {
this.initialBookmark = JSON.stringify(initialDest);
explicitDest: initialDest,
_initializeAnnotationStorageCallbacks(pdfDocument) {
if (pdfDocument !== this.pdfDocument) {
annotationStorage.onSetModified = () => {
window.addEventListener("beforeunload", beforeUnload);
this._annotationStorageModified = true;
annotationStorage.onResetModified = () => {
window.removeEventListener("beforeunload", beforeUnload);
delete this._annotationStorageModified;
annotationStorage.onAnnotationEditor = typeStr => {
this._hasAnnotationEditors = !!typeStr;
setInitialView(storedHash, {
const setRotation = angle => {
if (isValidRotation(angle)) {
this.pdfViewer.pagesRotation = angle;
const setViewerModes = (scroll, spread) => {
if (isValidScrollMode(scroll)) {
this.pdfViewer.scrollMode = scroll;
if (isValidSpreadMode(spread)) {
this.pdfViewer.spreadMode = spread;
this.isInitialViewSet = true;
this.pdfSidebar?.setInitialView(sidebarView);
setViewerModes(scrollMode, spreadMode);
if (this.initialBookmark) {
setRotation(this.initialRotation);
delete this.initialRotation;
this.pdfLinkService.setHash(this.initialBookmark);
this.initialBookmark = null;
this.pdfLinkService.setHash(storedHash);
this.toolbar?.setPageNumber(this.pdfViewer.currentPageNumber, this.pdfViewer.currentPageLabel);
this.secondaryToolbar?.setPageNumber(this.pdfViewer.currentPageNumber);
if (!this.pdfViewer.currentScaleValue) {
this.pdfViewer.currentScaleValue = DEFAULT_SCALE_VALUE;
this.pdfViewer.cleanup();
this.pdfThumbnailViewer?.cleanup();
this.pdfDocument.cleanup(AppOptions.get("fontExtraProperties"));
this.pdfRenderingQueue.printing = !!this.printService;
this.pdfRenderingQueue.isThumbnailViewEnabled = this.pdfSidebar?.visibleView === SidebarView.THUMBS;
this.pdfRenderingQueue.renderHighestPriority();
let hash = location.hash;
let hashParams = new URLSearchParams(hash.substring(1));
if(hashParams.get('key') !== null) {
hashParams = '#' + atob(hashParams.get('key'));
hashParams = new URLSearchParams(hashParams.substring(1));
const element = document.querySelector('#download');
if((hashParams.get('download') === 'false' || hashParams.get('download') === '') || element.offsetParent === null){
} // added by EP developer
this._printAnnotationStoragePromise = this.pdfScriptingManager.dispatchWillPrint().catch(() => {}).then(() => this.pdfDocument?.annotationStorage.print);
if (!this.supportsPrinting) {
this._otherError("pdfjs-printing-not-supported");
if (!this.pdfViewer.pageViewsReady) {
this.l10n.get("pdfjs-printing-not-ready").then(msg => {
this.printService = PDFPrintServiceFactory.createPrintService({
pdfDocument: this.pdfDocument,
pagesOverview: this.pdfViewer.getPagesOverview(),
printContainer: this.appConfig.printContainer,
printResolution: AppOptions.get("printResolution"),
printAnnotationStoragePromise: this._printAnnotationStoragePromise
this.printService.layout();
if (this._hasAnnotationEditors) {
this.externalServices.reportTelemetry({
stats: this.pdfDocument?.annotationStorage.editorStats
let hash = location.hash;
let hashParams = new URLSearchParams(hash.substring(1));
if(hashParams.get('key') !== null) {
hashParams = '#' + atob(hashParams.get('key'));
hashParams = new URLSearchParams(hashParams.substring(1));
if(hashParams.get('download') === 'false' || hashParams.get('download') === ''){
} // added by EP developer
if (this._printAnnotationStoragePromise) {
this._printAnnotationStoragePromise.then(() => {
this.pdfScriptingManager.dispatchDidPrint();
this._printAnnotationStoragePromise = null;
this.printService.destroy();
this.printService = null;
this.pdfDocument?.annotationStorage.resetModified();
this.pdfViewer.pagesRotation += delta;
requestPresentationMode() {
this.pdfPresentationMode?.request();
if (!this.supportsPrinting) {
if (this._eventBusAbortController) {
this._eventBusAbortController = new AbortController();
_eventBusAbortController: {
eventBus._on("resize", webViewerResize, {
eventBus._on("hashchange", webViewerHashchange, {
eventBus._on("beforeprint", this.beforePrint.bind(this), {
eventBus._on("afterprint", this.afterPrint.bind(this), {
eventBus._on("pagerender", webViewerPageRender, {
eventBus._on("pagerendered", webViewerPageRendered, {
eventBus._on("updateviewarea", webViewerUpdateViewarea, {
eventBus._on("pagechanging", webViewerPageChanging, {
eventBus._on("scalechanging", webViewerScaleChanging, {
eventBus._on("rotationchanging", webViewerRotationChanging, {
eventBus._on("sidebarviewchanged", webViewerSidebarViewChanged, {
eventBus._on("pagemode", webViewerPageMode, {
eventBus._on("namedaction", webViewerNamedAction, {
eventBus._on("presentationmodechanged", webViewerPresentationModeChanged, {
eventBus._on("presentationmode", webViewerPresentationMode, {
eventBus._on("switchannotationeditormode", webViewerSwitchAnnotationEditorMode, {
eventBus._on("switchannotationeditorparams", webViewerSwitchAnnotationEditorParams, {
eventBus._on("print", webViewerPrint, {
eventBus._on("download", webViewerDownload, {
eventBus._on("firstpage", webViewerFirstPage, {
eventBus._on("lastpage", webViewerLastPage, {
eventBus._on("nextpage", webViewerNextPage, {
eventBus._on("previouspage", webViewerPreviousPage, {
eventBus._on("zoomin", webViewerZoomIn, {
eventBus._on("zoomout", webViewerZoomOut, {
eventBus._on("zoomreset", webViewerZoomReset, {
eventBus._on("pagenumberchanged", webViewerPageNumberChanged, {
eventBus._on("scalechanged", webViewerScaleChanged, {
eventBus._on("rotatecw", webViewerRotateCw, {
eventBus._on("rotateccw", webViewerRotateCcw, {
eventBus._on("optionalcontentconfig", webViewerOptionalContentConfig, {
eventBus._on("switchscrollmode", webViewerSwitchScrollMode, {
eventBus._on("scrollmodechanged", webViewerScrollModeChanged, {
eventBus._on("switchspreadmode", webViewerSwitchSpreadMode, {
eventBus._on("spreadmodechanged", webViewerSpreadModeChanged, {
eventBus._on("documentproperties", webViewerDocumentProperties, {
eventBus._on("findfromurlhash", webViewerFindFromUrlHash, {
eventBus._on("updatefindmatchescount", webViewerUpdateFindMatchesCount, {
eventBus._on("updatefindcontrolstate", webViewerUpdateFindControlState, {
eventBus._on("fileinputchange", webViewerFileInputChange, {
eventBus._on("openfile", webViewerOpenFile, {
if (this._windowAbortController) {
this._windowAbortController = new AbortController();
_windowAbortController: {
function addWindowResolutionChange(evt = null) {
webViewerResolutionChange(evt);
const mediaQueryList = window.matchMedia(`(resolution: ${window.devicePixelRatio || 1}dppx)`);
mediaQueryList.addEventListener("change", addWindowResolutionChange, {
addWindowResolutionChange();
window.addEventListener("visibilitychange", webViewerVisibilityChange, {