Commit 82754571 authored by wanglei's avatar wanglei

...

parent 7498a828
......@@ -54,9 +54,9 @@ object PdfBoxUtils {
fun checkPdfEncryption(filePath: String = "", uri: String? = null): Int {
var state = 0
var pdfDocument: PDDocument? = null
try {
val pdfDocument = loadPDDocument(filePath, null, uri)
pdfDocument = loadPDDocument(filePath, null, uri)
pdfDocument.use { document ->
if (document.isEncrypted) {
println("The PDF is encrypted.")
......@@ -81,6 +81,8 @@ object PdfBoxUtils {
} catch (e: IOException) {
e.printStackTrace()
state = 1
} finally {
pdfDocument?.close()
}
return state
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment