|
@@ -1065,6 +1065,8 @@ class CPDFWorker {
|
|
|
Module._LoadDocumentByStream(importDoc, length, buffer.length, passwordPtr)
|
|
|
const pagesCount = Module._GetPageCount(importDoc)
|
|
|
let importRange
|
|
|
+ let hasZero = false
|
|
|
+
|
|
|
if (range === 'all') {
|
|
|
importRange = '1-' + pagesCount
|
|
|
// importRange = ''
|
|
@@ -1081,6 +1083,7 @@ class CPDFWorker {
|
|
|
parts.forEach(part => {
|
|
|
if (part.includes('-')) {
|
|
|
let [start, end] = part.split('-').map(num => parseInt(num))
|
|
|
+ if (start <= 0) hasZero = true
|
|
|
if (start > max) {
|
|
|
return
|
|
|
} else if (end > max) {
|
|
@@ -1089,6 +1092,7 @@ class CPDFWorker {
|
|
|
result.push((start === max) ? start.toString() : `${start}-${end}`)
|
|
|
} else {
|
|
|
let num = parseInt(part)
|
|
|
+ if (num <= 0) hasZero = true
|
|
|
if (num <= max) {
|
|
|
result.push(num.toString())
|
|
|
}
|
|
@@ -1097,7 +1101,7 @@ class CPDFWorker {
|
|
|
importRange = result.join(',')
|
|
|
}
|
|
|
// console.log('导入文档的页面范围:' + importRange)
|
|
|
- if (!importRange) return 0
|
|
|
+ if (!importRange || hasZero) return 0
|
|
|
|
|
|
importRange = stringToNewUTF8(importRange)
|
|
|
|