pdfjs-自定义title
This commit is contained in:
@@ -686,7 +686,32 @@ const PDFViewerApplication = {
|
|||||||
title = url;
|
title = url;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.setTitle(title);
|
// 自定义title - (源码) - 开始(1/3)
|
||||||
|
// this.setTitle(title);
|
||||||
|
// 自定义title - (源码) - 结束(1/3)
|
||||||
|
|
||||||
|
// 自定义title - (修改代码) - 开始(2/3)
|
||||||
|
var fileName = '';
|
||||||
|
var fileUrlId = '';
|
||||||
|
var url = decodeURIComponent(window.location.search);
|
||||||
|
var attIdIndex = url.indexOf('ATT_FILE');
|
||||||
|
if (attIdIndex > -1) {
|
||||||
|
fileUrlId = url.substring(attIdIndex, url.length);
|
||||||
|
if (fileUrlId != null && fileUrlId !== '' && sessionStorage.getItem('fileInfo')) {
|
||||||
|
let fileList = JSON.parse(sessionStorage.getItem('fileInfo'))
|
||||||
|
if (fileList != null && fileList.length > 0) {
|
||||||
|
for (var i = 0; i < fileList.length; i++) {
|
||||||
|
// console.log("huoqu:" + fileList[i].fileId)
|
||||||
|
if (fileList[i].fileId === fileUrlId) {
|
||||||
|
fileName = fileList[i].fileName + '-'
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.setTitle(fileName + '在线查看');
|
||||||
|
// 自定义title - (修改代码) - 结束(2/3)
|
||||||
},
|
},
|
||||||
setTitle(title = this._title) {
|
setTitle(title = this._title) {
|
||||||
this._title = title;
|
this._title = title;
|
||||||
@@ -1168,11 +1193,13 @@ const PDFViewerApplication = {
|
|||||||
pdfTitle = metadataTitle;
|
pdfTitle = metadataTitle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pdfTitle) {
|
// 自定义title - (源码) - 开始(3/3)
|
||||||
this.setTitle(`${pdfTitle} - ${this._contentDispositionFilename || this._title}`);
|
// if (pdfTitle) {
|
||||||
} else if (this._contentDispositionFilename) {
|
// this.setTitle(`${pdfTitle} - ${this._contentDispositionFilename || this._title}`);
|
||||||
this.setTitle(this._contentDispositionFilename);
|
// } else if (this._contentDispositionFilename) {
|
||||||
}
|
// this.setTitle(this._contentDispositionFilename);
|
||||||
|
// }
|
||||||
|
// 自定义title - (源码) - 结束(3/3)
|
||||||
if (info.IsXFAPresent && !info.IsAcroFormPresent && !pdfDocument.isPureXfa) {
|
if (info.IsXFAPresent && !info.IsAcroFormPresent && !pdfDocument.isPureXfa) {
|
||||||
if (pdfDocument.loadingParams.enableXfa) {
|
if (pdfDocument.loadingParams.enableXfa) {
|
||||||
console.warn("Warning: XFA Foreground documents are not supported");
|
console.warn("Warning: XFA Foreground documents are not supported");
|
||||||
|
|||||||
Reference in New Issue
Block a user