• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2019 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 #ifndef PUBLIC_FPDF_JAVASCRIPT_H_
6 #define PUBLIC_FPDF_JAVASCRIPT_H_
7 
8 // NOLINTNEXTLINE(build/include)
9 #include "fpdfview.h"
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif  // __cplusplus
14 
15 // Experimental API.
16 // Get the number of JavaScript actions in |document|.
17 //
18 //   document - handle to a document.
19 //
20 // Returns the number of JavaScript actions in |document| or -1 on error.
21 FPDF_EXPORT int FPDF_CALLCONV
22 FPDFDoc_GetJavaScriptActionCount(FPDF_DOCUMENT document);
23 
24 // Experimental API.
25 // Get the JavaScript action at |index| in |document|.
26 //
27 //   document - handle to a document.
28 //   index    - the index of the requested JavaScript action.
29 //
30 // Returns the handle to the JavaScript action, or NULL on failure.
31 // Caller owns the returned handle and must close it with
32 // FPDFDoc_CloseJavaScriptAction().
33 FPDF_EXPORT FPDF_JAVASCRIPT_ACTION FPDF_CALLCONV
34 FPDFDoc_GetJavaScriptAction(FPDF_DOCUMENT document, int index);
35 
36 // Experimental API.
37 // Close a loaded FPDF_JAVASCRIPT_ACTION object.
38 
39 //   javascript - Handle to a JavaScript action.
40 FPDF_EXPORT void FPDF_CALLCONV
41 FPDFDoc_CloseJavaScriptAction(FPDF_JAVASCRIPT_ACTION javascript);
42 
43 // Experimental API.
44 // Get the name from the |javascript| handle. |buffer| is only modified if
45 // |buflen| is longer than the length of the name. On errors, |buffer| is
46 // unmodified and the returned length is 0.
47 //
48 //   javascript - handle to an JavaScript action.
49 //   buffer     - buffer for holding the name, encoded in UTF-16LE.
50 //   buflen     - length of the buffer in bytes.
51 //
52 // Returns the length of the JavaScript action name in bytes.
53 FPDF_EXPORT unsigned long FPDF_CALLCONV
54 FPDFJavaScriptAction_GetName(FPDF_JAVASCRIPT_ACTION javascript,
55                              FPDF_WCHAR* buffer,
56                              unsigned long buflen);
57 
58 // Experimental API.
59 // Get the script from the |javascript| handle. |buffer| is only modified if
60 // |buflen| is longer than the length of the script. On errors, |buffer| is
61 // unmodified and the returned length is 0.
62 //
63 //   javascript - handle to an JavaScript action.
64 //   buffer     - buffer for holding the name, encoded in UTF-16LE.
65 //   buflen     - length of the buffer in bytes.
66 //
67 // Returns the length of the JavaScript action name in bytes.
68 FPDF_EXPORT unsigned long FPDF_CALLCONV
69 FPDFJavaScriptAction_GetScript(FPDF_JAVASCRIPT_ACTION javascript,
70                                FPDF_WCHAR* buffer,
71                                unsigned long buflen);
72 
73 #ifdef __cplusplus
74 }  // extern "C"
75 #endif  // __cplusplus
76 
77 #endif  // PUBLIC_FPDF_JAVASCRIPT_H_
78