Skip to content

Commit e462de7

Browse files
[pdf2htmlEX_exe] Use the same return values as JNI version is using.
1 parent cecabd3 commit e462de7

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
--- pdf2htmlEX.cc 2020-06-08 17:39:30.027000000 +0300
2+
+++ pdf2htmlEX.cc 2020-06-08 17:55:56.809000000 +0300
3+
@@ -406,14 +406,24 @@
4+
}
5+
6+
if (!doc->isOk())
7+
- throw "Cannot read the file";
8+
+ {
9+
+ int errCode = doc->getErrorCode();
10+
+ std::cerr << std::to_string(errCode) << std::endl;
11+
+ if (errCode == errEncrypted) {
12+
+ return 2;
13+
+ } else {
14+
+ return 1;
15+
+ }
16+
+ }
17+
18+
// check for copy permission
19+
if (!doc->okToCopy())
20+
{
21+
- if (param.no_drm == 0)
22+
- throw "Copying of text from this document is not allowed.";
23+
- cerr << "Document has copy-protection bit set." << endl;
24+
+ std::cerr << "Document has copy-protection bit set." << std::endl;
25+
+ if (param->no_drm == 0) {
26+
+ std::cerr << "Copying of text from this document is not allowed." << std::endl;
27+
+ return 3;
28+
+ }
29+
}
30+
31+
param.first_page = min<int>(max<int>(param.first_page, 1), doc->getNumPages());

0 commit comments

Comments
 (0)