添加pdf.js
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
+41660
File diff suppressed because it is too large
Load Diff
+1
File diff suppressed because one or more lines are too long
@@ -0,0 +1,128 @@
|
||||
let DEFAULT_URL = ''
|
||||
let url = decodeURIComponent(window.location.search)
|
||||
let attIdIndex = url.indexOf('&fileId=')
|
||||
let typeIndex = url.indexOf('?sarType=')
|
||||
let numberIndex = url.indexOf('&pageNumber=')
|
||||
let attId = ''
|
||||
let sarType = 'INLAND_STAND'
|
||||
let pageNumber = 1
|
||||
let pageCount = 1
|
||||
let fileId = ''
|
||||
let queryAttUrl = '/api/lawss/sarStandFile/queryConvertAtt'
|
||||
if (attIdIndex > -1) {
|
||||
attId = url.substring(attIdIndex + 8, url.length)
|
||||
pageNumber = url.substring(numberIndex + 12, attIdIndex)
|
||||
sarType = url.substring(typeIndex + 9, numberIndex)
|
||||
if (sarType === 'INLAND_LAWS' || sarType === 'FOREIGN_LAWS') {
|
||||
queryAttUrl = '/api/lawss/sarLawsFile/queryConvertAtt'
|
||||
} else if (sarType === 'BUSS') {
|
||||
queryAttUrl = '/api/lawss/sarBussStandFile/queryConvertAtt'
|
||||
}
|
||||
$.ajax({
|
||||
url: queryAttUrl,
|
||||
async: false,
|
||||
type: 'GET',
|
||||
data: {
|
||||
attId: attId
|
||||
},
|
||||
success: function (res) {
|
||||
// res = JSON.parse(res)
|
||||
if (res.data != null) {
|
||||
pageCount = res.data.pageCount
|
||||
if (res.data.fileOldName !== null && res.data.fileOldName !== undefined) {
|
||||
document.title = res.data.fileOldName + '-在线查看'
|
||||
}
|
||||
// $('#pageCount').html(res.data.pageCount)
|
||||
fileId = res.data.id
|
||||
getFileInfo()
|
||||
} else {
|
||||
alert('文档未转换成功或本地读取不到该文档')
|
||||
}
|
||||
},
|
||||
error: function (data) {
|
||||
alert('文档未转换成功或本地读取不到该文档')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// document.onkeydown = function () {
|
||||
// var e = window.event || arguments[0]
|
||||
// if (e.keyCode === 123) {
|
||||
// return false
|
||||
// } else if (e.ctrlKey || e.keyCode === 73) {
|
||||
// return false
|
||||
// }
|
||||
// }
|
||||
// document.oncontextmenu = function () {
|
||||
// return false
|
||||
// }
|
||||
|
||||
function getFileInfo () {
|
||||
$.ajax({
|
||||
url: '/api/lawss/sarFileInfo/getPdfFileInfo',
|
||||
async: false,
|
||||
type: 'GET',
|
||||
data: {
|
||||
sarFileId: fileId,
|
||||
filePageNumber: pageNumber
|
||||
},
|
||||
success: function (res) {
|
||||
res = JSON.parse(res)
|
||||
if (res.data != null) {
|
||||
if (res.data.fileInfo != null) {
|
||||
let data = res.data.fileInfo
|
||||
let resultFileMsg = data.substring(30, data.length - 50)
|
||||
resultFileMsg = resultFileMsg.replace(/\*/g, 'A')
|
||||
let password = res.data.filePwd
|
||||
sessionStorage.setItem('fileInfoSteam', password)
|
||||
writeFile(resultFileMsg)
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function (data) {
|
||||
alert('文档未转换成功或本地读取不到该文档')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function writeFile (data) {
|
||||
var BASE64_MARKER = ';base64,' // 声明文件流编码格式
|
||||
var pdfAsDataUri = data
|
||||
var pdfAsArray = convertDataURIToBinary(pdfAsDataUri)
|
||||
DEFAULT_URL = pdfAsArray
|
||||
if (Number(pageCount) > 1) {
|
||||
if (Number(pageNumber) === 1 && Number(pageNumber) !== Number(pageCount)) {
|
||||
$('#upLoadingFile').hide()
|
||||
$('#downLoadingFile').show()
|
||||
} else if (Number(pageNumber) !== 1 && Number(pageNumber) !== Number(pageCount)) {
|
||||
$('#upLoadingFile').show()
|
||||
$('#downLoadingFile').show()
|
||||
} else {
|
||||
$('#upLoadingFile').hide()
|
||||
$('#downLoadingFile').hide()
|
||||
}
|
||||
} else {
|
||||
$('#upLoadingFile').hide()
|
||||
$('#downLoadingFile').hide()
|
||||
}
|
||||
}
|
||||
|
||||
function clickLoadFile (type) {
|
||||
if (type === 'up') {
|
||||
pageNumber = Number(pageNumber) - Number(1)
|
||||
} else {
|
||||
pageNumber = Number(pageNumber) + Number(1)
|
||||
}
|
||||
window.location.href = '/static/pdf/web/viewer.html?sarType=' + sarType + '&pageNumber=' + pageNumber + '&fileId=' + encodeURIComponent(attId)
|
||||
}
|
||||
|
||||
function convertDataURIToBinary (dataURI) {
|
||||
var raw = window.atob(dataURI) // 这个方法在ie内核下无法正常解析。
|
||||
var rawLength = raw.length
|
||||
// 转换成pdf.js能直接解析的Uint8Array类型
|
||||
var array = new Uint8Array(new ArrayBuffer(rawLength))
|
||||
for (let i = 0; i < rawLength; i++) {
|
||||
array[i] = raw.charCodeAt(i)
|
||||
}
|
||||
return array
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,3 @@
|
||||
àRCopyright 1990-2009 Adobe Systems Incorporated.
|
||||
All rights reserved.
|
||||
See ./LICENSEáCNS2-H
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,3 @@
|
||||
àRCopyright 1990-2009 Adobe Systems Incorporated.
|
||||
All rights reserved.
|
||||
See ./LICENSEá ETen-B5-H` ^
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,4 @@
|
||||
àRCopyright 1990-2009 Adobe Systems Incorporated.
|
||||
All rights reserved.
|
||||
See ./LICENSE!!�º]aX!!]`�21�> �p�z�$]‚�"R‚d�-Uƒ7�*„␍4„%�+ „Z „{�/…%…<�9K…b�1]†.�"‡‰`]‡,�"]ˆ
|
||||
�"]ˆh�"]‰F�"]Š$�"]‹�"]‹`�"]Œ>�"]��"]�z�"]ŽX�"]�6�"]��"]�r�"]‘P�"]’.�"]“�"]“j�"]”H�"]•&�"]–�"]–b�"]—@�"]˜�"]˜|�"]™Z�"]š8�"]›�"]›t�"]œR�"]�0�"]ž�"]žl�"]ŸJ�"] (�"]¡�"]¡d�"]¢B�"]£ �"X£~�']¤W�"]¥5�"]¦�"]¦q�"]§O�"]¨-�"]©�"]©i�"]ªG�"]«%�"]¬�"]¬a�"]?�"]®�"]®{�"]¯Y�"]°7�"]±�"]±s�"]²Q�"]³/�"]´␍�"]´k�"]µI�"]¶'�"]·�"]·c�"]¸A�"]¹�"]¹}�"]º[�"]»9
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user