Skip to content

Commit 7fbb2c1

Browse files
rchennafimyang-apryseoveroceanbcldemjensimoncrowfoot
authored
Update master to 11.6 (#167)
* Added TaggingOptions for AnnotInsertWithTagging (#161) * [Samples] Update the TimestampAndEnableLTV test in DigitalSignaturesTest to use the correct root certificate of the timestamping signature. * Updates Python to use Py_LIMITED for supporting universal Python 3 builds. (#164) * Fix issue with CMake syntax. * Expose the iceni find replace functionality api (CI-1352) (#165) --------- Co-authored-by: myang-apryse <michael.yang@apryse.com> Co-authored-by: Dan Chen <7284050+overocean@users.noreply.github.com> Co-authored-by: Tamas Demjen <tdemjen@apryse.com> Co-authored-by: simoncrowfoot <75724490+simoncrowfoot@users.noreply.github.com>
1 parent f87dfc0 commit 7fbb2c1

File tree

126 files changed

+322
-850
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+322
-850
lines changed

CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,14 @@
33
# Consult LICENSE.txt for licensing information.
44
#-----------------------------------------------------------------------------------------------------------------------
55

6+
if(CMAKE_MAJOR_VERSION VERSION_EQUAL "4")
7+
cmake_minimum_required(VERSION 3.10)
8+
else()
9+
# for android builds
10+
cmake_minimum_required(VERSION 3.4)
11+
endif()
12+
613
project(PDFNetLanguageBindings CXX)
7-
cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
814

915
set(CUSTOM_SWIG CACHE STRING "")
1016
set(BUILD_PDFNetPython OFF CACHE BOOL "Build PDFNet language bindings for Python.")

PDFNetPHP/PDFNetPHP.i

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,8 @@
193193
#include "PDF/BarcodeModule.h"
194194
#include "PDF/TransPDFOptions.h"
195195
#include "PDF/TransPDF.h"
196+
#include "PDF/FindReplaceOptions.h"
197+
#include "PDF/FindReplace.h"
196198
#include "PDF/Optimizer.h"
197199
#include "PDF/Page.h"
198200
#include "PDF/PageLabel.h"
@@ -237,6 +239,7 @@
237239
#include "PDF/Stamper.h"
238240
#include "PDF/TextExtractor.h"
239241
#include "PDF/TextSearch.h"
242+
#include "PDF/TaggingOptions.h"
240243
#include "PDF/WebFontDownloader.h"
241244

242245
// header files in /PDFNetC/Headers/SDF
@@ -1071,6 +1074,7 @@ namespace pdftron {
10711074
%include "PDF/PDFDocViewPrefs.h"
10721075
%include "PDF/PDFDocInfo.h"
10731076
%include "PDF/PDFDoc.h"
1077+
%include "PDF/TaggingOptions.h"
10741078

10751079
%include "PDF/Annots.h"
10761080
%include "PDF/Annots/Caret.h"
@@ -1116,6 +1120,8 @@ namespace pdftron {
11161120
%include "PDF/BarcodeModule.h"
11171121
%include "PDF/TransPDFOptions.h"
11181122
%include "PDF/TransPDF.h"
1123+
%include "PDF/FindReplaceOptions.h"
1124+
%include "PDF/FindReplace.h"
11191125
%include "PDF/CADModule.h"
11201126
%include "PDF/AdvancedImagingModule.h"
11211127
%include "PDF/PDF2HtmlReflowParagraphsModule.h"

PDFNetPython/CMakeLists.txt

Lines changed: 16 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -3,51 +3,28 @@
33
# Consult LICENSE.txt for licensing information.
44
#-----------------------------------------------------------------------------------------------------------------------
55

6-
project(PDFNetPython CXX)
7-
cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
8-
9-
find_package(PythonLibs)
6+
cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
107

11-
if (PYTHONLIBS_FOUND)
12-
if ("${PYTHONLIBS_VERSION_STRING}" MATCHES "^2[\\.0-9]*[a-zA-Z0-9\\+]*$")
13-
set(PYTHON_2 ON)
14-
elseif ("${PYTHONLIBS_VERSION_STRING}" MATCHES "^3[\\.0-9]*[a-zA-Z0-9\\+]*$")
15-
set(PYTHON_3 ON)
16-
else ()
17-
message(FATAL_ERROR "Unsupported Python version (Detected: ${PYTHONLIBS_VERSION_STRING}). Please install either Python 2 or Python 3.")
18-
return ()
19-
endif ()
8+
if (APPLE)
9+
set(CMAKE_OSX_ARCHITECTURES arm64 x86_64)
10+
endif()
2011

21-
message(STATUS "Using Python: ${PYTHONLIBS_VERSION_STRING}")
22-
message(STATUS "Python include directory: ${PYTHON_INCLUDE_DIRS}")
23-
message(STATUS "Python library: ${PYTHON_LIBRARY}")
24-
set(PylibInfoOutput ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/PDFNetPyLibInfo )
25-
file(WRITE ${PylibInfoOutput} "Python ${PYTHONLIBS_VERSION_STRING}")
26-
else ()
27-
message(FATAL_ERROR "Cannot find Python libraries, please set the variables specified by the error message then try again.")
28-
return ()
29-
endif ()
12+
project(PDFNetPython CXX)
3013

3114
message(STATUS "Generating sources for Python bindings using swig...")
3215
set(PDFNetPython_SourcesDir ${PROJECT_BINARY_DIR})
3316

34-
if (PYTHON_3 AND ("${SWIG_VERSION}" MATCHES "^2[\\.0-9]*[a-zA-Z0-9\\+]*$"))
35-
message(FATAL_ERROR "Cannot build PYTHON3 wrapper with SWIG2. Please install SWIG 3.0.12 or above and rebuild the wrapper.")
36-
return ()
37-
endif ()
17+
find_package(Python3 REQUIRED COMPONENTS Interpreter Development Development.SABIModule)
3818

39-
set(DOXYGEN "")
40-
if (PYTHON_2)
41-
set(SWIG_DEFINE "-DPYTHON2")
42-
elseif (PYTHON_3)
43-
set(SWIG_DEFINE "-DPYTHON3")
44-
set(DOXYGEN "-doxygen")
45-
endif ()
19+
add_definitions(-DPy_LIMITED_API=0x03040000)
20+
21+
set(SWIG_DEFINE "-DPYTHON3")
22+
set(DOXYGEN "-doxygen")
4623

4724
message(STATUS "-- ${DOXYGEN}")
4825

4926
execute_process(
50-
COMMAND ${SWIG_EXECUTABLE} -c++ -python ${DOXYGEN} ${SWIG_DEFINE} -DPy_LIMITED_API=0x03040000 -DSWIGHIDDEN_SIG -I${PDFNetC_Include_Dir} -outdir ${PDFNetPython_SourcesDir} -o ${PDFNetPython_SourcesDir}/PDFNetPython.cpp -oh ${PDFNetPython_SourcesDir}/PDFNetPython.hpp PDFNetPython.i
27+
COMMAND ${SWIG_EXECUTABLE} -c++ -python ${DOXYGEN} ${SWIG_DEFINE} -DPy_LIMITED_API=0x03040000 -DSWIGHIDDEN_SIG -I${Python3_INCLUDE_DIRS} -I${PDFNetC_Include_Dir} -outdir ${PDFNetPython_SourcesDir} -o ${PDFNetPython_SourcesDir}/PDFNetPython.cpp -oh ${PDFNetPython_SourcesDir}/PDFNetPython.hpp PDFNetPython.i
5128
RESULT_VARIABLE SOURCE_GEN_RESULT
5229
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
5330
)
@@ -71,35 +48,29 @@ add_definitions(
7148

7249
include_directories(
7350
${PDFNetC_Include_Dir}
74-
${PYTHON_INCLUDE_DIRS}
51+
${Python3_INCLUDE_DIRS}
7552
)
7653

7754
# The PDFNetPython project.
7855

7956
if (MSVC)
8057
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj")
81-
set(PYTHON_LINK_LIB ${PYTHON_LIBRARY})
58+
set(PYTHON_LINK_LIB ${Python3_SABI_LIBRARIES})
8259
elseif (MINGW OR MSYS)
83-
set(PYTHON_LINK_LIB ${PYTHON_LIBRARY})
60+
set(PYTHON_LINK_LIB ${Python3_SABI_LIBRARIES})
8461
elseif (UNIX)
8562
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
8663
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fPIC")
8764
if (APPLE)
8865
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-headerpad_max_install_names -lSystem -undefined dynamic_lookup -Wl,-install_name,@rpath/_PDFNetPython.so -Wl,-rpath,/usr/lib -Wl,-rpath,/usr/local/lib -Wl,-rpath,.")
89-
if(BUILD_MACOS_ARM64)
90-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -target arm64-apple-macos11")
91-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -target arm64-apple-macos11")
92-
set(CMAKE_OSX_SYSROOT "/Applications/Xcode_12.3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk")
93-
else(BUILD_MACOS_ARM64)
94-
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk")
95-
endif(BUILD_MACOS_ARM64)
66+
set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk")
9667
else ()
9768
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-rpath,'$ORIGIN'")
9869
endif ()
9970
endif ()
10071

10172
add_library(PDFNetPython MODULE ${PDFNetPython_Sources})
102-
target_link_libraries(PDFNetPython ${PDFNetC_Library} ${PYTHON_LINK_LIB})
73+
target_link_libraries(PDFNetPython ${PDFNetC_Library} ${Python3_SABI_LIBRARIES})
10374

10475
# Python extension naming conventions are:
10576
# - _PDFNetPython.so
@@ -118,10 +89,6 @@ configure_file(${PDFNetPython_SourcesDir}/PDFNetPython.py ${CMAKE_LIBRARY_OUTPUT
11889

11990
# Installation rules
12091

121-
install(
122-
FILES ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/PDFNetPython.py ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/PDFNetPyLibInfo
123-
DESTINATION ${INSTALL_DESTINATION_LIB_DIR}
124-
)
12592
install(
12693
TARGETS PDFNetPython
12794
LIBRARY DESTINATION ${INSTALL_DESTINATION_LIB_DIR}

PDFNetPython/PDFNetPython.i

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@
1616
#ifdef PYTHON2
1717
%include "PDFNetUStringPython2.i"
1818
#endif
19-
#ifdef PYTHON3
19+
2020
%include "PDFNetUStringPython3.i"
21-
#endif
2221

2322
/**
2423
* Catches all exceptions thrown by the C++ wrapper.
@@ -187,6 +186,8 @@
187186
#include "PDF/BarcodeModule.h"
188187
#include "PDF/TransPDFOptions.h"
189188
#include "PDF/TransPDF.h"
189+
#include "PDF/FindReplaceOptions.h"
190+
#include "PDF/FindReplace.h"
190191
#include "PDF/Optimizer.h"
191192
#include "PDF/Page.h"
192193
#include "PDF/PageLabel.h"
@@ -231,6 +232,7 @@
231232
#include "PDF/Stamper.h"
232233
#include "PDF/TextExtractor.h"
233234
#include "PDF/TextSearch.h"
235+
#include "PDF/TaggingOptions.h"
234236
#include "PDF/WebFontDownloader.h"
235237
#include "PDF/PrintToPdfOptions.h"
236238
#include "PDF/PrintToPdfModule.h"
@@ -354,16 +356,7 @@ namespace pdftron {
354356
#endif
355357
#ifdef PYTHON3
356358
if (PyUnicode_Check(PyList_GetItem($input, i))) {
357-
int kind = PyUnicode_KIND(PyList_GetItem($input, i));
358-
if (kind == (int)PyUnicode_1BYTE_KIND) {
359-
arr[i] = (char*)PyUnicode_1BYTE_DATA(PyList_GetItem($input, i));
360-
}
361-
else if (kind == (int)PyUnicode_2BYTE_KIND) {
362-
arr[i] = (char*)PyUnicode_2BYTE_DATA(PyList_GetItem($input, i));
363-
}
364-
else if (kind == (int)PyUnicode_4BYTE_KIND) {
365-
arr[i] = (char*)PyUnicode_4BYTE_DATA(PyList_GetItem($input, i));
366-
}
359+
arr[i] = PyUnicode_AsUTF8String(PyList_GetItem($input, i));
367360
}
368361
#endif
369362
else {
@@ -481,23 +474,12 @@ namespace pdftron {
481474
}
482475
if (PyUnicode_Check($str)) {
483476
// Ensure String only contains 1 character
484-
if (PyUnicode_GET_LENGTH($str) != 1) {
477+
if (PyUnicode_GetLength($str) != 1) {
485478
PyErr_SetString(PyExc_ValueError,"Only one character allowed per list item");
486479
return NULL;
487480
}
488-
int kind = PyUnicode_KIND($str);
489-
if (kind == (int)PyUnicode_1BYTE_KIND) {
490-
char* $temp1 = (char*)PyUnicode_1BYTE_DATA($str);
491-
$temp[i] = (pdftron::Unicode)*$temp1;
492-
}
493-
else if (kind == (int)PyUnicode_2BYTE_KIND) {
494-
char* $temp1 = (char*)PyUnicode_2BYTE_DATA($str);
495-
$temp[i] = (pdftron::Unicode)*$temp1;
496-
}
497-
else if (kind == (int)PyUnicode_4BYTE_KIND) {
498-
char* $temp1 = (char*)PyUnicode_4BYTE_DATA($str);
499-
$temp[i] = (pdftron::Unicode)*$temp1;
500-
}
481+
char* $temp1 = (char *)PyUnicode_AsUTF8String($str);
482+
$temp[i] = (pdftron::Unicode)*$temp1;
501483
}
502484
else {
503485
$temp[i] = (pdftron::Unicode)PyInt_AsLong($str);
@@ -922,6 +904,7 @@ namespace pdftron {
922904
%include "PDF/PDFDoc.h"
923905
%include "PDF/PrintToPdfOptions.h"
924906
%include "PDF/PrintToPdfModule.h"
907+
%include "PDF/TaggingOptions.h"
925908

926909
%include "PDF/Annots.h"
927910
%include "PDF/Annots/Caret.h"
@@ -967,6 +950,8 @@ namespace pdftron {
967950
%include "PDF/BarcodeModule.h"
968951
%include "PDF/TransPDFOptions.h"
969952
%include "PDF/TransPDF.h"
953+
%include "PDF/FindReplaceOptions.h"
954+
%include "PDF/FindReplace.h"
970955
%include "PDF/CADModule.h"
971956
%include "PDF/AdvancedImagingModule.h"
972957
%include "PDF/PDF2HtmlReflowParagraphsModule.h"

PDFNetRuby/PDFNetRuby.i

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@
177177
#include "PDF/BarcodeModule.h"
178178
#include "PDF/TransPDFOptions.h"
179179
#include "PDF/TransPDF.h"
180+
#include "PDF/FindReplaceOptions.h"
181+
#include "PDF/FindReplace.h"
180182
#include "PDF/Optimizer.h"
181183
#include "PDF/Page.h"
182184
#include "PDF/PageLabel.h"
@@ -221,6 +223,7 @@
221223
#include "PDF/Stamper.h"
222224
#include "PDF/TextExtractor.h"
223225
#include "PDF/TextSearch.h"
226+
#include "PDF/TaggingOptions.h"
224227
#include "PDF/WebFontDownloader.h"
225228
#include "Layout/ContentTree.h"
226229
#include "Layout/FlowDocument.h"
@@ -855,6 +858,8 @@ namespace pdftron {
855858
%include "PDF/BarcodeModule.h"
856859
%include "PDF/TransPDFOptions.h"
857860
%include "PDF/TransPDF.h"
861+
%include "PDF/FindReplaceOptions.h"
862+
%include "PDF/FindReplace.h"
858863
%include "PDF/CADModule.h"
859864
%include "PDF/AdvancedImagingModule.h"
860865
%include "PDF/PDF2HtmlReflowParagraphsModule.h"
@@ -866,6 +871,7 @@ namespace pdftron {
866871
%include "PDF/PDFDocViewPrefs.h"
867872
%include "PDF/PDFDocInfo.h"
868873
%include "PDF/PDFDoc.h"
874+
%include "PDF/TaggingOptions.h"
869875

870876
%include "PDF/Annots.h"
871877
%include "PDF/Annots/Caret.h"

PDFTronGo/pdftron.i

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@
139139
#include "PDF/BarcodeModule.h"
140140
#include "PDF/TransPDFOptions.h"
141141
#include "PDF/TransPDF.h"
142+
#include "PDF/FindReplaceOptions.h"
143+
#include "PDF/FindReplace.h"
142144
#include "PDF/Optimizer.h"
143145
#include "PDF/Page.h"
144146
#include "PDF/PageLabel.h"
@@ -181,6 +183,7 @@
181183
#include "PDF/Stamper.h"
182184
#include "PDF/TextExtractor.h"
183185
#include "PDF/TextSearch.h"
186+
#include "PDF/TaggingOptions.h"
184187
#include "PDF/WebFontDownloader.h"
185188
#include "PDF/PrintToPdfOptions.h"
186189
#include "PDF/PrintToPdfModule.h"
@@ -475,6 +478,7 @@ namespace pdftron {
475478
%include "PDF/PDFDoc.h"
476479
%include "PDF/PrintToPdfOptions.h"
477480
%include "PDF/PrintToPdfModule.h"
481+
%include "PDF/TaggingOptions.h"
478482

479483
%include "PDF/Annots.h"
480484
%include "PDF/Annots/Caret.h"
@@ -520,6 +524,8 @@ namespace pdftron {
520524
%include "PDF/BarcodeModule.h"
521525
%include "PDF/TransPDFOptions.h"
522526
%include "PDF/TransPDF.h"
527+
%include "PDF/FindReplaceOptions.h"
528+
%include "PDF/FindReplace.h"
523529
%include "PDF/CADModule.h"
524530
%include "PDF/AdvancedImagingModule.h"
525531
%include "PDF/PDF2HtmlReflowParagraphsModule.h"

Samples/AddImageTest/PYTHON/RunTest.bat

Lines changed: 0 additions & 8 deletions
This file was deleted.

Samples/AddImageTest/PYTHON/RunTest.sh

Lines changed: 0 additions & 5 deletions
This file was deleted.

Samples/AdvancedImagingTest/PYTHON/RunTest.bat

Lines changed: 0 additions & 8 deletions
This file was deleted.

Samples/AdvancedImagingTest/PYTHON/RunTest.sh

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)