diff --git a/bin/libgcc_s_dw2-1.dll b/bin/libgcc_s_dw2-1.dll index c1dcdbd..0737fdb 100644 Binary files a/bin/libgcc_s_dw2-1.dll and b/bin/libgcc_s_dw2-1.dll differ diff --git a/bin/libstdc++-6.dll b/bin/libstdc++-6.dll index e8f7765..07842f8 100644 Binary files a/bin/libstdc++-6.dll and b/bin/libstdc++-6.dll differ diff --git a/bin/libwinpthread-1.dll b/bin/libwinpthread-1.dll index 504dc95..25bdaa8 100644 Binary files a/bin/libwinpthread-1.dll and b/bin/libwinpthread-1.dll differ diff --git a/bin/pdfium.dll b/bin/pdfium.dll index 68dfd1a..5683b08 100644 Binary files a/bin/pdfium.dll and b/bin/pdfium.dll differ diff --git a/pdfium/include/fpdf_doc.h b/pdfium/include/fpdf_doc.h index df453ad..977e1c9 100644 --- a/pdfium/include/fpdf_doc.h +++ b/pdfium/include/fpdf_doc.h @@ -98,6 +98,18 @@ FPDFBookmark_GetTitle(FPDF_BOOKMARK bookmark, void* buffer, unsigned long buflen); +// Experimental API. +// Get the number of chlidren of |bookmark|. +// +// bookmark - handle to the bookmark. +// +// Returns a signed integer that represents the number of sub-items the given +// bookmark has. If the value is positive, child items shall be shown by default +// (open state). If the value is negative, child items shall be hidden by +// default (closed state). Please refer to PDF 32000-1:2008, Table 153. +// Returns 0 if the bookmark has no children or is invalid. +FPDF_EXPORT int FPDF_CALLCONV FPDFBookmark_GetCount(FPDF_BOOKMARK bookmark); + // Find the bookmark with |title| in |document|. // // document - handle to the document. diff --git a/pdfium/include/fpdf_edit.h b/pdfium/include/fpdf_edit.h index f41a211..b68b7c9 100644 --- a/pdfium/include/fpdf_edit.h +++ b/pdfium/include/fpdf_edit.h @@ -1242,6 +1242,38 @@ FPDF_EXPORT FPDF_FONT FPDF_CALLCONV FPDFTextObj_GetFont(FPDF_PAGEOBJECT text); FPDF_EXPORT unsigned long FPDF_CALLCONV FPDFFont_GetFontName(FPDF_FONT font, char* buffer, unsigned long length); +// Experimental API. +// Get the decoded data from the |font| object. +// +// font - The handle to the font object. (Required) +// buffer - The address of a buffer that receives the font data. +// buflen - Length of the buffer. +// out_buflen - Pointer to variable that will receive the minimum buffer size +// to contain the font data. Not filled if the return value is +// FALSE. (Required) +// +// Returns TRUE on success. In which case, |out_buflen| will be filled, and +// |buffer| will be filled if it is large enough. Returns FALSE if any of the +// required parameters are null. +// +// The decoded data is the uncompressed font data. i.e. the raw font data after +// having all stream filters applied, when the data is embedded. +// +// If the font is not embedded, then this API will instead return the data for +// the substitution font it is using. +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFFont_GetFontData(FPDF_FONT font, + uint8_t* buffer, + size_t buflen, + size_t* out_buflen); + +// Experimental API. +// Get whether |font| is embedded or not. +// +// font - the handle to the font object. +// +// Returns 1 if the font is embedded, 0 if it not, and -1 on failure. +FPDF_EXPORT int FPDF_CALLCONV FPDFFont_GetIsEmbedded(FPDF_FONT font); + // Experimental API. // Get the descriptor flags of a font. // diff --git a/pdfium/include/fpdf_formfill.h b/pdfium/include/fpdf_formfill.h index ee70ed9..5393a03 100644 --- a/pdfium/include/fpdf_formfill.h +++ b/pdfium/include/fpdf_formfill.h @@ -307,7 +307,9 @@ typedef struct _IPDF_JsPlatform { int length); /* - * Pointer to FPDF_FORMFILLINFO interface. + * Pointer for embedder-specific data. Unused by PDFium, and despite + * its name, can be any data the embedder desires, though traditionally + * a FPDF_FORMFILLINFO interface. */ void* m_pFormfillinfo; @@ -637,8 +639,9 @@ typedef struct _FPDF_FORMFILLINFO { * Return value: * None. * Comments: - * See the named actions description of <> - * for more details. + * See ISO 32000-1:2008, section 12.6.4.11 for descriptions of the + * standard named actions, but note that a document may supply any + * name of its choosing. */ void (*FFI_ExecuteNamedAction)(struct _FPDF_FORMFILLINFO* pThis, FPDF_BYTESTRING namedAction); @@ -1480,6 +1483,9 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnKeyDown(FPDF_FORMHANDLE hHandle, * flag values). * Return Value: * True indicates success; otherwise false. + * Comments: + * Currently unimplemented and always returns false. PDFium reserves this + * API and may implement it in the future on an as-needed basis. */ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnKeyUp(FPDF_FORMHANDLE hHandle, FPDF_PAGE page, diff --git a/pdfium/include/fpdf_structtree.h b/pdfium/include/fpdf_structtree.h index 0bd56ee..2bc2dc6 100644 --- a/pdfium/include/fpdf_structtree.h +++ b/pdfium/include/fpdf_structtree.h @@ -62,7 +62,7 @@ FPDF_StructTree_GetChildAtIndex(FPDF_STRUCTTREE struct_tree, int index); // buffer - A buffer for output the alt text. May be NULL. // buflen - The length of the buffer, in bytes. May be 0. // Return value: -// The number of bytes in the title, including the terminating NUL +// The number of bytes in the alt text, including the terminating NUL // character. The number of bytes is returned regardless of the // |buffer| and |buflen| parameters. // Comments: @@ -76,6 +76,26 @@ FPDF_StructElement_GetAltText(FPDF_STRUCTELEMENT struct_element, unsigned long buflen); // Experimental API. +// Function: FPDF_StructElement_GetActualText +// Get the actual text for a given element. +// Parameters: +// struct_element - Handle to the struct element. +// buffer - A buffer for output the actual text. May be NULL. +// buflen - The length of the buffer, in bytes. May be 0. +// Return value: +// The number of bytes in the actual text, including the terminating +// NUL character. The number of bytes is returned regardless of the +// |buffer| and |buflen| parameters. +// Comments: +// Regardless of the platform, the |buffer| is always in UTF-16LE +// encoding. The string is terminated by a UTF16 NUL character. If +// |buflen| is less than the required length, or |buffer| is NULL, +// |buffer| will not be modified. +FPDF_EXPORT unsigned long FPDF_CALLCONV +FPDF_StructElement_GetActualText(FPDF_STRUCTELEMENT struct_element, + void* buffer, + unsigned long buflen); + // Function: FPDF_StructElement_GetID // Get the ID for a given element. // Parameters: @@ -154,8 +174,8 @@ FPDF_StructElement_GetMarkedContentID(FPDF_STRUCTELEMENT struct_element); // Get the type (/S) for a given element. // Parameters: // struct_element - Handle to the struct element. -// buffer - A buffer for output. May be NULL. -// buflen - The length of the buffer, in bytes. May be 0. +// buffer - A buffer for output. May be NULL. +// buflen - The length of the buffer, in bytes. May be 0. // Return value: // The number of bytes in the type, including the terminating NUL // character. The number of bytes is returned regardless of the @@ -170,6 +190,27 @@ FPDF_StructElement_GetType(FPDF_STRUCTELEMENT struct_element, void* buffer, unsigned long buflen); +// Experimental API. +// Function: FPDF_StructElement_GetObjType +// Get the object type (/Type) for a given element. +// Parameters: +// struct_element - Handle to the struct element. +// buffer - A buffer for output. May be NULL. +// buflen - The length of the buffer, in bytes. May be 0. +// Return value: +// The number of bytes in the object type, including the terminating +// NUL character. The number of bytes is returned regardless of the +// |buffer| and |buflen| parameters. +// Comments: +// Regardless of the platform, the |buffer| is always in UTF-16LE +// encoding. The string is terminated by a UTF16 NUL character. If +// |buflen| is less than the required length, or |buffer| is NULL, +// |buffer| will not be modified. +FPDF_EXPORT unsigned long FPDF_CALLCONV +FPDF_StructElement_GetObjType(FPDF_STRUCTELEMENT struct_element, + void* buffer, + unsigned long buflen); + // Function: FPDF_StructElement_GetTitle // Get the title (/T) for a given element. // Parameters: @@ -202,8 +243,8 @@ FPDF_StructElement_CountChildren(FPDF_STRUCTELEMENT struct_element); // Function: FPDF_StructElement_GetChildAtIndex // Get a child in the structure element. // Parameters: -// struct_tree - Handle to the struct element. -// index - The index for the child, 0-based. +// struct_element - Handle to the struct element. +// index - The index for the child, 0-based. // Return value: // The child at the n-th index or NULL on error. // Comments: @@ -213,6 +254,199 @@ FPDF_EXPORT FPDF_STRUCTELEMENT FPDF_CALLCONV FPDF_StructElement_GetChildAtIndex(FPDF_STRUCTELEMENT struct_element, int index); +// Experimental API. +// Function: FPDF_StructElement_GetParent +// Get the parent of the structure element. +// Parameters: +// struct_element - Handle to the struct element. +// Return value: +// The parent structure element or NULL on error. +// Comments: +// If structure element is StructTreeRoot, then this function will +// return NULL. +FPDF_EXPORT FPDF_STRUCTELEMENT FPDF_CALLCONV +FPDF_StructElement_GetParent(FPDF_STRUCTELEMENT struct_element); + +// Function: FPDF_StructElement_GetAttributeCount +// Count the number of attributes for the structure element. +// Parameters: +// struct_element - Handle to the struct element. +// Return value: +// The number of attributes, or -1 on error. +FPDF_EXPORT int FPDF_CALLCONV +FPDF_StructElement_GetAttributeCount(FPDF_STRUCTELEMENT struct_element); + +// Experimental API. +// Function: FPDF_StructElement_GetAttributeAtIndex +// Get an attribute object in the structure element. +// Parameters: +// struct_element - Handle to the struct element. +// index - The index for the attribute object, 0-based. +// Return value: +// The attribute object at the n-th index or NULL on error. +// Comments: +// If the attribute object exists but is not a dict, then this +// function will return NULL. This will also return NULL for out of +// bounds indices. +FPDF_EXPORT FPDF_STRUCTELEMENT_ATTR FPDF_CALLCONV +FPDF_StructElement_GetAttributeAtIndex(FPDF_STRUCTELEMENT struct_element, int index); + +// Experimental API. +// Function: FPDF_StructElement_Attr_GetCount +// Count the number of attributes in a structure element attribute map. +// Parameters: +// struct_attribute - Handle to the struct element attribute. +// Return value: +// The number of attributes, or -1 on error. +FPDF_EXPORT int FPDF_CALLCONV +FPDF_StructElement_Attr_GetCount(FPDF_STRUCTELEMENT_ATTR struct_attribute); + + +// Experimental API. +// Function: FPDF_StructElement_Attr_GetName +// Get the name of an attribute in a structure element attribute map. +// Parameters: +// struct_attribute - Handle to the struct element attribute. +// index - The index of attribute in the map. +// buffer - A buffer for output. May be NULL. This is only +// modified if |buflen| is longer than the length +// of the key. Optional, pass null to just +// retrieve the size of the buffer needed. +// buflen - The length of the buffer. +// out_buflen - A pointer to variable that will receive the +// minimum buffer size to contain the key. Not +// filled if FALSE is returned. +// Return value: +// TRUE if the operation was successful, FALSE otherwise. +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDF_StructElement_Attr_GetName(FPDF_STRUCTELEMENT_ATTR struct_attribute, + int index, + void* buffer, + unsigned long buflen, + unsigned long* out_buflen); + +// Experimental API. +// Function: FPDF_StructElement_Attr_GetType +// Get the type of an attribute in a structure element attribute map. +// Parameters: +// struct_attribute - Handle to the struct element attribute. +// name - The attribute name. +// Return value: +// Returns the type of the value, or FPDF_OBJECT_UNKNOWN in case of +// failure. +FPDF_EXPORT FPDF_OBJECT_TYPE FPDF_CALLCONV +FPDF_StructElement_Attr_GetType(FPDF_STRUCTELEMENT_ATTR struct_attribute, + FPDF_BYTESTRING name); + +// Experimental API. +// Function: FPDF_StructElement_Attr_GetBooleanValue +// Get the value of a boolean attribute in an attribute map by name as +// FPDF_BOOL. FPDF_StructElement_Attr_GetType() should have returned +// FPDF_OBJECT_BOOLEAN for this property. +// Parameters: +// struct_attribute - Handle to the struct element attribute. +// name - The attribute name. +// out_value - A pointer to variable that will receive the +// value. Not filled if false is returned. +// Return value: +// Returns TRUE if the name maps to a boolean value, FALSE otherwise. +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDF_StructElement_Attr_GetBooleanValue( + FPDF_STRUCTELEMENT_ATTR struct_attribute, + FPDF_BYTESTRING name, + FPDF_BOOL* out_value); + +// Experimental API. +// Function: FPDF_StructElement_Attr_GetNumberValue +// Get the value of a number attribute in an attribute map by name as +// float. FPDF_StructElement_Attr_GetType() should have returned +// FPDF_OBJECT_NUMBER for this property. +// Parameters: +// struct_attribute - Handle to the struct element attribute. +// name - The attribute name. +// out_value - A pointer to variable that will receive the +// value. Not filled if false is returned. +// Return value: +// Returns TRUE if the name maps to a number value, FALSE otherwise. +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDF_StructElement_Attr_GetNumberValue(FPDF_STRUCTELEMENT_ATTR struct_attribute, + FPDF_BYTESTRING name, + float* out_value); + +// Experimental API. +// Function: FPDF_StructElement_Attr_GetStringValue +// Get the value of a string attribute in an attribute map by name as +// string. FPDF_StructElement_Attr_GetType() should have returned +// FPDF_OBJECT_STRING or FPDF_OBJECT_NAME for this property. +// Parameters: +// struct_attribute - Handle to the struct element attribute. +// name - The attribute name. +// buffer - A buffer for holding the returned key in +// UTF-16LE. This is only modified if |buflen| is +// longer than the length of the key. Optional, +// pass null to just retrieve the size of the +// buffer needed. +// buflen - The length of the buffer. +// out_buflen - A pointer to variable that will receive the +// minimum buffer size to contain the key. Not +// filled if FALSE is returned. +// Return value: +// Returns TRUE if the name maps to a string value, FALSE otherwise. +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDF_StructElement_Attr_GetStringValue(FPDF_STRUCTELEMENT_ATTR struct_attribute, + FPDF_BYTESTRING name, + void* buffer, + unsigned long buflen, + unsigned long* out_buflen); + +// Experimental API. +// Function: FPDF_StructElement_Attr_GetBlobValue +// Get the value of a blob attribute in an attribute map by name as +// string. +// Parameters: +// struct_attribute - Handle to the struct element attribute. +// name - The attribute name. +// buffer - A buffer for holding the returned value. This +// is only modified if |buflen| is at least as +// long as the length of the value. Optional, pass +// null to just retrieve the size of the buffer +// needed. +// buflen - The length of the buffer. +// out_buflen - A pointer to variable that will receive the +// minimum buffer size to contain the key. Not +// filled if FALSE is returned. +// Return value: +// Returns TRUE if the name maps to a string value, FALSE otherwise. +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDF_StructElement_Attr_GetBlobValue(FPDF_STRUCTELEMENT_ATTR struct_attribute, + FPDF_BYTESTRING name, + void* buffer, + unsigned long buflen, + unsigned long* out_buflen); + +// Experimental API. +// Function: FPDF_StructElement_GetMarkedContentIdCount +// Get the count of marked content ids for a given element. +// Parameters: +// struct_element - Handle to the struct element. +// Return value: +// The count of marked content ids or -1 if none exists. +FPDF_EXPORT int FPDF_CALLCONV +FPDF_StructElement_GetMarkedContentIdCount(FPDF_STRUCTELEMENT struct_element); + +// Experimental API. +// Function: FPDF_StructElement_GetMarkedContentIdAtIndex +// Get the marked content id at a given index for a given element. +// Parameters: +// struct_element - Handle to the struct element. +// index - The index of the marked content id, 0-based. +// Return value: +// The marked content ID of the element. If no ID exists, returns +// -1. +FPDF_EXPORT int FPDF_CALLCONV +FPDF_StructElement_GetMarkedContentIdAtIndex(FPDF_STRUCTELEMENT struct_element, + int index); + #ifdef __cplusplus } // extern "C" #endif diff --git a/pdfium/include/fpdf_sysfontinfo.h b/pdfium/include/fpdf_sysfontinfo.h index 936de96..0a02a35 100644 --- a/pdfium/include/fpdf_sysfontinfo.h +++ b/pdfium/include/fpdf_sysfontinfo.h @@ -19,8 +19,12 @@ #define FXFONT_HANGEUL_CHARSET 129 #define FXFONT_GB2312_CHARSET 134 #define FXFONT_CHINESEBIG5_CHARSET 136 +#define FXFONT_GREEK_CHARSET 161 +#define FXFONT_VIETNAMESE_CHARSET 163 +#define FXFONT_HEBREW_CHARSET 177 #define FXFONT_ARABIC_CHARSET 178 #define FXFONT_CYRILLIC_CHARSET 204 +#define FXFONT_THAI_CHARSET 222 #define FXFONT_EASTERNEUROPEAN_CHARSET 238 /* Font pitch and family flags */ diff --git a/pdfium/include/fpdf_text.h b/pdfium/include/fpdf_text.h index 65554e4..6d4a020 100644 --- a/pdfium/include/fpdf_text.h +++ b/pdfium/include/fpdf_text.h @@ -348,20 +348,22 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFText_GetText(FPDF_TEXTPAGE text_page, unsigned short* result); // Function: FPDFText_CountRects -// Count number of rectangular areas occupied by a segment of texts. +// Counts number of rectangular areas occupied by a segment of text, +// and caches the result for subsequent FPDFText_GetRect() calls. // Parameters: // text_page - Handle to a text page information structure. // Returned by FPDFText_LoadPage function. -// start_index - Index for the start characters. -// count - Number of characters. +// start_index - Index for the start character. +// count - Number of characters, or -1 for all remaining. // Return value: -// Number of rectangles. Zero for error. +// Number of rectangles, 0 if text_page is null, or -1 on bad +// start_index. // Comments: // This function, along with FPDFText_GetRect can be used by // applications to detect the position on the page for a text segment, -// so proper areas can be highlighted. FPDFTEXT will automatically -// merge small character boxes into bigger one if those characters -// are on the same line and use same font settings. +// so proper areas can be highlighted. The FPDFText_* functions will +// automatically merge small character boxes into bigger one if those +// characters are on the same line and use same font settings. // FPDF_EXPORT int FPDF_CALLCONV FPDFText_CountRects(FPDF_TEXTPAGE text_page, int start_index, diff --git a/pdfium/include/fpdfview.h b/pdfium/include/fpdfview.h index 2e55b0e..b452066 100644 --- a/pdfium/include/fpdfview.h +++ b/pdfium/include/fpdfview.h @@ -75,6 +75,7 @@ typedef void* FPDF_RECORDER; // Passed into skia. typedef struct fpdf_schhandle_t__* FPDF_SCHHANDLE; typedef struct fpdf_signature_t__* FPDF_SIGNATURE; typedef struct fpdf_structelement_t__* FPDF_STRUCTELEMENT; +typedef const struct fpdf_structelement_attr_t__* FPDF_STRUCTELEMENT_ATTR; typedef struct fpdf_structtree_t__* FPDF_STRUCTTREE; typedef struct fpdf_textpage_t__* FPDF_TEXTPAGE; typedef struct fpdf_widget_t__* FPDF_WIDGET; @@ -103,7 +104,7 @@ typedef const char* FPDF_BYTESTRING; // FPDFSDK always uses UTF-16LE encoded wide strings, each character uses 2 // bytes (except surrogation), with the low byte first. -typedef const unsigned short* FPDF_WIDESTRING; +typedef const FPDF_WCHAR* FPDF_WIDESTRING; // Structure for persisting a string beyond the duration of a callback. // Note: although represented as a char*, string may be interpreted as @@ -286,35 +287,6 @@ FPDF_EXPORT void FPDF_CALLCONV FPDF_SetSandBoxPolicy(FPDF_DWORD policy, FPDF_BOOL enable); #if defined(_WIN32) -#if defined(PDFIUM_PRINT_TEXT_WITH_GDI) -// Pointer to a helper function to make |font| with |text| of |text_length| -// accessible when printing text with GDI. This is useful in sandboxed -// environments where PDFium's access to GDI may be restricted. -typedef void (*PDFiumEnsureTypefaceCharactersAccessible)(const LOGFONT* font, - const wchar_t* text, - size_t text_length); - -// Experimental API. -// Function: FPDF_SetTypefaceAccessibleFunc -// Set the function pointer that makes GDI fonts available in sandboxed -// environments. -// Parameters: -// func - A function pointer. See description above. -// Return value: -// None. -FPDF_EXPORT void FPDF_CALLCONV -FPDF_SetTypefaceAccessibleFunc(PDFiumEnsureTypefaceCharactersAccessible func); - -// Experimental API. -// Function: FPDF_SetPrintTextWithGDI -// Set whether to use GDI to draw fonts when printing on Windows. -// Parameters: -// use_gdi - Set to true to enable printing text with GDI. -// Return value: -// None. -FPDF_EXPORT void FPDF_CALLCONV FPDF_SetPrintTextWithGDI(FPDF_BOOL use_gdi); -#endif // PDFIUM_PRINT_TEXT_WITH_GDI - // Experimental API. // Function: FPDF_SetPrintMode // Set printing mode when printing on Windows. @@ -357,6 +329,8 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_SetPrintMode(int mode); // If this function fails, you can use FPDF_GetLastError() to retrieve // the reason why it failed. // +// The encoding for |file_path| is UTF-8. +// // The encoding for |password| can be either UTF-8 or Latin-1. PDFs, // depending on the security handler revision, will only accept one or // the other encoding. If |password|'s encoding and the PDF's expected diff --git a/pdfium/x86/lib/pdfium.dll.lib b/pdfium/x86/lib/pdfium.dll.lib index 055c501..e72f247 100644 Binary files a/pdfium/x86/lib/pdfium.dll.lib and b/pdfium/x86/lib/pdfium.dll.lib differ diff --git a/src/version.hpp b/src/version.hpp index d6f2e3b..ca2c037 100644 --- a/src/version.hpp +++ b/src/version.hpp @@ -1,7 +1,7 @@ #pragma once #define APP_CLASSNAME L"PdfiumViewCpp" -#define VERSION_STRING L"0.8b pre2" +#define VERSION_STRING L"0.8b pre3" #define PRODUCT_NAME L"PdfiumView" #define APP_NAME PRODUCT_NAME L" v" VERSION_STRING