Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
d1da300
Fixes various libharu issues
Jul 3, 2013
8000525
Makefiles for cross compilation created
gerhardgruber Jul 4, 2013
3e978f7
Added missing functions to the def file.
gerhardgruber Jul 8, 2013
54d5a34
Changed line dash phase to HPDF_REAL
Jul 15, 2013
aab3a6c
Added Duplex entry to viewer preferences
Jul 16, 2013
605e1b6
Added support for interactive forms and textfields
Sep 9, 2013
3357456
Added support for Encoder with custom differences
Jan 24, 2014
624efb6
Parsing of AFM files allows wrong count of C
gerhardgruber Jan 27, 2014
0618e19
Added function to load native type 1 fonts
Feb 3, 2014
3c67642
Added unicode string support for bookmarks
Apr 8, 2014
419f981
Added HPDF_Outline_GetParent to libhpdf.def file
Apr 15, 2014
a5abacf
Added declaration of HPDF_String_New_Unicode to...
Apr 23, 2014
af6ebb1
Text with width 0 will now be written
danieldocu May 22, 2015
ca79a24
HPDF_FONT_SYMBOLIC flag is now set for native ...
danieldocu May 19, 2015
ca75a6d
Added support for glyphs with names like uni0411
danieldocu Jun 18, 2015
adb98c8
HPDF_UseUTFEncodings kann jetzt verwendet werden
Oct 9, 2015
af91818
Added HPDF_Annotation_SetFlags method
danieldocu Nov 30, 2015
118cbfb
Some PDF/A functions can now be cross compiled
danieldocu Dec 14, 2015
2e42517
Added mingw64 makefiles
danieldocu Feb 10, 2016
3e144e7
Added methods HPDF_SetTextPlacementAccuracy and HPDF_SetWriteFontWidths
danieldocu Feb 26, 2016
78f859b
fixed segfault in LoadType1FontFromStream2
wdechow Aug 25, 2016
9515ac7
AFM files with CharMetrics lines that contain more than 512 charaters…
danieldocu Nov 30, 2016
d4a2efc
Added functions for cross compilation
Jan 23, 2017
0fff040
support huge fonts (patch by Alan W. Irwin)
tony2001 Oct 16, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,5 @@ CPackConfig.cmake
CPackSourceConfig.cmake
cmake_install.cmake
depcomp
*.dll
*~
59 changes: 54 additions & 5 deletions include/hpdf.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,15 @@ HPDF_LoadType1FontFromFile (HPDF_Doc pdf,
const char *afm_file_name,
const char *data_file_name);

HPDF_EXPORT(const char*)
HPDF_LoadType1FontFromFile2 (HPDF_Doc pdf,
const char *afm_file_name,
const char *font_name);

HPDF_EXPORT(const char*)
HPDF_LoadType1FontFromFileNative (HPDF_Doc pdf,
const char *afm_file_name,
const char *data_file_name);

HPDF_EXPORT(HPDF_FontDef)
HPDF_GetTTFontDefFromFile (HPDF_Doc pdf,
Expand Down Expand Up @@ -329,7 +338,8 @@ HPDF_EXPORT(HPDF_Outline)
HPDF_CreateOutline (HPDF_Doc pdf,
HPDF_Outline parent,
const char *title,
HPDF_Encoder encoder);
HPDF_Encoder encoder,
HPDF_UINT16 unicode_len);


HPDF_EXPORT(HPDF_STATUS)
Expand Down Expand Up @@ -398,6 +408,10 @@ HPDF_EXPORT(HPDF_Encoder)
HPDF_GetEncoder (HPDF_Doc pdf,
const char *encoding_name);

HPDF_EXPORT(HPDF_Encoder)
HPDF_GetEncoder2 (HPDF_Doc pdf,
const char *encoding_name,
const char *base_encoding_name);

HPDF_EXPORT(HPDF_Encoder)
HPDF_GetCurrentEncoder (HPDF_Doc pdf);
Expand Down Expand Up @@ -548,6 +562,10 @@ HPDF_Page_CreateCircleAnnot (HPDF_Page page,
const char *text,
HPDF_Encoder encoder);

HPDF_EXPORT(HPDF_STATUS)
HPDF_Annotation_SetFlags (HPDF_Annotation annot,
HPDF_UINT32 flags);

HPDF_EXPORT(HPDF_STATUS)
HPDF_LinkAnnot_SetHighlightMode (HPDF_Annotation annot,
HPDF_AnnotHighlightMode mode);
Expand Down Expand Up @@ -789,7 +807,9 @@ HPDF_LoadRawImageFromMem (HPDF_Doc pdf,
HPDF_UINT width,
HPDF_UINT height,
HPDF_ColorSpace color_space,
HPDF_UINT bits_per_component);
HPDF_UINT bits_per_component,
HPDF_UINT size,
HPDF_BOOL black_white);

HPDF_EXPORT(HPDF_STATUS)
HPDF_Image_AddSMask (HPDF_Image image,
Expand Down Expand Up @@ -1147,9 +1167,9 @@ HPDF_Page_SetMiterLimit (HPDF_Page page,
/* d */
HPDF_EXPORT(HPDF_STATUS)
HPDF_Page_SetDash (HPDF_Page page,
const HPDF_UINT16 *dash_ptn,
const HPDF_REAL *dash_ptn,
HPDF_UINT num_param,
HPDF_UINT phase);
HPDF_REAL phase);



Expand Down Expand Up @@ -1553,7 +1573,36 @@ HPDF_EXPORT(HPDF_OutputIntent)
HPDF_LoadIccProfileFromFile (HPDF_Doc pdf,
const char* icc_file_name,
int numcomponent);


HPDF_EXPORT(HPDF_STATUS)
HPDF_Page_WriteComment (HPDF_Page page,
const char *text);

HPDF_EXPORT(HPDF_STATUS)
HPDF_Page_TextField (HPDF_Page page,
HPDF_Doc pdf,
HPDF_REAL left,
HPDF_REAL top,
HPDF_REAL right,
HPDF_REAL bottom,
const char *name,
const char *text,
HPDF_UINT flag,
HPDF_BOOL print,
HPDF_UINT max_len,
HPDF_UINT alignment,
HPDF_INT rotation,
HPDF_Font font,
HPDF_REAL font_size,
HPDF_Color color);

HPDF_EXPORT(HPDF_STATUS)
HPDF_SetTextPlacementAccuracy (HPDF_Doc pdf,
HPDF_UINT decimal_places);

HPDF_EXPORT(HPDF_STATUS)
HPDF_SetWriteFontWidths (HPDF_Doc pdf,
HPDF_BOOL write_font_widths);
#ifdef __cplusplus
}
#endif /* __cplusplus */
Expand Down
6 changes: 6 additions & 0 deletions include/hpdf_catalog.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ extern "C" {

typedef HPDF_Dict HPDF_Catalog;

typedef struct _HPDF_CatalogAttr_Rec *HPDF_CatalogAttr;

typedef struct _HPDF_CatalogAttr_Rec {
HPDF_Dict fonts;
} HPDF_CatalogAttr_Rec;

HPDF_Catalog
HPDF_Catalog_New (HPDF_MMgr mmgr,
HPDF_Xref xref);
Expand Down
32 changes: 26 additions & 6 deletions include/hpdf_consts.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@
#define HPDF_DEF_PAGE_WIDTH 595.276F
#define HPDF_DEF_PAGE_HEIGHT 841.89F

/* default decimal places for text placement accuracy */
#define HPDF_DEF_TEXT_PLACEMENT_ACCURACY 5

/*---------------------------------------------------------------------------*/
/*----- compression mode ----------------------------------------------------*/

Expand Down Expand Up @@ -95,12 +98,15 @@
/*----------------------------------------------------------------------------*/
/*------ viewer preferences definitions --------------------------------------*/

#define HPDF_HIDE_TOOLBAR 1
#define HPDF_HIDE_MENUBAR 2
#define HPDF_HIDE_WINDOW_UI 4
#define HPDF_FIT_WINDOW 8
#define HPDF_CENTER_WINDOW 16
#define HPDF_HIDE_TOOLBAR 1
#define HPDF_HIDE_MENUBAR 2
#define HPDF_HIDE_WINDOW_UI 4
#define HPDF_FIT_WINDOW 8
#define HPDF_CENTER_WINDOW 16
#define HPDF_PRINT_SCALING_NONE 32
#define HPDF_SIMPLEX 64
#define HPDF_DUPLEX_FLIP_SHORT 128
#define HPDF_DUPLEX_FLIP_LONG 256


/*---------------------------------------------------------------------------*/
Expand Down Expand Up @@ -142,7 +148,7 @@
#define HPDF_MAX_WORDSPACE 300
#define HPDF_MIN_CHARSPACE -30
#define HPDF_MAX_CHARSPACE 300
#define HPDF_MAX_FONTSIZE 300
#define HPDF_MAX_FONTSIZE 600
#define HPDF_MAX_ZOOMSIZE 10
#define HPDF_MAX_LEADING 300
#define HPDF_MAX_LINEWIDTH 100
Expand Down Expand Up @@ -543,6 +549,20 @@
#define HPDF_GMODE_INLINE_IMAGE 0x0020
#define HPDF_GMODE_EXTERNAL_OBJECT 0x0040

/*----------------------------------------------------------------------------*/
/*------ Flags for interactive fields ----------------------------------------*/
/* BIT POSITION */
#define HPDF_FIELD_READONLY 1 /* 1 */
#define HPDF_FIELD_REQUIRED 2 /* 2 */
#define HPDF_FIELD_NOEXPORT 4 /* 3 */
#define HPDF_FIELD_MULTILINE 4096 /* 13 */
#define HPDF_FIELD_PASSWORD 8192 /* 14 */
#define HPDF_FIELD_FILESELECT 1048576 /* 21 */
#define HPDF_FIELD_DONOTSPELLCHECK 4194304 /* 23 */
#define HPDF_FIELD_DONOTSCROLL 8388608 /* 24 */
#define HPDF_FIELD_COMB 16777216 /* 25 */
#define HPDF_FIELD_RICHTEXT 33554432 /* 26 */


/*----------------------------------------------------------------------------*/

Expand Down
6 changes: 6 additions & 0 deletions include/hpdf_doc.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ typedef struct _HPDF_Doc_Rec {
/* default compression mode */
HPDF_BOOL compression_mode;

/* decimal places for text placement accuracy */
HPDF_UINT text_placement_accuracy;

/* states if font widths will be written for fonts without font data */
HPDF_BOOL write_font_widths;

HPDF_BOOL encrypt_on;
HPDF_EncryptDict encrypt_dict;

Expand Down
1 change: 1 addition & 0 deletions include/hpdf_encoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ typedef struct _HPDF_BasicEncoderAttr_Rec {
HPDF_UNICODE unicode_map[256];
HPDF_BOOL has_differences;
HPDF_BYTE differences[256];
const char *differences_str;
} HPDF_BasicEncoderAttr_Rec;


Expand Down
5 changes: 4 additions & 1 deletion include/hpdf_fontdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ typedef struct _HPDF_FontDef_Rec {
HPDF_UINT16 stemh;
HPDF_UINT16 x_height;
HPDF_UINT16 cap_height;
HPDF_BOOL is_form_font;

/* the initial value of descriptor entry is NULL.
* when first font-object besed on the fontdef object is created,
Expand Down Expand Up @@ -150,6 +151,7 @@ typedef struct _HPDF_Type1FontDefAttrRec {
HPDF_UINT length3;
HPDF_BOOL is_base14font;
HPDF_BOOL is_fixed_pitch;
HPDF_BOOL write_widths;

HPDF_Stream font_data;
} HPDF_Type1FontDefAttr_Rec;
Expand All @@ -163,7 +165,8 @@ HPDF_Type1FontDef_New (HPDF_MMgr mmgr);
HPDF_FontDef
HPDF_Type1FontDef_Load (HPDF_MMgr mmgr,
HPDF_Stream afm,
HPDF_Stream font_data);
HPDF_Stream font_data,
HPDF_BOOL native);


HPDF_FontDef
Expand Down
3 changes: 2 additions & 1 deletion include/hpdf_image.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ HPDF_Image_LoadRawImageFromMem (HPDF_MMgr mmgr,
HPDF_UINT width,
HPDF_UINT height,
HPDF_ColorSpace color_space,
HPDF_UINT bits_per_component);
HPDF_UINT bits_per_component,
HPDF_UINT opt_size);


HPDF_BOOL
Expand Down
5 changes: 5 additions & 0 deletions include/hpdf_objects.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ typedef struct _HPDF_String_Rec {
HPDF_Encoder encoder;
HPDF_BYTE *value;
HPDF_UINT len;
HPDF_UINT16 unicode_len;
} HPDF_String_Rec;


Expand All @@ -258,6 +259,10 @@ HPDF_String_New (HPDF_MMgr mmgr,
const char *value,
HPDF_Encoder encoder);

HPDF_String
HPDF_String_New_Unicode (HPDF_MMgr mmgr,
const char *value,
HPDF_UINT16 unicode_len);

HPDF_STATUS
HPDF_String_SetValue (HPDF_String obj,
Expand Down
3 changes: 2 additions & 1 deletion include/hpdf_outline.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ HPDF_Outline_New (HPDF_MMgr mmgr,
HPDF_Outline parent,
const char *title,
HPDF_Encoder encoder,
HPDF_Xref xref);
HPDF_Xref xref,
HPDF_UINT16 unicode_len);


HPDF_Outline
Expand Down
1 change: 1 addition & 0 deletions include/hpdf_pages.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ typedef struct _HPDF_PageAttr_Rec {
HPDF_Stream stream;
HPDF_Xref xref;
HPDF_UINT compression_mode;
HPDF_UINT text_placement_accuracy;
HPDF_PDFVer *ver;
} HPDF_PageAttr_Rec;

Expand Down
14 changes: 12 additions & 2 deletions include/hpdf_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,9 @@ typedef struct _HPDF_TextWidth {
/*------ dash mode ----------------------------------------------------------*/

typedef struct _HPDF_DashMode {
HPDF_UINT16 ptn[8];
HPDF_REAL ptn[8];
HPDF_UINT num_ptn;
HPDF_UINT phase;
HPDF_REAL phase;
} HPDF_DashMode;


Expand Down Expand Up @@ -262,6 +262,16 @@ typedef struct _HPDF_CMYKColor {
HPDF_REAL k;
} HPDF_CMYKColor;

/*---------------------------------------------------------------------------*/
/*----- HPDF_Color struct -----------------------------------------------*/

typedef struct _HPDF_Color {
HPDF_ColorSpace cs;
HPDF_RGBColor rgb;
HPDF_CMYKColor cmyk;
HPDF_REAL gray;
} HPDF_Color;

/*---------------------------------------------------------------------------*/
/*------ The line cap style -------------------------------------------------*/

Expand Down
8 changes: 8 additions & 0 deletions include/hpdf_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
extern "C" {
#endif /* __cplusplus */

/* can be used for rounding to 0-5 decimal places */
static const int HPDF_DECIMAL_ROUND_COEFFICIENT[] = {1, 10, 100, 1000, 10000, 100000};

HPDF_INT
HPDF_AToI (const char* s);

Expand All @@ -50,6 +53,11 @@ HPDF_FToA (char *s,
HPDF_REAL val,
char *eptr);

char*
HPDF_FToA2 (char *s,
HPDF_REAL val,
char *eptr,
HPDF_UINT decimal_places);

HPDF_BYTE*
HPDF_MemCpy (HPDF_BYTE* out,
Expand Down
2 changes: 2 additions & 0 deletions script/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,14 @@ OBJS = \
src_SEP_hpdf_page_operator_OBJ_EXT \
src_SEP_hpdf_destination_OBJ_EXT \
src_SEP_hpdf_annotation_OBJ_EXT \
src_SEP_hpdf_pdfa_OBJ_EXT \
src_SEP_hpdf_outline_OBJ_EXT \
src_SEP_hpdf_image_OBJ_EXT \
src_SEP_hpdf_encoder_jp_OBJ_EXT \
src_SEP_hpdf_encoder_kr_OBJ_EXT \
src_SEP_hpdf_encoder_cns_OBJ_EXT \
src_SEP_hpdf_encoder_cnt_OBJ_EXT \
src_SEP_hpdf_encoder_utf_OBJ_EXT \
src_SEP_hpdf_fontdef_jp_OBJ_EXT \
src_SEP_hpdf_fontdef_kr_OBJ_EXT \
src_SEP_hpdf_fontdef_cns_OBJ_EXT \
Expand Down
2 changes: 2 additions & 0 deletions script/Makefile.mingw
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,14 @@ OBJS = \
src/hpdf_page_operator.o \
src/hpdf_destination.o \
src/hpdf_annotation.o \
src/hpdf_pdfa.o \
src/hpdf_outline.o \
src/hpdf_image.o \
src/hpdf_encoder_jp.o \
src/hpdf_encoder_kr.o \
src/hpdf_encoder_cns.o \
src/hpdf_encoder_cnt.o \
src/hpdf_encoder_utf.o \
src/hpdf_fontdef_jp.o \
src/hpdf_fontdef_kr.o \
src/hpdf_fontdef_cns.o \
Expand Down
Loading