Skip to content

Commit 390b4e6

Browse files
Update and rename pdf2htmlEX-exe preparation patch
1 parent 3ba1bd2 commit 390b4e6

1 file changed

Lines changed: 16 additions & 7 deletions

File tree

dependency-builder/src/main/cpp/packages/pdf2htmlEX-Patch-Source-pdf2htmlEX-set-return-values-in-exe-instead-of-throwing-exceptions.patch renamed to dependency-builder/src/main/cpp/packages/pdf2htmlEX-Patch-Source-prepare-exe-for-android-wrapper.patch

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
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 @@
1+
--- src/pdf2htmlEX.cc 2020-06-08 17:39:30.027000000 +0300
2+
+++ src/pdf2htmlEX.cc 2020-06-08 18:46:17.304000000 +0300
3+
@@ -25,6 +25,8 @@
4+
5+
#include "pdf2htmlEX-config.h"
6+
7+
+#include "poppler/ErrorCodes.h"
8+
+
9+
#if ENABLE_SVG
10+
#include <cairo.h>
11+
#endif
12+
@@ -406,14 +408,25 @@
413
}
514

615
if (!doc->isOk())
716
- throw "Cannot read the file";
817
+ {
918
+ int errCode = doc->getErrorCode();
10-
+ std::cerr << std::to_string(errCode) << std::endl;
19+
+ std::cerr << "Cannot read the file. " << std::to_string(errCode) << std::endl;
1120
+ if (errCode == errEncrypted) {
1221
+ return 2;
1322
+ } else {
@@ -18,11 +27,11 @@
1827
// check for copy permission
1928
if (!doc->okToCopy())
2029
{
21-
- if (param.no_drm == 0)
30+
+ std::cerr << "Document has copy-protection bit set." << std::endl;
31+
if (param.no_drm == 0)
2232
- throw "Copying of text from this document is not allowed.";
2333
- 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) {
34+
+ {
2635
+ std::cerr << "Copying of text from this document is not allowed." << std::endl;
2736
+ return 3;
2837
+ }

0 commit comments

Comments
 (0)