Home | History | Annotate | Download | only in include
      1 // Copyright 2014 PDFium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
      6 
      7 #ifndef _FPDFDOC_H_
      8 #define _FPDFDOC_H_
      9 
     10 #include "fpdfview.h"
     11 
     12 // Exported Functions
     13 #ifdef __cplusplus
     14 extern "C" {
     15 #endif
     16 
     17 // Function: FPDFBookmark_Find
     18 //			Find a bookmark in the document, using the bookmark title.
     19 // Parameters:
     20 //			document	-	Handle to the document. Returned by FPDF_LoadDocument or FPDF_LoadMemDocument.
     21 //			title		-	The UTF-16LE encoded Unicode string for the bookmark title to be searched. Can't be NULL.
     22 // Return value:
     23 //			Handle to the found bookmark item. NULL if the title can't be found.
     24 // Comments:
     25 //			It always returns the first found bookmark if more than one bookmarks have the same title.
     26 //
     27 DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_Find(FPDF_DOCUMENT document, FPDF_WIDESTRING title);
     28 
     29 // Function: FPDFBookmark_GetDest
     30 //			Get the destination associated with a bookmark item.
     31 // Parameters:
     32 //			document	-	Handle to the document.
     33 //			bookmark	-	Handle to the bookmark.
     34 // Return value:
     35 //			Handle to the destination data. NULL if no destination is associated with this bookmark.
     36 //
     37 DLLEXPORT FPDF_DEST STDCALL FPDFBookmark_GetDest(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark);
     38 
     39 // Function: FPDFBookmark_GetAction
     40 //			Get the action associated with a bookmark item.
     41 // Parameters:
     42 //			bookmark	-	Handle to the bookmark.
     43 // Return value:
     44 //			Handle to the action data. NULL if no action is associated with this bookmark. In this case, the
     45 //			application should try FPDFBookmark_GetDest.
     46 //
     47 DLLEXPORT FPDF_ACTION STDCALL FPDFBookmark_GetAction(FPDF_BOOKMARK bookmark);
     48 
     49 #define PDFACTION_UNSUPPORTED		0		// Unsupported action type.
     50 #define PDFACTION_GOTO				1		// Go to a destination within current document.
     51 #define PDFACTION_REMOTEGOTO		2		// Go to a destination within another document.
     52 #define PDFACTION_URI				3		// Universal Resource Identifier, including web pages and
     53 											// other Internet based resources.
     54 #define PDFACTION_LAUNCH			4		// Launch an application or open a file.
     55 
     56 // Function: FPDFAction_GetType
     57 //			Get type of an action.
     58 // Parameters:
     59 //			action		-	Handle to the action.
     60 // Return value:
     61 //			A type number as defined above.
     62 //
     63 DLLEXPORT unsigned long STDCALL FPDFAction_GetType(FPDF_ACTION action);
     64 
     65 // Function: FPDFAction_GetDest
     66 //			Get destination of an action.
     67 // Parameters:
     68 //			document	-	Handle to the document.
     69 //			action		-	Handle to the action. It must be a GOTO or REMOTEGOTO action.
     70 // Return value:
     71 //			Handle to the destination data.
     72 // Comments:
     73 //			In case of remote goto action, the application should first use FPDFAction_GetFilePath to
     74 //			get file path, then load that particular document, and use its document handle to call this
     75 //			function.
     76 //
     77 DLLEXPORT FPDF_DEST STDCALL FPDFAction_GetDest(FPDF_DOCUMENT document, FPDF_ACTION action);
     78 
     79 // Function: FPDFAction_GetURIPath
     80 //			Get URI path of a URI action.
     81 // Parameters:
     82 //			document	-	Handle to the document.
     83 //			action		-	Handle to the action. Must be a URI action.
     84 //			buffer		-	A buffer for output the path string. Can be NULL.
     85 //			buflen		-	The length of the buffer, number of bytes. Can be 0.
     86 // Return value:
     87 //			Number of bytes the URI path consumes, including trailing zeros.
     88 // Comments:
     89 //			The URI path is always encoded in 7-bit ASCII.
     90 //
     91 //			The return value always indicated number of bytes required for the buffer, even when there is
     92 //			no buffer specified, or the buffer size is less then required. In this case, the buffer will not
     93 //			be modified.
     94 //
     95 DLLEXPORT unsigned long STDCALL FPDFAction_GetURIPath(FPDF_DOCUMENT document, FPDF_ACTION action,
     96 													  void* buffer, unsigned long buflen);
     97 
     98 // Function: FPDFDest_GetPageIndex
     99 //			Get page index of a destination.
    100 // Parameters:
    101 //			document	-	Handle to the document.
    102 //			dest		-	Handle to the destination.
    103 // Return value:
    104 //			The page index. Starting from 0 for the first page.
    105 //
    106 DLLEXPORT unsigned long STDCALL FPDFDest_GetPageIndex(FPDF_DOCUMENT document, FPDF_DEST dest);
    107 
    108 // Function: FPDFLink_GetLinkAtPoint
    109 //			Find a link at specified point on a document page.
    110 // Parameters:
    111 //			page		-	Handle to the document page.
    112 //			x			-	The x coordinate of the point, specified in page coordinate system.
    113 //			y			-	The y coordinate of the point, specified in page coordinate system.
    114 // Return value:
    115 //			Handle to the link. NULL if no link found at that point.
    116 // Comments:
    117 //			The point coordinates are specified in page coordinate system. You can convert coordinates
    118 //			from screen system to page system using FPDF_DeviceToPage functions.
    119 //
    120 DLLEXPORT FPDF_LINK STDCALL FPDFLink_GetLinkAtPoint(FPDF_PAGE page, double x, double y);
    121 
    122 // Function: FPDFLink_GetDest
    123 //			Get destination info of a link.
    124 // Parameters:
    125 //			document	-	Handle to the document.
    126 //			link		-	Handle to the link. Returned by FPDFLink_GetLinkAtPoint.
    127 // Return value:
    128 //			Handle to the destination. NULL if there is no destination associated with the link, in this case
    129 //			the application should try FPDFLink_GetAction.
    130 //
    131 DLLEXPORT FPDF_DEST STDCALL FPDFLink_GetDest(FPDF_DOCUMENT document, FPDF_LINK link);
    132 
    133 // Function: FPDFLink_GetAction
    134 //			Get action info of a link.
    135 // Parameters:
    136 //			link		-	Handle to the link.
    137 // Return value:
    138 //			Handle to the action. NULL if there is no action associated with the link.
    139 //
    140 DLLEXPORT FPDF_ACTION STDCALL FPDFLink_GetAction(FPDF_LINK link);
    141 
    142 // Function: FPDFLink_Enumerate
    143 //			This function would enumerate all the link annotations in a single PDF page.
    144 // Parameters:
    145 //			page[in]			-	Handle to the page.
    146 //			startPos[in,out]	-	The start position to enumerate the link annotations, which should be specified to start from
    147 //								-	0 for the first call, and would receive the next position for enumerating to start from.
    148 //			linkAnnot[out]		-	Receive the link handle.
    149 // Return value:
    150 //			TRUE if succceed, else False;
    151 //
    152 DLLEXPORT FPDF_BOOL STDCALL FPDFLink_Enumerate(FPDF_PAGE page, int* startPos, FPDF_LINK* linkAnnot);
    153 
    154 // Function: FPDFLink_GetAnnotRect
    155 //			Get the annotation rectangle. (Specified by the Rect entry of annotation dictionary).
    156 // Parameters:
    157 //			linkAnnot[in]		-	Handle to the link annotation.
    158 //			rect[out]			-	The annotation rect.
    159 // Return value:
    160 //			TRUE if succceed, else False;
    161 //
    162 DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetAnnotRect(FPDF_LINK linkAnnot, FS_RECTF* rect);
    163 
    164 // Function: FPDFLink_CountQuadPoints
    165 //			Get the count of quadrilateral points to the link annotation.
    166 // Parameters:
    167 //			linkAnnot[in]		-	Handle to the link annotation.
    168 // Return value:
    169 //			The count of quadrilateral points.
    170 //
    171 DLLEXPORT int STDCALL FPDFLink_CountQuadPoints(FPDF_LINK linkAnnot);
    172 
    173 /* _FS_DEF_STRUCTURE_QUADPOINTSF_ */
    174 #ifndef _FS_DEF_STRUCTURE_QUADPOINTSF_
    175 #define _FS_DEF_STRUCTURE_QUADPOINTSF_
    176 typedef struct _FS_QUADPOINTSF
    177 {
    178 	FS_FLOAT  x1;
    179 	FS_FLOAT  y1;
    180 	FS_FLOAT  x2;
    181 	FS_FLOAT  y2;
    182 	FS_FLOAT  x3;
    183 	FS_FLOAT  y3;
    184 	FS_FLOAT  x4;
    185 	FS_FLOAT  y4;
    186 } FS_QUADPOINTSF;
    187 #endif /* _FS_DEF_STRUCTURE_QUADPOINTSF_ */
    188 
    189 // Function: FPDFLink_GetQuadPoints
    190 //			Get the quadrilateral points for the specified index in the link annotation.
    191 // Parameters:
    192 //			linkAnnot[in]		-	Handle to the link annotation.
    193 //			quadIndex[in]		-	The specified quad points index.
    194 //			quadPoints[out]		-	Receive the quadrilateral points.
    195 // Return value:
    196 //			True if succeed, else False.
    197 //
    198 DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetQuadPoints(FPDF_LINK linkAnnot, int quadIndex, FS_QUADPOINTSF* quadPoints);
    199 
    200 // Function: FPDF_GetMetaText
    201 //			Get a text from meta data of the document. Result is encoded in UTF-16LE.
    202 // Parameters:
    203 //			doc			-	Handle to a document
    204 //			tag			-	The tag for the meta data. Currently, It can be "Title", "Author",
    205 //							"Subject", "Keywords", "Creator", "Producer", "CreationDate", or "ModDate".
    206 //							For detailed explanation of these tags and their respective values,
    207 //							please refer to PDF Reference 1.6, section 10.2.1, "Document Information Dictionary".
    208 //			buffer		-	A buffer for output the title. Can be NULL.
    209 //			buflen		-	The length of the buffer, number of bytes. Can be 0.
    210 // Return value:
    211 //			Number of bytes the title consumes, including trailing zeros.
    212 // Comments:
    213 //			No matter on what platform, the title is always output in UTF-16LE encoding, which means the buffer
    214 //			can be regarded as an array of WORD (on Intel and compatible CPUs), each WORD represent the Unicode of
    215 //			a character (some special Unicode may take 2 WORDs). The string is followed by two bytes of zero
    216 //			indicating end of the string.
    217 //
    218 //			The return value always indicated number of bytes required for the buffer, even when there is
    219 //			no buffer specified, or the buffer size is less then required. In this case, the buffer will not
    220 //			be modified.
    221 //
    222 DLLEXPORT unsigned long STDCALL FPDF_GetMetaText(FPDF_DOCUMENT doc, FPDF_BYTESTRING tag,
    223 												 void* buffer, unsigned long buflen);
    224 
    225 
    226 #ifdef __cplusplus
    227 };
    228 #endif
    229 
    230 #endif	// _FPDFDOC_H_
    231