Commit b5efa708 authored by Allison Vacanti's avatar Allison Vacanti

Merge branch 'upstream-libharu' into update_libharu

* upstream-libharu:
  libharu 2018-10-03 (bfc84ae5)
parents 74d94885 2f69cc63
...@@ -67,13 +67,13 @@ case of most of UNIX, these libraries are usually installed.) ...@@ -67,13 +67,13 @@ case of most of UNIX, these libraries are usually installed.)
* *
* Available development environment * Available development environment
* *
Haru can work as both static-library (.a, .lib) and shared-library (.so, .dll). Haru can work as both a static-library (.a, .lib) and a shared-library (.so, .dll).
When you use it as static-library, It can be used by C and a C++. When you use it as a static-library, It can be used by C and C++.
But when you use it as shared-library, it can be used by many development But when you use it as a shared-library, it can be used by many development
languages which support shared library. languages which support shared libraries.
So far, Haru provides bindings for Ruby, Delphi/Free Pascal and C#. So far, Haru provides bindings for Ruby, Delphi/Free Pascal, and C#.
If you write bindings for other programing languages, please notice me! If you write bindings for other programing languages, please inform me!
* *
* Runtime environment of programs using Haru * Runtime environment of programs using Haru
......
...@@ -80,6 +80,7 @@ typedef HPDF_HANDLE HPDF_EmbeddedFile; ...@@ -80,6 +80,7 @@ typedef HPDF_HANDLE HPDF_EmbeddedFile;
typedef HPDF_HANDLE HPDF_OutputIntent; typedef HPDF_HANDLE HPDF_OutputIntent;
typedef HPDF_HANDLE HPDF_Xref; typedef HPDF_HANDLE HPDF_Xref;
typedef HPDF_HANDLE HPDF_Shading; typedef HPDF_HANDLE HPDF_Shading;
typedef HPDF_HANDLE HPDF_Boolean;
#else #else
...@@ -194,6 +195,9 @@ HPDF_GetPageByIndex (HPDF_Doc pdf, ...@@ -194,6 +195,9 @@ HPDF_GetPageByIndex (HPDF_Doc pdf,
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
HPDF_EXPORT(HPDF_MMgr)
HPDF_GetPageMMgr (HPDF_Page page);
HPDF_EXPORT(HPDF_PageLayout) HPDF_EXPORT(HPDF_PageLayout)
HPDF_GetPageLayout (HPDF_Doc pdf); HPDF_GetPageLayout (HPDF_Doc pdf);
...@@ -453,13 +457,31 @@ HPDF_EXPORT(HPDF_STATUS) ...@@ -453,13 +457,31 @@ HPDF_EXPORT(HPDF_STATUS)
HPDF_UseUTFEncodings (HPDF_Doc pdf); HPDF_UseUTFEncodings (HPDF_Doc pdf);
/*--------------------------------------------------------------------------*/
/*----- XObject ------------------------------------------------------------*/
HPDF_EXPORT(HPDF_XObject)
HPDF_Page_CreateXObjectFromImage (HPDF_Doc pdf,
HPDF_Page page,
HPDF_Rect rect,
HPDF_Image image,
HPDF_Boolean zoom);
HPDF_EXPORT(HPDF_XObject)
HPDF_Page_CreateXObjectAsWhiteRect (HPDF_Doc pdf,
HPDF_Page page,
HPDF_Rect rect);
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
/*----- annotation ---------------------------------------------------------*/ /*----- annotation ---------------------------------------------------------*/
HPDF_EXPORT(HPDF_Annotation) HPDF_EXPORT(HPDF_Annotation)
HPDF_Page_Create3DAnnot (HPDF_Page page, HPDF_Page_Create3DAnnot (HPDF_Page page,
HPDF_Rect rect, HPDF_Rect rect,
HPDF_U3D u3d); HPDF_BOOL tb,
HPDF_BOOL np,
HPDF_U3D u3d,
HPDF_Image ap);
HPDF_EXPORT(HPDF_Annotation) HPDF_EXPORT(HPDF_Annotation)
HPDF_Page_CreateTextAnnot (HPDF_Page page, HPDF_Page_CreateTextAnnot (HPDF_Page page,
...@@ -478,6 +500,15 @@ HPDF_Page_CreateLineAnnot (HPDF_Page page, ...@@ -478,6 +500,15 @@ HPDF_Page_CreateLineAnnot (HPDF_Page page,
const char *text, const char *text,
HPDF_Encoder encoder); HPDF_Encoder encoder);
HPDF_EXPORT(HPDF_Annotation)
HPDF_Page_CreateWidgetAnnot_WhiteOnlyWhilePrint (HPDF_Doc pdf,
HPDF_Page page,
HPDF_Rect rect);
HPDF_EXPORT(HPDF_Annotation)
HPDF_Page_CreateWidgetAnnot (HPDF_Page page,
HPDF_Rect rect);
HPDF_EXPORT(HPDF_Annotation) HPDF_EXPORT(HPDF_Annotation)
HPDF_Page_CreateLinkAnnot (HPDF_Page page, HPDF_Page_CreateLinkAnnot (HPDF_Page page,
HPDF_Rect rect, HPDF_Rect rect,
...@@ -555,6 +586,9 @@ HPDF_EXPORT(HPDF_STATUS) ...@@ -555,6 +586,9 @@ HPDF_EXPORT(HPDF_STATUS)
HPDF_LinkAnnot_SetHighlightMode (HPDF_Annotation annot, HPDF_LinkAnnot_SetHighlightMode (HPDF_Annotation annot,
HPDF_AnnotHighlightMode mode); HPDF_AnnotHighlightMode mode);
HPDF_EXPORT(HPDF_STATUS)
HPDF_LinkAnnot_SetJavaScript(HPDF_Annotation annot,
HPDF_JavaScript javascript);
HPDF_EXPORT(HPDF_STATUS) HPDF_EXPORT(HPDF_STATUS)
HPDF_LinkAnnot_SetBorderStyle (HPDF_Annotation annot, HPDF_LinkAnnot_SetBorderStyle (HPDF_Annotation annot,
...@@ -624,7 +658,7 @@ HPDF_EXPORT(HPDF_STATUS) ...@@ -624,7 +658,7 @@ HPDF_EXPORT(HPDF_STATUS)
HPDF_TextMarkupAnnot_SetQuadPoints ( HPDF_Annotation annot, HPDF_Point lb, HPDF_Point rb, HPDF_Point rt, HPDF_Point lt); /* l-left, r-right, b-bottom, t-top positions */ HPDF_TextMarkupAnnot_SetQuadPoints ( HPDF_Annotation annot, HPDF_Point lb, HPDF_Point rb, HPDF_Point rt, HPDF_Point lt); /* l-left, r-right, b-bottom, t-top positions */
HPDF_EXPORT(HPDF_STATUS) HPDF_EXPORT(HPDF_STATUS)
HPDF_Annot_Set3DView ( HPDF_MMgr mmgr, HPDF_Annot_Set3DView ( HPDF_MMgr mmgr,
HPDF_Annotation annot, HPDF_Annotation annot,
HPDF_Annotation annot3d, HPDF_Annotation annot3d,
HPDF_Dict view); HPDF_Dict view);
...@@ -646,8 +680,8 @@ HPDF_EXPORT(HPDF_STATUS) ...@@ -646,8 +680,8 @@ HPDF_EXPORT(HPDF_STATUS)
HPDF_FreeTextAnnot_SetDefaultStyle (HPDF_Annotation annot, const char* style); HPDF_FreeTextAnnot_SetDefaultStyle (HPDF_Annotation annot, const char* style);
HPDF_EXPORT(HPDF_STATUS) HPDF_EXPORT(HPDF_STATUS)
HPDF_LineAnnot_SetPosition (HPDF_Annotation annot, HPDF_LineAnnot_SetPosition (HPDF_Annotation annot,
HPDF_Point startPoint, HPDF_LineAnnotEndingStyle startStyle, HPDF_Point startPoint, HPDF_LineAnnotEndingStyle startStyle,
HPDF_Point endPoint, HPDF_LineAnnotEndingStyle endStyle); HPDF_Point endPoint, HPDF_LineAnnotEndingStyle endStyle);
HPDF_EXPORT(HPDF_STATUS) HPDF_EXPORT(HPDF_STATUS)
...@@ -689,29 +723,29 @@ HPDF_Page_CreatePD33DMeasure(HPDF_Page page, ...@@ -689,29 +723,29 @@ HPDF_Page_CreatePD33DMeasure(HPDF_Page page,
); );
HPDF_EXPORT(HPDF_STATUS) HPDF_EXPORT(HPDF_STATUS)
HPDF_3DMeasure_SetName(HPDF_3DMeasure measure, HPDF_3DMeasure_SetName(HPDF_3DMeasure measure,
const char* name); const char* name);
HPDF_EXPORT(HPDF_STATUS) HPDF_EXPORT(HPDF_STATUS)
HPDF_3DMeasure_SetColor(HPDF_3DMeasure measure, HPDF_3DMeasure_SetColor(HPDF_3DMeasure measure,
HPDF_RGBColor color); HPDF_RGBColor color);
HPDF_EXPORT(HPDF_STATUS) HPDF_EXPORT(HPDF_STATUS)
HPDF_3DMeasure_SetTextSize(HPDF_3DMeasure measure, HPDF_3DMeasure_SetTextSize(HPDF_3DMeasure measure,
HPDF_REAL textsize); HPDF_REAL textsize);
HPDF_EXPORT(HPDF_STATUS) HPDF_EXPORT(HPDF_STATUS)
HPDF_3DC3DMeasure_SetTextBoxSize(HPDF_3DMeasure measure, HPDF_3DC3DMeasure_SetTextBoxSize(HPDF_3DMeasure measure,
HPDF_INT32 x, HPDF_INT32 x,
HPDF_INT32 y); HPDF_INT32 y);
HPDF_EXPORT(HPDF_STATUS) HPDF_EXPORT(HPDF_STATUS)
HPDF_3DC3DMeasure_SetText(HPDF_3DMeasure measure, HPDF_3DC3DMeasure_SetText(HPDF_3DMeasure measure,
const char* text, const char* text,
HPDF_Encoder encoder); HPDF_Encoder encoder);
HPDF_EXPORT(HPDF_STATUS) HPDF_EXPORT(HPDF_STATUS)
HPDF_3DC3DMeasure_SetProjectionAnotation(HPDF_3DMeasure measure, HPDF_3DC3DMeasure_SetProjectionAnotation(HPDF_3DMeasure measure,
HPDF_Annotation projectionanotation); HPDF_Annotation projectionanotation);
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
...@@ -1575,14 +1609,14 @@ HPDF_EXPORT(HPDF_OutputIntent) ...@@ -1575,14 +1609,14 @@ HPDF_EXPORT(HPDF_OutputIntent)
HPDF_ICC_LoadIccFromMem (HPDF_Doc pdf, HPDF_ICC_LoadIccFromMem (HPDF_Doc pdf,
HPDF_MMgr mmgr, HPDF_MMgr mmgr,
HPDF_Stream iccdata, HPDF_Stream iccdata,
HPDF_Xref xref, HPDF_Xref xref,
int numcomponent); int numcomponent);
HPDF_EXPORT(HPDF_OutputIntent) HPDF_EXPORT(HPDF_OutputIntent)
HPDF_LoadIccProfileFromFile (HPDF_Doc pdf, HPDF_LoadIccProfileFromFile (HPDF_Doc pdf,
const char* icc_file_name, const char* icc_file_name,
int numcomponent); int numcomponent);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */
......
...@@ -34,6 +34,10 @@ HPDF_Annotation_New (HPDF_MMgr mmgr, ...@@ -34,6 +34,10 @@ HPDF_Annotation_New (HPDF_MMgr mmgr,
HPDF_AnnotType type, HPDF_AnnotType type,
HPDF_Rect rect); HPDF_Rect rect);
HPDF_Annotation
HPDF_WidgetAnnot_New (HPDF_MMgr mmgr,
HPDF_Xref xref,
HPDF_Rect rect);
HPDF_Annotation HPDF_Annotation
HPDF_LinkAnnot_New (HPDF_MMgr mmgr, HPDF_LinkAnnot_New (HPDF_MMgr mmgr,
...@@ -53,7 +57,10 @@ HPDF_Annotation ...@@ -53,7 +57,10 @@ HPDF_Annotation
HPDF_3DAnnot_New (HPDF_MMgr mmgr, HPDF_3DAnnot_New (HPDF_MMgr mmgr,
HPDF_Xref xref, HPDF_Xref xref,
HPDF_Rect rect, HPDF_Rect rect,
HPDF_U3D u3d); HPDF_BOOL tb,
HPDF_BOOL np,
HPDF_U3D u3d,
HPDF_Image ap);
HPDF_Annotation HPDF_Annotation
HPDF_MarkupAnnot_New (HPDF_MMgr mmgr, HPDF_MarkupAnnot_New (HPDF_MMgr mmgr,
......
...@@ -109,14 +109,14 @@ ...@@ -109,14 +109,14 @@
#define HPDF_LIMIT_MAX_INT 2147483647 #define HPDF_LIMIT_MAX_INT 2147483647
#define HPDF_LIMIT_MIN_INT -2147483647 #define HPDF_LIMIT_MIN_INT -2147483647
#define HPDF_LIMIT_MAX_REAL 32767 #define HPDF_LIMIT_MAX_REAL 3.4E38f // per PDF 1.7 spec, Annex C, old value 32767
#define HPDF_LIMIT_MIN_REAL -32767 #define HPDF_LIMIT_MIN_REAL -3.4E38f // per PDF 1.7 spec, Annex C, old value -32767
#define HPDF_LIMIT_MAX_STRING_LEN 65535 #define HPDF_LIMIT_MAX_STRING_LEN 2147483646 // per PDF 1.7 spec, limit 32767 is for strings in content stream and no limit in other cases => open the limit to max Integer, old value 65535
#define HPDF_LIMIT_MAX_NAME_LEN 127 #define HPDF_LIMIT_MAX_NAME_LEN 127
#define HPDF_LIMIT_MAX_ARRAY 32767 #define HPDF_LIMIT_MAX_ARRAY 8388607 // per PDF 1.7 spec, "Maximum number of indirect objects in a PDF file" is 8388607, old value 8191
#define HPDF_LIMIT_MAX_DICT_ELEMENT 4095 #define HPDF_LIMIT_MAX_DICT_ELEMENT 8388607 // per PDF 1.7 spec, "Maximum number of indirect objects in a PDF file" is 8388607, old value 4095
#define HPDF_LIMIT_MAX_XREF_ELEMENT 8388607 #define HPDF_LIMIT_MAX_XREF_ELEMENT 8388607
#define HPDF_LIMIT_MAX_GSTATE 28 #define HPDF_LIMIT_MAX_GSTATE 28
#define HPDF_LIMIT_MAX_DEVICE_N 8 #define HPDF_LIMIT_MAX_DEVICE_N 8
......
...@@ -382,6 +382,8 @@ HPDF_STATUS ...@@ -382,6 +382,8 @@ HPDF_STATUS
HPDF_Array_AddReal (HPDF_Array array, HPDF_Array_AddReal (HPDF_Array array,
HPDF_REAL value); HPDF_REAL value);
HPDF_STATUS
HPDF_Array_AddNull (HPDF_Array array);
HPDF_STATUS HPDF_STATUS
HPDF_Array_AddName (HPDF_Array array, HPDF_Array_AddName (HPDF_Array array,
......
...@@ -152,7 +152,7 @@ typedef enum _HPDF_InfoType { ...@@ -152,7 +152,7 @@ typedef enum _HPDF_InfoType {
/* PDF-A Types */ /* PDF-A Types */
typedef enum _HPDF_PDFA_TYPE typedef enum _HPDF_PDFA_TYPE
{ {
HPDF_PDFA_1A = 0, HPDF_PDFA_1A = 0,
HPDF_PDFA_1B = 1 HPDF_PDFA_1B = 1
...@@ -225,6 +225,23 @@ typedef struct _HPDF_TransMatrix { ...@@ -225,6 +225,23 @@ typedef struct _HPDF_TransMatrix {
HPDF_REAL y; HPDF_REAL y;
} HPDF_TransMatrix; } HPDF_TransMatrix;
/*---------------------------------------------------------------------------*/
/*----- HPDF_3DMatrix struct ------------------------------------------------*/
typedef struct _HPDF_3DMatrix {
HPDF_REAL a;
HPDF_REAL b;
HPDF_REAL c;
HPDF_REAL d;
HPDF_REAL e;
HPDF_REAL f;
HPDF_REAL g;
HPDF_REAL h;
HPDF_REAL i;
HPDF_REAL tx;
HPDF_REAL ty;
HPDF_REAL tz;
} HPDF_3DMatrix;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
...@@ -368,7 +385,8 @@ typedef enum _HPDF_AnnotType { ...@@ -368,7 +385,8 @@ typedef enum _HPDF_AnnotType {
HPDF_ANNOT_3D, HPDF_ANNOT_3D,
HPDF_ANNOT_SQUIGGLY, HPDF_ANNOT_SQUIGGLY,
HPDF_ANNOT_LINE, HPDF_ANNOT_LINE,
HPDF_ANNOT_PROJECTION HPDF_ANNOT_PROJECTION,
HPDF_ANNOT_WIDGET
} HPDF_AnnotType; } HPDF_AnnotType;
...@@ -499,7 +517,7 @@ typedef enum _HPDF_TransitionStyle { ...@@ -499,7 +517,7 @@ typedef enum _HPDF_TransitionStyle {
HPDF_TS_GLITTER_TOP_LEFT_TO_BOTTOM_RIGHT, HPDF_TS_GLITTER_TOP_LEFT_TO_BOTTOM_RIGHT,
HPDF_TS_REPLACE, HPDF_TS_REPLACE,
HPDF_TS_EOF HPDF_TS_EOF
} HPDF_TransitionStyle; } HPDF_TransitionStyle;
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
......
...@@ -25,6 +25,7 @@ extern "C" { ...@@ -25,6 +25,7 @@ extern "C" {
#endif #endif
HPDF_EXPORT(HPDF_JavaScript) HPDF_CreateJavaScript(HPDF_Doc pdf, const char *code); HPDF_EXPORT(HPDF_JavaScript) HPDF_CreateJavaScript(HPDF_Doc pdf, const char *code);
HPDF_EXPORT(HPDF_JavaScript) HPDF_LoadJSFromFile (HPDF_Doc pdf, const char *filename);
HPDF_EXPORT(HPDF_U3D) HPDF_LoadU3DFromFile (HPDF_Doc pdf, const char *filename); HPDF_EXPORT(HPDF_U3D) HPDF_LoadU3DFromFile (HPDF_Doc pdf, const char *filename);
...@@ -33,12 +34,19 @@ HPDF_EXPORT(HPDF_Dict) HPDF_Create3DView (HPDF_MMgr mmgr, const char *name); ...@@ -33,12 +34,19 @@ HPDF_EXPORT(HPDF_Dict) HPDF_Create3DView (HPDF_MMgr mmgr, const char *name);
HPDF_EXPORT(HPDF_STATUS) HPDF_U3D_Add3DView(HPDF_U3D u3d, HPDF_Dict view); HPDF_EXPORT(HPDF_STATUS) HPDF_U3D_Add3DView(HPDF_U3D u3d, HPDF_Dict view);
HPDF_EXPORT(HPDF_STATUS) HPDF_U3D_SetDefault3DView(HPDF_U3D u3d, const char *name); HPDF_EXPORT(HPDF_STATUS) HPDF_U3D_SetDefault3DView(HPDF_U3D u3d, const char *name);
HPDF_EXPORT(HPDF_STATUS) HPDF_U3D_AddOnInstanciate(HPDF_U3D u3d, HPDF_JavaScript javaScript); HPDF_EXPORT(HPDF_STATUS) HPDF_U3D_AddOnInstanciate(HPDF_U3D u3d, HPDF_JavaScript javaScript);
HPDF_EXPORT(HPDF_STATUS) HPDF_3DView_AddNode(HPDF_Dict view, const char *name, HPDF_REAL opacity, HPDF_BOOL visible); HPDF_EXPORT(HPDF_Dict) HPDF_3DView_CreateNode(HPDF_Dict view, const char *name);
HPDF_EXPORT(HPDF_STATUS) HPDF_3DViewNode_SetOpacity(HPDF_Dict node, HPDF_REAL opacity);
HPDF_EXPORT(HPDF_STATUS) HPDF_3DViewNode_SetVisibility(HPDF_Dict node, HPDF_BOOL visible);
HPDF_EXPORT(HPDF_STATUS) HPDF_3DViewNode_SetMatrix(HPDF_Dict node, HPDF_3DMatrix Mat3D);
HPDF_EXPORT(HPDF_STATUS) HPDF_3DView_AddNode(HPDF_Dict view, HPDF_Dict node);
HPDF_EXPORT(HPDF_STATUS) HPDF_3DView_SetLighting(HPDF_Dict view, const char *scheme); HPDF_EXPORT(HPDF_STATUS) HPDF_3DView_SetLighting(HPDF_Dict view, const char *scheme);
HPDF_EXPORT(HPDF_STATUS) HPDF_3DView_SetBackgroundColor(HPDF_Dict view, HPDF_REAL r, HPDF_REAL g, HPDF_REAL b); HPDF_EXPORT(HPDF_STATUS) HPDF_3DView_SetBackgroundColor(HPDF_Dict view, HPDF_REAL r, HPDF_REAL g, HPDF_REAL b);
HPDF_EXPORT(HPDF_STATUS) HPDF_3DView_SetPerspectiveProjection(HPDF_Dict view, HPDF_REAL fov); HPDF_EXPORT(HPDF_STATUS) HPDF_3DView_SetPerspectiveProjection(HPDF_Dict view, HPDF_REAL fov);
HPDF_EXPORT(HPDF_STATUS) HPDF_3DView_SetOrthogonalProjection(HPDF_Dict view, HPDF_REAL mag); HPDF_EXPORT(HPDF_STATUS) HPDF_3DView_SetOrthogonalProjection(HPDF_Dict view, HPDF_REAL mag);
HPDF_EXPORT(HPDF_STATUS) HPDF_3DView_SetCamera(HPDF_Dict view, HPDF_REAL coox, HPDF_REAL cooy, HPDF_REAL cooz, HPDF_REAL c2cx, HPDF_REAL c2cy, HPDF_REAL c2cz, HPDF_REAL roo, HPDF_REAL roll); HPDF_EXPORT(HPDF_STATUS) HPDF_3DView_SetCamera(HPDF_Dict view, HPDF_REAL coox, HPDF_REAL cooy, HPDF_REAL cooz, HPDF_REAL c2cx, HPDF_REAL c2cy, HPDF_REAL c2cz, HPDF_REAL roo, HPDF_REAL roll);
HPDF_EXPORT(HPDF_STATUS) HPDF_3DView_SetCameraByMatrix(HPDF_Dict view, HPDF_3DMatrix Mat3D, HPDF_REAL co);
HPDF_EXPORT(HPDF_STATUS) HPDF_3DView_SetCrossSectionOn(HPDF_Dict view, HPDF_Point3D center, HPDF_REAL Roll, HPDF_REAL Pitch, HPDF_REAL opacity, HPDF_BOOL showintersection);
HPDF_EXPORT(HPDF_STATUS) HPDF_3DView_SetCrossSectionOff(HPDF_Dict view);
HPDF_Dict HPDF_Dict
HPDF_3DView_New ( HPDF_MMgr mmgr, HPDF_3DView_New ( HPDF_MMgr mmgr,
......
/* automatically generated by configure */ /* automatically generated by configure */
/* edit configure.in to change version number */ /* edit configure.in to change version number */
#define HPDF_MAJOR_VERSION 2 #define HPDF_MAJOR_VERSION 2
#define HPDF_MINOR_VERSION 3 #define HPDF_MINOR_VERSION 4
#define HPDF_BUGFIX_VERSION 0 #define HPDF_BUGFIX_VERSION 0
#define HPDF_EXTRA_VERSION "RC2" #define HPDF_EXTRA_VERSION "dev"
#define HPDF_VERSION_TEXT "2.3.0RC2" #define HPDF_VERSION_TEXT "2.4.0dev"
#define HPDF_VERSION_ID 20300 #define HPDF_VERSION_ID 20400
...@@ -39,6 +39,7 @@ static const char * const HPDF_ANNOT_TYPE_NAMES[] = { ...@@ -39,6 +39,7 @@ static const char * const HPDF_ANNOT_TYPE_NAMES[] = {
"Squiggly", "Squiggly",
"Line", "Line",
"Projection" "Projection"
"Widget"
}; };
static const char * const HPDF_ANNOT_ICON_NAMES_NAMES[] = { static const char * const HPDF_ANNOT_ICON_NAMES_NAMES[] = {
...@@ -222,6 +223,21 @@ HPDF_Annotation_SetBorderStyle (HPDF_Annotation annot, ...@@ -222,6 +223,21 @@ HPDF_Annotation_SetBorderStyle (HPDF_Annotation annot,
return HPDF_OK; return HPDF_OK;
} }
HPDF_Annotation
HPDF_WidgetAnnot_New (HPDF_MMgr mmgr,
HPDF_Xref xref,
HPDF_Rect rect)
{
HPDF_Annotation annot;
HPDF_PTRACE((" HPDF_WidgetAnnot_New\n"));
annot = HPDF_Annotation_New (mmgr, xref, HPDF_ANNOT_WIDGET, rect);
if (!annot)
return NULL;
return annot;
}
HPDF_Annotation HPDF_Annotation
HPDF_LinkAnnot_New (HPDF_MMgr mmgr, HPDF_LinkAnnot_New (HPDF_MMgr mmgr,
...@@ -237,8 +253,11 @@ HPDF_LinkAnnot_New (HPDF_MMgr mmgr, ...@@ -237,8 +253,11 @@ HPDF_LinkAnnot_New (HPDF_MMgr mmgr,
if (!annot) if (!annot)
return NULL; return NULL;
if (dst)
{
if (HPDF_Dict_Add (annot, "Dest", dst) != HPDF_OK) if (HPDF_Dict_Add (annot, "Dest", dst) != HPDF_OK)
return NULL; return NULL;
}
return annot; return annot;
} }
...@@ -279,6 +298,35 @@ HPDF_URILinkAnnot_New (HPDF_MMgr mmgr, ...@@ -279,6 +298,35 @@ HPDF_URILinkAnnot_New (HPDF_MMgr mmgr,
return annot; return annot;
} }
HPDF_EXPORT(HPDF_STATUS)
HPDF_LinkAnnot_SetJavaScript(HPDF_Annotation annot, HPDF_JavaScript javascript)
{
HPDF_Dict action;
HPDF_STATUS ret;
HPDF_PTRACE((" HPDF_LinkAnnot_SetJavaScript\n"));
if (!CheckSubType (annot, HPDF_ANNOT_LINK))
return HPDF_INVALID_ANNOTATION;
/* create action dictionary */
action = HPDF_Dict_New (annot->mmgr);
if (!action)
return HPDF_CheckError ( annot->error);
ret = HPDF_Dict_Add (annot, "A", action);
if (ret != HPDF_OK)
return HPDF_CheckError (annot->error);
ret += HPDF_Dict_Add (action, "JS", javascript);
ret += HPDF_Dict_AddName (action, "S", "JavaScript");
if (ret != HPDF_OK)
return HPDF_CheckError (annot->error);
return HPDF_OK;
}
HPDF_EXPORT(HPDF_STATUS) HPDF_EXPORT(HPDF_STATUS)
HPDF_LinkAnnot_SetBorderStyle (HPDF_Annotation annot, HPDF_LinkAnnot_SetBorderStyle (HPDF_Annotation annot,
HPDF_REAL width, HPDF_REAL width,
...@@ -366,7 +414,10 @@ HPDF_Annotation ...@@ -366,7 +414,10 @@ HPDF_Annotation
HPDF_3DAnnot_New (HPDF_MMgr mmgr, HPDF_3DAnnot_New (HPDF_MMgr mmgr,
HPDF_Xref xref, HPDF_Xref xref,
HPDF_Rect rect, HPDF_Rect rect,
HPDF_U3D u3d) HPDF_BOOL tb,
HPDF_BOOL np,
HPDF_U3D u3d,
HPDF_Image ap)
{ {
HPDF_Annotation annot; HPDF_Annotation annot;
HPDF_Dict action, appearance, stream; HPDF_Dict action, appearance, stream;
...@@ -378,7 +429,14 @@ HPDF_3DAnnot_New (HPDF_MMgr mmgr, ...@@ -378,7 +429,14 @@ HPDF_3DAnnot_New (HPDF_MMgr mmgr,
if (!annot) { if (!annot) {
return NULL; return NULL;
} }
// include the flags
HPDF_Dict_AddNumber (annot, "F", 68);
//Bit 3:Print If set, print the annotation when the page is printed.
//Bit 7:If set, do not allow the annotation to interact with the user.
// The annotation may be displayed or printed (depending on the settings of the NoView and Print flags)
// but should not respond to mouse clicks or change its appearance in response to mouse motions.
HPDF_Dict_Add(annot, "Contents", HPDF_String_New (mmgr, "3D Model", NULL)); HPDF_Dict_Add(annot, "Contents", HPDF_String_New (mmgr, "3D Model", NULL));
action = HPDF_Dict_New (mmgr); action = HPDF_Dict_New (mmgr);
...@@ -391,9 +449,20 @@ HPDF_3DAnnot_New (HPDF_MMgr mmgr, ...@@ -391,9 +449,20 @@ HPDF_3DAnnot_New (HPDF_MMgr mmgr,
return NULL; return NULL;
} }
ret += HPDF_Dict_AddName (action, "A", "PV"); // enable visibility on page open
ret += HPDF_Dict_AddName (action, "A", "PO");
// enable visibility of ToolBar
ret += HPDF_Dict_AddBoolean(action, "TB", tb);
ret += HPDF_Dict_AddBoolean(action, "TB", HPDF_FALSE); // enable visibility of Navigation Panel
ret += HPDF_Dict_AddBoolean(action, "NP", np);
// Set behavior of Annotation on Disabling
ret += HPDF_Dict_AddName(action, "DIS", "U");
// Set behavior of Annotation upon activation
ret += HPDF_Dict_AddName(action, "AIS", "L");
if (ret != HPDF_OK) { if (ret != HPDF_OK) {
return NULL; return NULL;
...@@ -413,11 +482,18 @@ HPDF_3DAnnot_New (HPDF_MMgr mmgr, ...@@ -413,11 +482,18 @@ HPDF_3DAnnot_New (HPDF_MMgr mmgr,
return NULL; return NULL;
} }