diff --git a/PdfiumAndroid/src/main/cpp/CMakeLists.txt b/PdfiumAndroid/src/main/cpp/CMakeLists.txt index 9c2c5e2..e24ff7c 100644 --- a/PdfiumAndroid/src/main/cpp/CMakeLists.txt +++ b/PdfiumAndroid/src/main/cpp/CMakeLists.txt @@ -57,11 +57,6 @@ find_library( # Sets the name of the path variable. target_link_libraries( # Specifies the target library. pdfiumandroid - libabsl - libc++_chrome - libchrome_zlib - libicuuc - libpartition_alloc libpdfium # Links the target library to the log library @@ -72,16 +67,6 @@ target_link_libraries( # Specifies the target library. ) -add_library( libabsl SHARED IMPORTED ) -add_library( libc++_chrome SHARED IMPORTED ) -add_library( libchrome_zlib SHARED IMPORTED ) -add_library( libicuuc SHARED IMPORTED ) -add_library( libpartition_alloc SHARED IMPORTED ) add_library( libpdfium SHARED IMPORTED ) -set_target_properties( libabsl PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/../jniLibs/${ANDROID_ABI}/libabsl.cr.so) -set_target_properties( libc++_chrome PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/../jniLibs/${ANDROID_ABI}/libc++_chrome.cr.so) -set_target_properties( libchrome_zlib PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/../jniLibs/${ANDROID_ABI}/libchrome_zlib.cr.so) -set_target_properties( libicuuc PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/../jniLibs/${ANDROID_ABI}/libicuuc.cr.so) -set_target_properties( libpartition_alloc PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/../jniLibs/${ANDROID_ABI}/libpartition_alloc.cr.so) -set_target_properties( libpdfium PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/../jniLibs/${ANDROID_ABI}/libpdfium.cr.so) +set_target_properties( libpdfium PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/../jniLibs/${ANDROID_ABI}/libpdfium.so) diff --git a/PdfiumAndroid/src/main/cpp/include/fpdf_doc.h b/PdfiumAndroid/src/main/cpp/include/fpdf_doc.h index b073f4d..2dc22d9 100644 --- a/PdfiumAndroid/src/main/cpp/include/fpdf_doc.h +++ b/PdfiumAndroid/src/main/cpp/include/fpdf_doc.h @@ -53,6 +53,8 @@ typedef enum { // // Returns a handle to the first child of |bookmark| or the first top-level // bookmark item. NULL if no child or top-level bookmark found. +// Note that another name for the bookmarks is the document outline, as +// described in ISO 32000-1:2008, section 12.3.3. FPDF_EXPORT FPDF_BOOKMARK FPDF_CALLCONV FPDFBookmark_GetFirstChild(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark); diff --git a/PdfiumAndroid/src/main/cpp/include/fpdf_edit.h b/PdfiumAndroid/src/main/cpp/include/fpdf_edit.h index 2e4e7c0..09d579e 100644 --- a/PdfiumAndroid/src/main/cpp/include/fpdf_edit.h +++ b/PdfiumAndroid/src/main/cpp/include/fpdf_edit.h @@ -126,6 +126,38 @@ FPDF_EXPORT FPDF_PAGE FPDF_CALLCONV FPDFPage_New(FPDF_DOCUMENT document, FPDF_EXPORT void FPDF_CALLCONV FPDFPage_Delete(FPDF_DOCUMENT document, int page_index); +// Experimental API. +// Move the given pages to a new index position. +// +// page_indices - the ordered list of pages to move. No duplicates allowed. +// page_indices_len - the number of elements in |page_indices| +// dest_page_index - the new index position to which the pages in +// |page_indices| are moved. +// +// Returns TRUE on success. If it returns FALSE, the document may be left in an +// indeterminate state. +// +// Example: The PDF document starts out with pages [A, B, C, D], with indices +// [0, 1, 2, 3]. +// +// > Move(doc, [3, 2], 2, 1); // returns true +// > // The document has pages [A, D, C, B]. +// > +// > Move(doc, [0, 4, 3], 3, 1); // returns false +// > // Returned false because index 4 is out of range. +// > +// > Move(doc, [0, 3, 1], 3, 2); // returns false +// > // Returned false because index 2 is out of range for 3 page indices. +// > +// > Move(doc, [2, 2], 2, 0); // returns false +// > // Returned false because [2, 2] contains duplicates. +// +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDF_MovePages(FPDF_DOCUMENT document, + const int* page_indices, + unsigned long page_indices_len, + int dest_page_index); + // Get the rotation of |page|. // // page - handle to a page @@ -731,6 +763,19 @@ FPDFImageObj_GetImageMetadata(FPDF_PAGEOBJECT image_object, FPDF_PAGE page, FPDF_IMAGEOBJ_METADATA* metadata); +// Experimental API. +// Get the image size in pixels. Faster method to get only image size. +// +// image_object - handle to an image object. +// width - receives the image width in pixels; must not be NULL. +// height - receives the image height in pixels; must not be NULL. +// +// Returns true if successful. +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDFImageObj_GetImagePixelSize(FPDF_PAGEOBJECT image_object, + unsigned int* width, + unsigned int* height); + // Create a new path object at an initial position. // // x - initial horizontal position. diff --git a/PdfiumAndroid/src/main/cpp/include/fpdf_formfill.h b/PdfiumAndroid/src/main/cpp/include/fpdf_formfill.h index d6b2d8b..a0769b7 100644 --- a/PdfiumAndroid/src/main/cpp/include/fpdf_formfill.h +++ b/PdfiumAndroid/src/main/cpp/include/fpdf_formfill.h @@ -1913,15 +1913,15 @@ FPDF_EXPORT void FPDF_CALLCONV FPDF_FFLDraw(FPDF_FORMHANDLE hHandle, int flags); #if defined(_SKIA_SUPPORT_) -FPDF_EXPORT void FPDF_CALLCONV FPDF_FFLRecord(FPDF_FORMHANDLE hHandle, - FPDF_RECORDER recorder, - FPDF_PAGE page, - int start_x, - int start_y, - int size_x, - int size_y, - int rotate, - int flags); +FPDF_EXPORT void FPDF_CALLCONV FPDF_FFLDrawSkia(FPDF_FORMHANDLE hHandle, + FPDF_SKIA_CANVAS canvas, + FPDF_PAGE page, + int start_x, + int start_y, + int size_x, + int size_y, + int rotate, + int flags); #endif /* diff --git a/PdfiumAndroid/src/main/cpp/include/fpdf_structtree.h b/PdfiumAndroid/src/main/cpp/include/fpdf_structtree.h index a6c158a..69c5f67 100644 --- a/PdfiumAndroid/src/main/cpp/include/fpdf_structtree.h +++ b/PdfiumAndroid/src/main/cpp/include/fpdf_structtree.h @@ -254,6 +254,23 @@ FPDF_EXPORT FPDF_STRUCTELEMENT FPDF_CALLCONV FPDF_StructElement_GetChildAtIndex(FPDF_STRUCTELEMENT struct_element, int index); +// Experimental API. +// Function: FPDF_StructElement_GetChildMarkedContentID +// Get the child's content id +// Parameters: +// struct_element - Handle to the struct element. +// index - The index for the child, 0-based. +// Return value: +// The marked content ID of the child. If no ID exists, returns -1. +// Comments: +// If the child exists but is not a stream or object, then this +// function will return -1. This will also return -1 for out of bounds +// indices. Compared to FPDF_StructElement_GetMarkedContentIdAtIndex, +// it is scoped to the current page. +FPDF_EXPORT int FPDF_CALLCONV +FPDF_StructElement_GetChildMarkedContentID(FPDF_STRUCTELEMENT struct_element, + int index); + // Experimental API. // Function: FPDF_StructElement_GetParent // Get the parent of the structure element. diff --git a/PdfiumAndroid/src/main/cpp/include/fpdf_text.h b/PdfiumAndroid/src/main/cpp/include/fpdf_text.h index a5566a0..bd25ba4 100644 --- a/PdfiumAndroid/src/main/cpp/include/fpdf_text.h +++ b/PdfiumAndroid/src/main/cpp/include/fpdf_text.h @@ -89,6 +89,21 @@ FPDFText_GetUnicode(FPDF_TEXTPAGE text_page, int index); FPDF_EXPORT int FPDF_CALLCONV FPDFText_IsGenerated(FPDF_TEXTPAGE text_page, int index); +// Experimental API. +// Function: FPDFText_IsHyphen +// Get if a character in a page is a hyphen. +// Parameters: +// text_page - Handle to a text page information structure. +// Returned by FPDFText_LoadPage function. +// index - Zero-based index of the character. +// Return value: +// 1 if the character is a hyphen. +// 0 if the character is not a hyphen. +// -1 if there was an error. +// +FPDF_EXPORT int FPDF_CALLCONV +FPDFText_IsHyphen(FPDF_TEXTPAGE text_page, int index); + // Experimental API. // Function: FPDFText_HasUnicodeMapError // Get if a character in a page has an invalid unicode mapping. diff --git a/PdfiumAndroid/src/main/cpp/include/fpdfview.h b/PdfiumAndroid/src/main/cpp/include/fpdfview.h index b550e35..7e75101 100644 --- a/PdfiumAndroid/src/main/cpp/include/fpdfview.h +++ b/PdfiumAndroid/src/main/cpp/include/fpdfview.h @@ -646,17 +646,29 @@ FPDF_GetTrailerEnds(FPDF_DOCUMENT document, unsigned int* buffer, unsigned long length); -// Function: FPDF_GetDocPermission +// Function: FPDF_GetDocPermissions // Get file permission flags of the document. // Parameters: // document - Handle to a document. Returned by FPDF_LoadDocument. // Return value: // A 32-bit integer indicating permission flags. Please refer to the // PDF Reference for detailed descriptions. If the document is not -// protected, 0xffffffff will be returned. +// protected or was unlocked by the owner, 0xffffffff will be returned. FPDF_EXPORT unsigned long FPDF_CALLCONV FPDF_GetDocPermissions(FPDF_DOCUMENT document); +// Function: FPDF_GetDocUserPermissions +// Get user file permission flags of the document. +// Parameters: +// document - Handle to a document. Returned by FPDF_LoadDocument. +// Return value: +// A 32-bit integer indicating permission flags. Please refer to the +// PDF Reference for detailed descriptions. If the document is not +// protected, 0xffffffff will be returned. Always returns user +// permissions, even if the document was unlocked by the owner. +FPDF_EXPORT unsigned long FPDF_CALLCONV +FPDF_GetDocUserPermissions(FPDF_DOCUMENT document); + // Function: FPDF_GetSecurityHandlerRevision // Get the revision for the security handler. // Parameters: diff --git a/PdfiumAndroid/src/main/cpp/pdfiumandroid.cpp b/PdfiumAndroid/src/main/cpp/pdfiumandroid.cpp index e51611f..67e811d 100644 --- a/PdfiumAndroid/src/main/cpp/pdfiumandroid.cpp +++ b/PdfiumAndroid/src/main/cpp/pdfiumandroid.cpp @@ -284,8 +284,8 @@ Java_io_legere_pdfiumandroid_PdfiumCore_nativeOpenMemDocument(JNIEnv *env, jobje } int size = (int) env->GetArrayLength(data); - auto *cDataCopy = new jbyte[size]; - env->GetByteArrayRegion(data, 0, size, cDataCopy); + auto *cDataCopy = malloc(size); + env->GetByteArrayRegion(data, 0, size, static_cast(cDataCopy)); FPDF_DOCUMENT document = FPDF_LoadMemDocument( reinterpret_cast(cDataCopy), size, cpassword); @@ -312,7 +312,7 @@ Java_io_legere_pdfiumandroid_PdfiumCore_nativeOpenMemDocument(JNIEnv *env, jobje } docFile->pdfDocument = document; - docFile->cDataCopy = cDataCopy; + docFile->cDataCopy = static_cast(cDataCopy); return reinterpret_cast(docFile); } diff --git a/PdfiumAndroid/src/main/java/io/legere/pdfiumandroid/PdfiumCore.kt b/PdfiumAndroid/src/main/java/io/legere/pdfiumandroid/PdfiumCore.kt index 57d1550..15cd0fa 100644 --- a/PdfiumAndroid/src/main/java/io/legere/pdfiumandroid/PdfiumCore.kt +++ b/PdfiumAndroid/src/main/java/io/legere/pdfiumandroid/PdfiumCore.kt @@ -481,12 +481,7 @@ class PdfiumCore(context: Context? = null, logger: LoggerInterface = DefaultLogg synchronized(lock) { Log.d(TAG, "init in lock") try { - System.loadLibrary("absl.cr") - System.loadLibrary("c++_chrome.cr") - System.loadLibrary("chrome_zlib.cr") - System.loadLibrary("icuuc.cr") - System.loadLibrary("partition_alloc.cr") - System.loadLibrary("pdfium.cr") + System.loadLibrary("pdfium") System.loadLibrary("pdfiumandroid") isReader.markReady() } catch (e: UnsatisfiedLinkError) { diff --git a/PdfiumAndroid/src/main/jniLibs/arm64-v8a/libabsl.cr.so b/PdfiumAndroid/src/main/jniLibs/arm64-v8a/libabsl.cr.so deleted file mode 100644 index 3eb482c..0000000 Binary files a/PdfiumAndroid/src/main/jniLibs/arm64-v8a/libabsl.cr.so and /dev/null differ diff --git a/PdfiumAndroid/src/main/jniLibs/arm64-v8a/libc++_chrome.cr.so b/PdfiumAndroid/src/main/jniLibs/arm64-v8a/libc++_chrome.cr.so deleted file mode 100644 index 45a94fd..0000000 Binary files a/PdfiumAndroid/src/main/jniLibs/arm64-v8a/libc++_chrome.cr.so and /dev/null differ diff --git a/PdfiumAndroid/src/main/jniLibs/arm64-v8a/libchrome_zlib.cr.so b/PdfiumAndroid/src/main/jniLibs/arm64-v8a/libchrome_zlib.cr.so deleted file mode 100644 index 3a37c94..0000000 Binary files a/PdfiumAndroid/src/main/jniLibs/arm64-v8a/libchrome_zlib.cr.so and /dev/null differ diff --git a/PdfiumAndroid/src/main/jniLibs/arm64-v8a/libicuuc.cr.so b/PdfiumAndroid/src/main/jniLibs/arm64-v8a/libicuuc.cr.so deleted file mode 100644 index 02168f1..0000000 Binary files a/PdfiumAndroid/src/main/jniLibs/arm64-v8a/libicuuc.cr.so and /dev/null differ diff --git a/PdfiumAndroid/src/main/jniLibs/arm64-v8a/libpartition_alloc.cr.so b/PdfiumAndroid/src/main/jniLibs/arm64-v8a/libpartition_alloc.cr.so deleted file mode 100644 index 67f8967..0000000 Binary files a/PdfiumAndroid/src/main/jniLibs/arm64-v8a/libpartition_alloc.cr.so and /dev/null differ diff --git a/PdfiumAndroid/src/main/jniLibs/arm64-v8a/libpdfium.cr.so b/PdfiumAndroid/src/main/jniLibs/arm64-v8a/libpdfium.cr.so deleted file mode 100644 index 6b275b0..0000000 Binary files a/PdfiumAndroid/src/main/jniLibs/arm64-v8a/libpdfium.cr.so and /dev/null differ diff --git a/PdfiumAndroid/src/main/jniLibs/arm64-v8a/libpdfium.so b/PdfiumAndroid/src/main/jniLibs/arm64-v8a/libpdfium.so new file mode 100755 index 0000000..de5987b Binary files /dev/null and b/PdfiumAndroid/src/main/jniLibs/arm64-v8a/libpdfium.so differ diff --git a/PdfiumAndroid/src/main/jniLibs/armeabi-v7a/libabsl.cr.so b/PdfiumAndroid/src/main/jniLibs/armeabi-v7a/libabsl.cr.so deleted file mode 100644 index 370a649..0000000 Binary files a/PdfiumAndroid/src/main/jniLibs/armeabi-v7a/libabsl.cr.so and /dev/null differ diff --git a/PdfiumAndroid/src/main/jniLibs/armeabi-v7a/libc++_chrome.cr.so b/PdfiumAndroid/src/main/jniLibs/armeabi-v7a/libc++_chrome.cr.so deleted file mode 100644 index b1277de..0000000 Binary files a/PdfiumAndroid/src/main/jniLibs/armeabi-v7a/libc++_chrome.cr.so and /dev/null differ diff --git a/PdfiumAndroid/src/main/jniLibs/armeabi-v7a/libchrome_zlib.cr.so b/PdfiumAndroid/src/main/jniLibs/armeabi-v7a/libchrome_zlib.cr.so deleted file mode 100644 index ce5f3f6..0000000 Binary files a/PdfiumAndroid/src/main/jniLibs/armeabi-v7a/libchrome_zlib.cr.so and /dev/null differ diff --git a/PdfiumAndroid/src/main/jniLibs/armeabi-v7a/libicuuc.cr.so b/PdfiumAndroid/src/main/jniLibs/armeabi-v7a/libicuuc.cr.so deleted file mode 100644 index 5ee97d4..0000000 Binary files a/PdfiumAndroid/src/main/jniLibs/armeabi-v7a/libicuuc.cr.so and /dev/null differ diff --git a/PdfiumAndroid/src/main/jniLibs/armeabi-v7a/libpartition_alloc.cr.so b/PdfiumAndroid/src/main/jniLibs/armeabi-v7a/libpartition_alloc.cr.so deleted file mode 100644 index 1a5176b..0000000 Binary files a/PdfiumAndroid/src/main/jniLibs/armeabi-v7a/libpartition_alloc.cr.so and /dev/null differ diff --git a/PdfiumAndroid/src/main/jniLibs/armeabi-v7a/libpdfium.cr.so b/PdfiumAndroid/src/main/jniLibs/armeabi-v7a/libpdfium.cr.so deleted file mode 100644 index 9ba6cff..0000000 Binary files a/PdfiumAndroid/src/main/jniLibs/armeabi-v7a/libpdfium.cr.so and /dev/null differ diff --git a/PdfiumAndroid/src/main/jniLibs/armeabi-v7a/libpdfium.so b/PdfiumAndroid/src/main/jniLibs/armeabi-v7a/libpdfium.so new file mode 100755 index 0000000..a571061 Binary files /dev/null and b/PdfiumAndroid/src/main/jniLibs/armeabi-v7a/libpdfium.so differ diff --git a/PdfiumAndroid/src/main/jniLibs/x86/libabsl.cr.so b/PdfiumAndroid/src/main/jniLibs/x86/libabsl.cr.so deleted file mode 100644 index b23e810..0000000 Binary files a/PdfiumAndroid/src/main/jniLibs/x86/libabsl.cr.so and /dev/null differ diff --git a/PdfiumAndroid/src/main/jniLibs/x86/libc++_chrome.cr.so b/PdfiumAndroid/src/main/jniLibs/x86/libc++_chrome.cr.so deleted file mode 100644 index 2b1402c..0000000 Binary files a/PdfiumAndroid/src/main/jniLibs/x86/libc++_chrome.cr.so and /dev/null differ diff --git a/PdfiumAndroid/src/main/jniLibs/x86/libchrome_zlib.cr.so b/PdfiumAndroid/src/main/jniLibs/x86/libchrome_zlib.cr.so deleted file mode 100644 index b2a9690..0000000 Binary files a/PdfiumAndroid/src/main/jniLibs/x86/libchrome_zlib.cr.so and /dev/null differ diff --git a/PdfiumAndroid/src/main/jniLibs/x86/libicuuc.cr.so b/PdfiumAndroid/src/main/jniLibs/x86/libicuuc.cr.so deleted file mode 100644 index 23cc2e6..0000000 Binary files a/PdfiumAndroid/src/main/jniLibs/x86/libicuuc.cr.so and /dev/null differ diff --git a/PdfiumAndroid/src/main/jniLibs/x86/libpartition_alloc.cr.so b/PdfiumAndroid/src/main/jniLibs/x86/libpartition_alloc.cr.so deleted file mode 100644 index bd48bd4..0000000 Binary files a/PdfiumAndroid/src/main/jniLibs/x86/libpartition_alloc.cr.so and /dev/null differ diff --git a/PdfiumAndroid/src/main/jniLibs/x86/libpdfium.cr.so b/PdfiumAndroid/src/main/jniLibs/x86/libpdfium.cr.so deleted file mode 100644 index 21ac95d..0000000 Binary files a/PdfiumAndroid/src/main/jniLibs/x86/libpdfium.cr.so and /dev/null differ diff --git a/PdfiumAndroid/src/main/jniLibs/x86/libpdfium.so b/PdfiumAndroid/src/main/jniLibs/x86/libpdfium.so new file mode 100755 index 0000000..5835a13 Binary files /dev/null and b/PdfiumAndroid/src/main/jniLibs/x86/libpdfium.so differ diff --git a/PdfiumAndroid/src/main/jniLibs/x86_64/libabsl.cr.so b/PdfiumAndroid/src/main/jniLibs/x86_64/libabsl.cr.so deleted file mode 100644 index df39923..0000000 Binary files a/PdfiumAndroid/src/main/jniLibs/x86_64/libabsl.cr.so and /dev/null differ diff --git a/PdfiumAndroid/src/main/jniLibs/x86_64/libc++_chrome.cr.so b/PdfiumAndroid/src/main/jniLibs/x86_64/libc++_chrome.cr.so deleted file mode 100644 index d69bfb8..0000000 Binary files a/PdfiumAndroid/src/main/jniLibs/x86_64/libc++_chrome.cr.so and /dev/null differ diff --git a/PdfiumAndroid/src/main/jniLibs/x86_64/libchrome_zlib.cr.so b/PdfiumAndroid/src/main/jniLibs/x86_64/libchrome_zlib.cr.so deleted file mode 100644 index c6eab3a..0000000 Binary files a/PdfiumAndroid/src/main/jniLibs/x86_64/libchrome_zlib.cr.so and /dev/null differ diff --git a/PdfiumAndroid/src/main/jniLibs/x86_64/libicuuc.cr.so b/PdfiumAndroid/src/main/jniLibs/x86_64/libicuuc.cr.so deleted file mode 100644 index d3c5073..0000000 Binary files a/PdfiumAndroid/src/main/jniLibs/x86_64/libicuuc.cr.so and /dev/null differ diff --git a/PdfiumAndroid/src/main/jniLibs/x86_64/libpartition_alloc.cr.so b/PdfiumAndroid/src/main/jniLibs/x86_64/libpartition_alloc.cr.so deleted file mode 100644 index 9488bf9..0000000 Binary files a/PdfiumAndroid/src/main/jniLibs/x86_64/libpartition_alloc.cr.so and /dev/null differ diff --git a/PdfiumAndroid/src/main/jniLibs/x86_64/libpdfium.cr.so b/PdfiumAndroid/src/main/jniLibs/x86_64/libpdfium.cr.so deleted file mode 100644 index d815805..0000000 Binary files a/PdfiumAndroid/src/main/jniLibs/x86_64/libpdfium.cr.so and /dev/null differ diff --git a/PdfiumAndroid/src/main/jniLibs/x86_64/libpdfium.so b/PdfiumAndroid/src/main/jniLibs/x86_64/libpdfium.so new file mode 100755 index 0000000..f58ae45 Binary files /dev/null and b/PdfiumAndroid/src/main/jniLibs/x86_64/libpdfium.so differ