summaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
authorthestig <thestig@chromium.org>2016-11-23 14:10:06 -0800
committerCommit bot <commit-bot@chromium.org>2016-11-23 14:10:06 -0800
commit9067fd683ebf8d6467f8cc5aa7daf5e1f950f846 (patch)
treec967cfe1c94ca9049896d3c3b54d81594c2e9a9f /public
parent841a85b19cc10d719505ea2c7e0e49bae843db6e (diff)
downloadpdfium-9067fd683ebf8d6467f8cc5aa7daf5e1f950f846.tar.xz
Add APIs for limited use of document tagged code.
BUG=pdfium:568 Review-Url: https://codereview.chromium.org/2519343002
Diffstat (limited to 'public')
-rw-r--r--public/fpdf_doc.h6
-rw-r--r--public/fpdf_formfill.h6
-rw-r--r--public/fpdf_structtree.h103
-rw-r--r--public/fpdfview.h2
4 files changed, 110 insertions, 7 deletions
diff --git a/public/fpdf_doc.h b/public/fpdf_doc.h
index b245d46900..10f899549b 100644
--- a/public/fpdf_doc.h
+++ b/public/fpdf_doc.h
@@ -68,7 +68,7 @@ FPDFBookmark_GetNextSibling(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark);
// |buflen| parameters.
//
// 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 then 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.
DLLEXPORT unsigned long STDCALL FPDFBookmark_GetTitle(FPDF_BOOKMARK bookmark,
void* buffer,
@@ -142,7 +142,7 @@ DLLEXPORT FPDF_DEST STDCALL FPDFAction_GetDest(FPDF_DOCUMENT document,
// NUL character.
//
// Regardless of the platform, the |buffer| is always in UTF-16LE encoding.
-// If |buflen| is less then the returned length, or |buffer| is NULL, |buffer|
+// If |buflen| is less than the returned length, or |buffer| is NULL, |buffer|
// will not be modified.
DLLEXPORT unsigned long STDCALL
FPDFAction_GetFilePath(FPDF_ACTION action, void* buffer, unsigned long buflen);
@@ -156,7 +156,7 @@ FPDFAction_GetFilePath(FPDF_ACTION action, void* buffer, unsigned long buflen);
//
// Returns the number of bytes in the URI path, including trailing zeros.
//
-// The |buffer| is always encoded in 7-bit ASCII. If |buflen| is less then the
+// The |buffer| is always encoded in 7-bit ASCII. If |buflen| is less than the
// returned length, or |buffer| is NULL, |buffer| will not be modified.
DLLEXPORT unsigned long STDCALL FPDFAction_GetURIPath(FPDF_DOCUMENT document,
FPDF_ACTION action,
diff --git a/public/fpdf_formfill.h b/public/fpdf_formfill.h
index ada87d3158..09b80eaf90 100644
--- a/public/fpdf_formfill.h
+++ b/public/fpdf_formfill.h
@@ -149,10 +149,8 @@ typedef struct _IPDF_JsPlatform {
* The filePath should be always input in local encoding.
*
* The return value always indicated number of bytes required for the
- * buffer, even when there is
- * no buffer specified, or the buffer size is less then required. In this
- * case, the buffer will not
- * be modified.
+ * buffer , even when there is no buffer specified, or the buffer size is
+ * less than required. In this case, the buffer will not be modified.
*/
int (*Doc_getFilePath)(struct _IPDF_JsPlatform* pThis,
void* filePath,
diff --git a/public/fpdf_structtree.h b/public/fpdf_structtree.h
new file mode 100644
index 0000000000..3d4da402aa
--- /dev/null
+++ b/public/fpdf_structtree.h
@@ -0,0 +1,103 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef PUBLIC_FPDF_STRUCTTREE_H_
+#define PUBLIC_FPDF_STRUCTTREE_H_
+
+// NOLINTNEXTLINE(build/include)
+#include "fpdfview.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// Function: FPDF_StructTree_GetForPage
+// Get the structure tree for a page.
+// Parameters:
+// page - Handle to the page. Returned by FPDF_LoadPage
+// function.
+// Return value:
+// A handle to the structure tree or NULL on error.
+DLLEXPORT FPDF_STRUCTTREE STDCALL FPDF_StructTree_GetForPage(FPDF_PAGE page);
+
+// Function: FPDF_StructTree_Close
+// Release the resource allocate by FPDF_StructTree_GetForPage.
+// Parameters:
+// struct_tree - Handle to the struct tree. Returned by
+// FPDF_StructTree_LoadPage function.
+// Return value:
+// NULL
+DLLEXPORT void STDCALL FPDF_StructTree_Close(FPDF_STRUCTTREE struct_tree);
+
+// Function: FPDF_StructTree_CountChildren
+// Count the number of children for the structure tree.
+// Parameters:
+// struct_tree - Handle to the struct tree. Returned by
+// FPDF_StructTree_LoadPage function.
+// Return value:
+// The number of children, or -1 on error.
+DLLEXPORT int STDCALL
+FPDF_StructTree_CountChildren(FPDF_STRUCTTREE struct_tree);
+
+// Function: FPDF_StructTree_GetChildAtIndex
+// Get a child in the structure tree.
+// Parameters:
+// struct_tree - Handle to the struct tree. Returned by
+// FPDF_StructTree_LoadPage function.
+// index - The index for the child, 0-based.
+// Return value:
+// The child at the n-th index or NULL on error.
+DLLEXPORT FPDF_STRUCTELEMENT STDCALL
+FPDF_StructTree_GetChildAtIndex(FPDF_STRUCTTREE struct_tree, int index);
+
+// Function: FPDF_StructElement_GetAltText
+// Get the alt text for a given element.
+// Parameters:
+// struct_element - Handle to the struct element.
+// 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
+// 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.
+DLLEXPORT unsigned long STDCALL
+FPDF_StructElement_GetAltText(FPDF_STRUCTELEMENT struct_element,
+ void* buffer,
+ unsigned long buflen);
+
+// Function: FPDF_StructElement_CountChildren
+// Count the number of children for the structure element.
+// Parameters:
+// struct_element - Handle to the struct element.
+// Return value:
+// The number of children, or -1 on error.
+DLLEXPORT int STDCALL
+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.
+// Return value:
+// The child at the n-th index or NULL on error.
+// Comments:
+// If the child exists but is not an element, then this function will
+// return NULL. This will also return NULL for out of bounds indices.
+DLLEXPORT FPDF_STRUCTELEMENT STDCALL
+FPDF_StructElement_GetChildAtIndex(FPDF_STRUCTELEMENT struct_element,
+ int index);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // PUBLIC_FPDF_STRUCTTREE_H_
diff --git a/public/fpdfview.h b/public/fpdfview.h
index 469053c4e8..581951c7e2 100644
--- a/public/fpdfview.h
+++ b/public/fpdfview.h
@@ -39,6 +39,8 @@ typedef void* FPDF_PAGERANGE;
typedef void* FPDF_PATH;
typedef void* FPDF_RECORDER;
typedef void* FPDF_SCHHANDLE;
+typedef void* FPDF_STRUCTELEMENT;
+typedef void* FPDF_STRUCTTREE;
typedef void* FPDF_TEXTPAGE;
#ifdef PDF_ENABLE_XFA