Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #ifndef PUBLIC_FPDF_DOC_H_ | 7 #ifndef PUBLIC_FPDF_DOC_H_ |
| 8 #define PUBLIC_FPDF_DOC_H_ | 8 #define PUBLIC_FPDF_DOC_H_ |
| 9 | 9 |
| 10 #include "fpdfview.h" | 10 #include "fpdfview.h" |
| 11 | 11 |
| 12 // Exported Functions | |
| 13 #ifdef __cplusplus | 12 #ifdef __cplusplus |
| 14 extern "C" { | 13 extern "C" { |
| 15 #endif | 14 #endif // __cplusplus |
| 16 | 15 |
| 17 // Function: FPDFBookmark_GetFirstChild | 16 // Unsupported action type. |
| 18 // Get the first child of a bookmark item, or the first top level | 17 #define PDFACTION_UNSUPPORTED 0 |
| 19 // bookmark item. | 18 // Go to a destination within current document. |
| 20 // Parameters: | 19 #define PDFACTION_GOTO 1 |
| 21 // document - Handle to the document. Returned by | 20 // Go to a destination within another document. |
| 22 // FPDF_LoadDocument or FPDF_LoadMemDocument. | 21 #define PDFACTION_REMOTEGOTO 2 |
| 23 // bookmark - Handle to the current bookmark. Can be NULL if you | 22 // URI, including web pages and other Internet resources. |
| 24 // want to get the first top level item. | 23 #define PDFACTION_URI 3 |
| 25 // Return value: | 24 // Launch an application or open a file. |
| 26 // Handle to the first child or top level bookmark item. NULL if no | 25 #define PDFACTION_LAUNCH 4 |
| 27 // child or top level bookmark found. | 26 |
| 28 // | |
| 29 DLLEXPORT FPDF_BOOKMARK STDCALL | |
| 30 FPDFBookmark_GetFirstChild(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark); | |
| 31 | |
| 32 // Function: FPDFBookmark_GetNextSibling | |
| 33 // Get next bookmark item at the same level. | |
| 34 // Parameters: | |
| 35 // document - Handle to the document. Returned by | |
| 36 // FPDF_LoadDocument or FPDF_LoadMemDocument. | |
| 37 // bookmark - Handle to the current bookmark. Cannot be NULL. | |
| 38 // Return value: | |
| 39 // Handle to the next bookmark item at the same level. NULL if this is | |
| 40 // the last bookmark at this level. | |
| 41 // | |
| 42 DLLEXPORT FPDF_BOOKMARK STDCALL | |
| 43 FPDFBookmark_GetNextSibling(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark); | |
| 44 | |
| 45 // Function: FPDFBookmark_GetTitle | |
| 46 // Get title of a bookmark. | |
| 47 // Parameters: | |
| 48 // bookmark - Handle to the bookmark. | |
| 49 // buffer - Buffer for the title. Can be NULL. | |
| 50 // buflen - The length of the buffer in bytes. Can be 0. | |
| 51 // Return value: | |
| 52 // Number of bytes the title consumes, including trailing zeros. | |
| 53 // Comments: | |
| 54 // Regardless of the platform, the title is always in UTF-16LE | |
| 55 // encoding. That means the buffer | |
| 56 // can be treated as an array of WORD (on Intel and compatible CPUs), | |
| 57 // each WORD representing the Unicode of | |
| 58 // a character(some special Unicode may take 2 WORDs).The string is | |
| 59 // followed by two bytes of zero | |
| 60 // indicating the end of the string. | |
| 61 // | |
| 62 // The return value always indicates the number of bytes required for | |
| 63 // the buffer, even if no buffer is specified | |
| 64 // or the buffer size is less then required. In these cases, the buffer | |
| 65 // will not be modified. | |
| 66 // | |
| 67 DLLEXPORT unsigned long STDCALL FPDFBookmark_GetTitle(FPDF_BOOKMARK bookmark, | |
| 68 void* buffer, | |
| 69 unsigned long buflen); | |
| 70 | |
| 71 // Function: FPDFBookmark_Find | |
| 72 // Find a bookmark in the document, using the bookmark title. | |
| 73 // Parameters: | |
| 74 // document - Handle to the document. Returned by | |
| 75 // FPDF_LoadDocument or FPDF_LoadMemDocument. | |
| 76 // title - The UTF-16LE encoded Unicode string for the bookmark | |
| 77 // title to be searched. Can't be NULL. | |
| 78 // Return value: | |
| 79 // Handle to the found bookmark item. NULL if the title can't be found. | |
| 80 // Comments: | |
| 81 // It always returns the first found bookmark if more than one | |
| 82 // bookmarks have the same title. | |
| 83 // | |
| 84 DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_Find(FPDF_DOCUMENT document, | |
| 85 FPDF_WIDESTRING title); | |
| 86 | |
| 87 // Function: FPDFBookmark_GetDest | |
| 88 // Get the destination associated with a bookmark item. | |
| 89 // Parameters: | |
| 90 // document - Handle to the document. | |
| 91 // bookmark - Handle to the bookmark. | |
| 92 // Return value: | |
| 93 // Handle to the destination data. NULL if no destination is associated | |
| 94 // with this bookmark. | |
| 95 // | |
| 96 DLLEXPORT FPDF_DEST STDCALL FPDFBookmark_GetDest(FPDF_DOCUMENT document, | |
| 97 FPDF_BOOKMARK bookmark); | |
| 98 | |
| 99 // Function: FPDFBookmark_GetAction | |
| 100 // Get the action associated with a bookmark item. | |
| 101 // Parameters: | |
| 102 // bookmark - Handle to the bookmark. | |
| 103 // Return value: | |
| 104 // Handle to the action data. NULL if no action is associated with this | |
| 105 // bookmark. In this case, the | |
| 106 // application should try FPDFBookmark_GetDest. | |
| 107 // | |
| 108 DLLEXPORT FPDF_ACTION STDCALL FPDFBookmark_GetAction(FPDF_BOOKMARK bookmark); | |
| 109 | |
| 110 #define PDFACTION_UNSUPPORTED 0 // Unsupported action type. | |
| 111 #define PDFACTION_GOTO 1 // Go to a destination within current document. | |
| 112 #define PDFACTION_REMOTEGOTO 2 // Go to a destination within another document. | |
| 113 #define PDFACTION_URI 3 // Universal Resource Identifier, including web | |
| 114 // pages and other Internet based resources. | |
| 115 #define PDFACTION_LAUNCH 4 // Launch an application or open a file. | |
| 116 | |
| 117 // Function: FPDFAction_GetType | |
| 118 // Get type of an action. | |
| 119 // Parameters: | |
| 120 // action - Handle to the action. | |
| 121 // Return value: | |
| 122 // A type number as defined above. | |
| 123 // | |
| 124 DLLEXPORT unsigned long STDCALL FPDFAction_GetType(FPDF_ACTION action); | |
| 125 | |
| 126 // Function: FPDFAction_GetDest | |
| 127 // Get destination of an action. | |
| 128 // Parameters: | |
| 129 // document - Handle to the document. | |
| 130 // action - Handle to the action. It must be a GOTO or | |
| 131 // REMOTEGOTO action. | |
| 132 // Return value: | |
| 133 // Handle to the destination data. | |
| 134 // Comments: | |
| 135 // In case of remote goto action, the application should first use | |
| 136 // FPDFAction_GetFilePath to | |
| 137 // get file path, then load that particular document, and use its | |
| 138 // document handle to call this | |
| 139 // function. | |
| 140 // | |
| 141 DLLEXPORT FPDF_DEST STDCALL FPDFAction_GetDest(FPDF_DOCUMENT document, | |
| 142 FPDF_ACTION action); | |
| 143 | |
| 144 // Function: FPDFAction_GetFilePath | |
| 145 // Get file path of a remote goto action. | |
| 146 // Parameters: | |
| 147 // action - Handle to the action. Must be a REMOTEGOTO or | |
| 148 // LAUNCH action. | |
| 149 // buffer - A buffer for output the path string. Can be NULL. | |
| 150 // buflen - The length of the buffer, number of bytes. Can be 0. | |
| 151 // Return value: | |
| 152 // Number of bytes the file path consumes, including trailing zero. | |
| 153 // | |
| 154 // Comments: | |
| 155 // The file path is UTF-8 encoded. The return value is the number of | |
| 156 // bytes required for the buffer, even when there is no buffer | |
| 157 // specified, or the buffer size is less then required. In this case, | |
| 158 // the buffer will not be modified. | |
| 159 // | |
| 160 DLLEXPORT unsigned long STDCALL | |
| 161 FPDFAction_GetFilePath(FPDF_ACTION action, void* buffer, unsigned long buflen); | |
| 162 | |
| 163 // Function: FPDFAction_GetURIPath | |
| 164 // Get URI path of a URI action. | |
| 165 // Parameters: | |
| 166 // document - Handle to the document. | |
| 167 // action - Handle to the action. Must be a URI action. | |
| 168 // buffer - A buffer for output the path string. Can be NULL. | |
| 169 // buflen - The length of the buffer, number of bytes. Can be 0. | |
| 170 // Return value: | |
| 171 // Number of bytes the URI path consumes, including trailing zeros. | |
| 172 // Comments: | |
| 173 // The URI path is always encoded in 7-bit ASCII. | |
| 174 // | |
| 175 // The return value is the number of bytes required for the buffer, | |
| 176 // even when there is no buffer specified, or the buffer size is less | |
| 177 // then required. In this case, the buffer will not be modified. | |
| 178 // | |
| 179 DLLEXPORT unsigned long STDCALL FPDFAction_GetURIPath(FPDF_DOCUMENT document, | |
| 180 FPDF_ACTION action, | |
| 181 void* buffer, | |
| 182 unsigned long buflen); | |
| 183 | |
| 184 // Function: FPDFDest_GetPageIndex | |
| 185 // Get page index of a destination. | |
| 186 // Parameters: | |
| 187 // document - Handle to the document. | |
| 188 // dest - Handle to the destination. | |
| 189 // Return value: | |
| 190 // The page index. Starting from 0 for the first page. | |
| 191 // | |
| 192 DLLEXPORT unsigned long STDCALL FPDFDest_GetPageIndex(FPDF_DOCUMENT document, | |
| 193 FPDF_DEST dest); | |
| 194 | |
| 195 // Function: FPDFLink_GetLinkAtPoint | |
| 196 // Find a link at specified point on a document page. | |
| 197 // Parameters: | |
| 198 // page - Handle to the document page. | |
| 199 // x - The x coordinate of the point, specified in page | |
| 200 // coordinate system. | |
| 201 // y - The y coordinate of the point, specified in page | |
| 202 // coordinate system. | |
| 203 // Return value: | |
| 204 // Handle to the link. NULL if no link found at that point. | |
| 205 // Comments: | |
| 206 // The point coordinates are specified in page coordinate system. You can | |
| 207 // convert coordinates from screen system to page system using | |
| 208 // FPDF_DeviceToPage(). | |
| 209 // | |
| 210 DLLEXPORT FPDF_LINK STDCALL FPDFLink_GetLinkAtPoint(FPDF_PAGE page, | |
| 211 double x, | |
| 212 double y); | |
| 213 | |
| 214 // Function: FPDFLink_GetLinkZOrderAtPoint | |
| 215 // Find the z-order of a link at specified point on a document page. | |
| 216 // Parameters: | |
| 217 // page - Handle to the document page. | |
| 218 // x - The x coordinate of the point, specified in page | |
| 219 // coordinate system. | |
| 220 // y - The y coordinate of the point, specified in page | |
| 221 // coordinate system. | |
| 222 // Return value: | |
| 223 // Z-order of the link, or -1 if no link found at that point. | |
| 224 // Higher numbers are closer to the front. | |
| 225 // Comments: | |
| 226 // The point coordinates are specified in page coordinate system. You can | |
| 227 // convert coordinates from screen system to page system using | |
| 228 // FPDF_DeviceToPage(). | |
| 229 // | |
| 230 DLLEXPORT int STDCALL | |
| 231 FPDFLink_GetLinkZOrderAtPoint(FPDF_PAGE page, double x, double y); | |
| 232 | |
| 233 // Function: FPDFLink_GetDest | |
| 234 // Get destination info of a link. | |
| 235 // Parameters: | |
| 236 // document - Handle to the document. | |
| 237 // link - Handle to the link. Returned by | |
| 238 // FPDFLink_GetLinkAtPoint. | |
| 239 // Return value: | |
| 240 // Handle to the destination. NULL if there is no destination | |
| 241 // associated with the link, in this case | |
| 242 // the application should try FPDFLink_GetAction. | |
| 243 // | |
| 244 DLLEXPORT FPDF_DEST STDCALL FPDFLink_GetDest(FPDF_DOCUMENT document, | |
| 245 FPDF_LINK link); | |
| 246 | |
| 247 // Function: FPDFLink_GetAction | |
| 248 // Get action info of a link. | |
| 249 // Parameters: | |
| 250 // link - Handle to the link. | |
| 251 // Return value: | |
| 252 // Handle to the action. NULL if there is no action associated with the | |
| 253 // link. | |
| 254 // | |
| 255 DLLEXPORT FPDF_ACTION STDCALL FPDFLink_GetAction(FPDF_LINK link); | |
| 256 | |
| 257 // Function: FPDFLink_Enumerate | |
| 258 // This function would enumerate all the link annotations in a single | |
| 259 // PDF page. | |
| 260 // Parameters: | |
| 261 // page[in] - Handle to the page. | |
| 262 // startPos[in,out] - The start position to enumerate the link | |
| 263 // annotations, which should be specified to start from | |
| 264 // - 0 for the first call, and would receive the | |
| 265 // next position for enumerating to start from. | |
| 266 // linkAnnot[out] - Receive the link handle. | |
| 267 // Return value: | |
| 268 // TRUE if succceed, else False; | |
| 269 // | |
| 270 DLLEXPORT FPDF_BOOL STDCALL FPDFLink_Enumerate(FPDF_PAGE page, | |
| 271 int* startPos, | |
| 272 FPDF_LINK* linkAnnot); | |
| 273 | |
| 274 // Function: FPDFLink_GetAnnotRect | |
| 275 // Get the annotation rectangle. (Specified by the |Rect| entry of | |
| 276 // annotation dictionary). | |
| 277 // Parameters: | |
| 278 // linkAnnot[in] - Handle to the link annotation. | |
| 279 // rect[out] - The annotation rect. | |
| 280 // Return value: | |
| 281 // TRUE if succceed, else False; | |
| 282 // | |
| 283 DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetAnnotRect(FPDF_LINK linkAnnot, | |
| 284 FS_RECTF* rect); | |
| 285 | |
| 286 // Function: FPDFLink_CountQuadPoints | |
| 287 // Get the count of quadrilateral points to the link annotation. | |
| 288 // Parameters: | |
| 289 // linkAnnot[in] - Handle to the link annotation. | |
| 290 // Return value: | |
| 291 // The count of quadrilateral points. | |
| 292 // | |
| 293 DLLEXPORT int STDCALL FPDFLink_CountQuadPoints(FPDF_LINK linkAnnot); | |
| 294 | |
| 295 /* _FS_DEF_STRUCTURE_QUADPOINTSF_ */ | |
| 296 #ifndef _FS_DEF_STRUCTURE_QUADPOINTSF_ | 27 #ifndef _FS_DEF_STRUCTURE_QUADPOINTSF_ |
|
Tom Sepez
2016/03/24 18:32:14
not needed, FS_QUADPOINTSF only defined here, top-
dsinclair
2016/03/25 02:06:08
Done.
| |
| 297 #define _FS_DEF_STRUCTURE_QUADPOINTSF_ | 28 #define _FS_DEF_STRUCTURE_QUADPOINTSF_ |
| 29 | |
| 298 typedef struct _FS_QUADPOINTSF { | 30 typedef struct _FS_QUADPOINTSF { |
| 299 FS_FLOAT x1; | 31 FS_FLOAT x1; |
| 300 FS_FLOAT y1; | 32 FS_FLOAT y1; |
| 301 FS_FLOAT x2; | 33 FS_FLOAT x2; |
| 302 FS_FLOAT y2; | 34 FS_FLOAT y2; |
| 303 FS_FLOAT x3; | 35 FS_FLOAT x3; |
| 304 FS_FLOAT y3; | 36 FS_FLOAT y3; |
| 305 FS_FLOAT x4; | 37 FS_FLOAT x4; |
| 306 FS_FLOAT y4; | 38 FS_FLOAT y4; |
| 307 } FS_QUADPOINTSF; | 39 } FS_QUADPOINTSF; |
| 40 | |
| 308 #endif /* _FS_DEF_STRUCTURE_QUADPOINTSF_ */ | 41 #endif /* _FS_DEF_STRUCTURE_QUADPOINTSF_ */ |
| 309 | 42 |
| 310 // Function: FPDFLink_GetQuadPoints | 43 // Get the first child of |bookmark|, or the first top level bookmark item. |
|
Tom Sepez
2016/03/24 18:32:15
nit: if I were really picky, I'd say that top-leve
dsinclair
2016/03/25 02:06:08
Done.
| |
| 311 // Get the quadrilateral points for the specified index in the link | 44 // |
| 312 // annotation. | 45 // document - handle to the document. |
| 313 // Parameters: | 46 // bookmark - handle to the current bookmark. Pass NULL for the first top |
| 314 // linkAnnot[in] - Handle to the link annotation. | 47 // level item. |
| 315 // quadIndex[in] - The specified quad points index. | 48 // |
| 316 // quadPoints[out] - Receive the quadrilateral points. | 49 // Returns a handle to the first child of |bookmark| or the first top level |
| 317 // Return value: | 50 // bookmark item. NULL if no child or top level bookmark found. |
| 318 // True if succeed, else False. | 51 DLLEXPORT FPDF_BOOKMARK STDCALL |
| 319 // | 52 FPDFBookmark_GetFirstChild(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark); |
| 53 | |
| 54 // Get the next sibling of |bookmark|. | |
| 55 // | |
| 56 // document - handle to the document. | |
| 57 // bookmark - handle to the current bookmark. | |
| 58 // | |
| 59 // Returns a handle to the next sibling of |bookmark|, NULL if this is the last | |
| 60 // bookmark at this level. | |
|
Tom Sepez
2016/03/24 18:32:15
nit: , or NULL
dsinclair
2016/03/25 02:06:08
Done.
| |
| 61 DLLEXPORT FPDF_BOOKMARK STDCALL | |
| 62 FPDFBookmark_GetNextSibling(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark); | |
| 63 | |
| 64 // Get the title of |bookmark|. | |
| 65 // | |
| 66 // bookmark - handle to the bookmark. | |
| 67 // buffer - buffer for the title. May be NULL. | |
| 68 // buflen - the length of the buffer in bytes. May be 0. | |
| 69 // | |
| 70 // Returns the number of bytes in the title, including trailing zeros. The | |
|
Tom Sepez
2016/03/24 18:32:14
s/trailing zeros/the terminating NUL character/
dsinclair
2016/03/25 02:06:09
Done.
| |
| 71 // number of bytes is returned regardless of the |buffer| and |buflen| | |
| 72 // parameters. | |
| 73 // | |
| 74 // Regardless of the platform, the |buffer| is always in UTF-16LE encoding. The | |
| 75 // string is terminated by two bytes of zeros. If |buflen| is less then the | |
|
Tom Sepez
2016/03/24 18:32:14
terminated by a UTF16 NUL character (U+0000, two b
dsinclair
2016/03/25 02:06:08
Done.
| |
| 76 // returned length, or |buffer| is NULL, |buffer| will not be modified. | |
|
Tom Sepez
2016/03/24 18:32:14
s/returned/required/
dsinclair
2016/03/25 02:06:08
Done.
| |
| 77 DLLEXPORT unsigned long STDCALL FPDFBookmark_GetTitle(FPDF_BOOKMARK bookmark, | |
| 78 void* buffer, | |
| 79 unsigned long buflen); | |
| 80 | |
| 81 // Find the bookmark with |title| in |document|. | |
| 82 // | |
| 83 // document - handle to the document. | |
| 84 // title - the UTF-16LE encoded Unicode title with which to search. | |
|
Tom Sepez
2016/03/24 18:32:14
nit: for which ?
dsinclair
2016/03/25 02:06:08
Done.
So much work to not say' title to search fo
| |
| 85 // | |
| 86 // Returns the handle to the bookmark, NULL if |title| can't be found. | |
|
Tom Sepez
2016/03/24 18:32:14
nit:, or NULL, several other places.
dsinclair
2016/03/25 02:06:08
Done.
| |
| 87 // | |
| 88 // |FPDFBookmark_Find| will always return the first bookmark found even if | |
| 89 // multiple bookmarks have the same |title|. | |
| 90 DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_Find(FPDF_DOCUMENT document, | |
| 91 FPDF_WIDESTRING title); | |
| 92 | |
| 93 // Get the destination associated with |bookmark|. | |
| 94 // | |
| 95 // document - handle to the document. | |
| 96 // bookmark - handle to the bookmark. | |
| 97 // | |
| 98 // Returns the handle to the destination data, NULL if no destination is | |
| 99 // associated with |bookmark|. | |
| 100 DLLEXPORT FPDF_DEST STDCALL FPDFBookmark_GetDest(FPDF_DOCUMENT document, | |
| 101 FPDF_BOOKMARK bookmark); | |
| 102 | |
| 103 // Get the action associated with |bookmark|. | |
| 104 // | |
| 105 // bookmark - handle to the bookmark. | |
| 106 // | |
| 107 // Returns the handle to the action data, NULL if no action is associated with | |
| 108 // |bookmark|. When NULL is returned, |FPDFBookmark_GetDest| should be called | |
| 109 // to get the |bookmark| destination data. | |
| 110 DLLEXPORT FPDF_ACTION STDCALL FPDFBookmark_GetAction(FPDF_BOOKMARK bookmark); | |
| 111 | |
| 112 // Get the type of |action|. | |
| 113 // | |
| 114 // action - handle to the action. | |
| 115 // | |
| 116 // Returns one of: | |
| 117 // PDFACTION_UNSUPPORTED | |
| 118 // PDFACTION_GOTO | |
| 119 // PDFACTION_REMOTEGOTO | |
| 120 // PDFACTION_URI | |
| 121 // PDFACTION_LAUNCH | |
| 122 DLLEXPORT unsigned long STDCALL FPDFAction_GetType(FPDF_ACTION action); | |
| 123 | |
| 124 // Get the destination of |action|. | |
| 125 // | |
| 126 // document - handle to the document. | |
| 127 // action - handle to the action. |action| must be a |PDFACTION_GOTO| or | |
|
Tom Sepez
2016/03/24 18:32:14
Document what happens if it's not down below.
dsinclair
2016/03/25 02:06:08
I don't know, added to my list of TODO items to fi
| |
| 128 // |PDFACTION_REMOTEGOTO|. | |
| 129 // | |
| 130 // Returns a handle to the destination data. | |
| 131 // | |
| 132 // In the case of |PDFACTION_REMOTEGOTO|, you should first call | |
| 133 // |FPDFAction_GetFilePath| then load that document, the document handle from | |
| 134 // that document should pass as |document| to |FPDFAction_GetDest|. | |
| 135 DLLEXPORT FPDF_DEST STDCALL FPDFAction_GetDest(FPDF_DOCUMENT document, | |
| 136 FPDF_ACTION action); | |
| 137 | |
| 138 // Get file path of a |PDFACTION_REMOTEGOTO| |action|. | |
| 139 // | |
| 140 // action - handle to the action. |action| must be a |PDFACTION_LAUNCH| or | |
| 141 // |PDFACTION_REMOTEGOTO| | |
| 142 // buffer - a buffer for output the path string. May be NULL. | |
| 143 // buflen - the length of the buffer, in bytes. May be 0. | |
| 144 // | |
| 145 // Returns the number of bytes in the file path, including the trailing zero. | |
|
Tom Sepez
2016/03/24 18:32:14
s/trailing UTF16 NUL character/
dsinclair
2016/03/25 02:06:08
Done.
| |
| 146 // | |
| 147 // Regardless of the platform, the |buffer| is always in UTF-16LE encoding. | |
| 148 // If |buflen| is less then the returned length, or |buffer| is NULL, |buffer| | |
| 149 // will not be modified. | |
| 150 DLLEXPORT unsigned long STDCALL | |
| 151 FPDFAction_GetFilePath(FPDF_ACTION action, void* buffer, unsigned long buflen); | |
| 152 | |
| 153 // Get the URI path of a |PDFACTION_URI| |action|. | |
| 154 // | |
| 155 // document - handle to the document. | |
| 156 // action - handle to the action. Must be a |PDFACTION_URI|. | |
| 157 // buffer - a buffer for the path string. May be NULL. | |
| 158 // buflen - the length of the buffer, in bytes. May be 0. | |
| 159 // | |
| 160 // Returns the number of bytes in the URI path, including trailing zeros. | |
| 161 // | |
| 162 // The |buffer| is always encoded in 7-bit ASCII. If |buflen| is less then the | |
| 163 // returned length, or |buffer| is NULL, |buffer| will not be modified. | |
| 164 DLLEXPORT unsigned long STDCALL FPDFAction_GetURIPath(FPDF_DOCUMENT document, | |
| 165 FPDF_ACTION action, | |
| 166 void* buffer, | |
| 167 unsigned long buflen); | |
| 168 | |
| 169 // Get the page index of |dest|. | |
| 170 // | |
| 171 // document - handle to the document. | |
| 172 // dest - handle to the destination. | |
| 173 // | |
| 174 // Returns the page index containing |dest|. Page indices start from 0. | |
| 175 DLLEXPORT unsigned long STDCALL FPDFDest_GetPageIndex(FPDF_DOCUMENT document, | |
| 176 FPDF_DEST dest); | |
| 177 | |
| 178 // Find a link at point (|x|,|y|) on |page|. | |
| 179 // | |
| 180 // page - handle to the document page. | |
| 181 // x - the x coordinate, in the page coordinate system. | |
| 182 // y - the y coordinate, in the page coordinate system. | |
| 183 // | |
| 184 // Returns a handle to the link, NULL if no link found at the given point. | |
| 185 // | |
| 186 // You can convert coordinates from screen coordinates to page coordinates using | |
| 187 // |FPDF_DeviceToPage|. | |
| 188 DLLEXPORT FPDF_LINK STDCALL FPDFLink_GetLinkAtPoint(FPDF_PAGE page, | |
| 189 double x, | |
| 190 double y); | |
| 191 | |
| 192 // Find the Z-order of link at point (|x|,|y|) on |page|. | |
| 193 // | |
| 194 // page - handle to the document page. | |
| 195 // x - the x coordinate, in the page coordinate system. | |
| 196 // y - the y coordinate, in the page coordinate system. | |
| 197 // | |
| 198 // Returns the Z-order of the link, or -1 if no link found at the given point. | |
| 199 // Larger Z-order numbers are closer to the front. | |
| 200 // | |
| 201 // You can convert coordinates from screen coordinates to page coordinates using | |
| 202 // |FPDF_DeviceToPage|. | |
| 203 DLLEXPORT int STDCALL | |
| 204 FPDFLink_GetLinkZOrderAtPoint(FPDF_PAGE page, double x, double y); | |
| 205 | |
| 206 // Get destination info for |link|. | |
| 207 // | |
| 208 // document - handle to the document. | |
| 209 // link - handle to the link. | |
| 210 // | |
| 211 // Returns a handle to the destination, NULL if there is no destination | |
| 212 // associated with the link. In this case, you should call |FPDFLink_GetAction| | |
| 213 // to retrieve the action associated with |link|. | |
| 214 DLLEXPORT FPDF_DEST STDCALL FPDFLink_GetDest(FPDF_DOCUMENT document, | |
| 215 FPDF_LINK link); | |
| 216 | |
| 217 // Get action info for |link|. | |
| 218 // | |
| 219 // link - handle to the link. | |
| 220 // | |
| 221 // Returns a handle to the action associated to |link|, NULL if no action. | |
| 222 DLLEXPORT FPDF_ACTION STDCALL FPDFLink_GetAction(FPDF_LINK link); | |
| 223 | |
| 224 // Enumerates all the link annotations in |page|. | |
| 225 // | |
| 226 // page - handle to the page. | |
| 227 // startPos - the start position, should initially be 0 and is updated with | |
| 228 // the next start position on return. | |
| 229 // linkAnnot - the link handle for |startPos|. | |
| 230 // | |
| 231 // Returns TRUE on success. | |
| 232 DLLEXPORT FPDF_BOOL STDCALL FPDFLink_Enumerate(FPDF_PAGE page, | |
| 233 int* startPos, | |
| 234 FPDF_LINK* linkAnnot); | |
| 235 | |
| 236 // Get the rectangle for |linkAnnot|. | |
| 237 // | |
| 238 // linkAnnot - handle to the link annotation. | |
| 239 // rect - the annotation rectangle. | |
| 240 // | |
| 241 // Returns true on success. | |
| 242 DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetAnnotRect(FPDF_LINK linkAnnot, | |
| 243 FS_RECTF* rect); | |
| 244 | |
| 245 // Get the count of quadrilateral points to the |linkAnnot|. | |
| 246 // | |
| 247 // linkAnnot - handle to the link annotation. | |
| 248 // | |
| 249 // Returns the count of quadrilateral points. | |
| 250 DLLEXPORT int STDCALL FPDFLink_CountQuadPoints(FPDF_LINK linkAnnot); | |
| 251 | |
| 252 // Get the quadrilateral points for the specified |quadIndex| in |linkAnnot|. | |
| 253 // | |
| 254 // linkAnnot - handle to the link annotation. | |
| 255 // quadIndex - the specified quad point index. | |
| 256 // quadPoints - receives the quadrilateral points. | |
| 257 // | |
| 258 // Returns true on success. | |
| 320 DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetQuadPoints(FPDF_LINK linkAnnot, | 259 DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetQuadPoints(FPDF_LINK linkAnnot, |
| 321 int quadIndex, | 260 int quadIndex, |
| 322 FS_QUADPOINTSF* quadPoints); | 261 FS_QUADPOINTSF* quadPoints); |
| 323 | 262 |
| 324 // Function: FPDF_GetMetaText | 263 // Get meta-data |tag| content from |document|. |
| 325 // Get a text from meta data of the document. Result is encoded in | 264 // |
| 326 // UTF-16LE. | 265 // doc - handle to the document |
| 327 // Parameters: | 266 // tag - the tag to retrieve. The tag can be one of: |
| 328 // doc - Handle to a document | 267 // Title, Author, Subject, Keywords, Creator, Producer, |
| 329 // tag - The tag for the meta data. Currently, It can be | 268 // CreationDate, or ModDate. |
| 330 // "Title", "Author", | 269 // For detailed explanations of these tags and their respective |
| 331 // "Subject", "Keywords", "Creator", "Producer", | 270 // values, please refer to PDF Reference 1.6, section 10.2.1, |
| 332 // "CreationDate", or "ModDate". | 271 // 'Document Information Dictionary'. |
| 333 // For detailed explanation of these tags and their | 272 // buffer - a buffer for the title. May be NULL. |
| 334 // respective values, | 273 // buflen - the length of the buffer, in bytes. May be 0. |
| 335 // please refer to PDF Reference 1.6, section 10.2.1, | 274 // |
| 336 // "Document Information Dictionary". | 275 // Returns the number of bytes in the title, including trailing zeros. |
| 337 // buffer - A buffer for output the title. Can be NULL. | 276 // |
| 338 // buflen - The length of the buffer, number of bytes. Can be 0. | 277 // The |buffer| is always encoded in UTF-16LE. The |buffer| is followed by two |
| 339 // Return value: | 278 // bytes of zeros indicating the end of the string. If |buflen| is less then |
| 340 // Number of bytes the title consumes, including trailing zeros. | 279 // the returned length, or |buffer| is NULL, |buffer| will not be modified. |
| 341 // Comments: | |
| 342 // No matter on what platform, the title is always output in UTF-16LE | |
| 343 // encoding, which means the buffer | |
| 344 // can be regarded as an array of WORD (on Intel and compatible CPUs), | |
| 345 // each WORD represent the Unicode of | |
| 346 // a character (some special Unicode may take 2 WORDs). The string is | |
| 347 // followed by two bytes of zero | |
| 348 // indicating end of the string. | |
| 349 // | |
| 350 // The return value always indicated number of bytes required for the | |
| 351 // buffer, even when there is | |
| 352 // no buffer specified, or the buffer size is less then required. In | |
| 353 // this case, the buffer will not | |
| 354 // be modified. | |
| 355 // | |
| 356 DLLEXPORT unsigned long STDCALL FPDF_GetMetaText(FPDF_DOCUMENT doc, | 280 DLLEXPORT unsigned long STDCALL FPDF_GetMetaText(FPDF_DOCUMENT doc, |
| 357 FPDF_BYTESTRING tag, | 281 FPDF_BYTESTRING tag, |
| 358 void* buffer, | 282 void* buffer, |
| 359 unsigned long buflen); | 283 unsigned long buflen); |
| 360 | 284 |
| 361 #ifdef __cplusplus | 285 #ifdef __cplusplus |
| 362 } | 286 } // extern "C" |
| 363 #endif | 287 #endif // __cplusplus |
| 364 | 288 |
| 365 #endif // PUBLIC_FPDF_DOC_H_ | 289 #endif // PUBLIC_FPDF_DOC_H_ |
| OLD | NEW |