Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(184)

Unified Diff: public/fpdf_structtree.h

Issue 2519343002: Add APIs for limited use of document tagged code. (Closed)
Patch Set: Fix alt text encoding Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: public/fpdf_structtree.h
diff --git a/public/fpdf_structtree.h b/public/fpdf_structtree.h
new file mode 100644
index 0000000000000000000000000000000000000000..d64558d2c7ed25b82ad1c201e751f184701500ec
--- /dev/null
+++ b/public/fpdf_structtree.h
@@ -0,0 +1,100 @@
+// 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.
dsinclair 2016/11/23 14:04:19 null on failure?
Lei Zhang 2016/11/23 19:49:55 Done.
+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.
dsinclair 2016/11/23 14:04:19 null on failure?
Lei Zhang 2016/11/23 19:49:55 Done.
+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
Lei Zhang 2016/11/23 01:01:36 I should add this is no longer what the client's P
dsinclair 2016/11/23 14:04:19 For curiousity, what do they expect utf-8?
Lei Zhang 2016/11/23 19:49:55 I believe that's the case.
+// 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.
dsinclair 2016/11/23 14:04:19 null on failure?
Lei Zhang 2016/11/23 19:49:55 Added a more detailed comment section.
+DLLEXPORT FPDF_STRUCTELEMENT STDCALL
+FPDF_StructElement_GetChildAtIndex(FPDF_STRUCTELEMENT struct_element,
+ int index);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // PUBLIC_FPDF_STRUCTTREE_H_

Powered by Google App Engine
This is Rietveld 408576698