hpdf 2.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/History +57 -0
- data/License +25 -0
- data/README +165 -0
- data/examples/arc_demo.rb +82 -0
- data/examples/demo.rb +92 -0
- data/examples/encryption.rb +41 -0
- data/examples/ext_gstater_demo.rb +171 -0
- data/examples/font_demo.rb +67 -0
- data/examples/jpfont_demo.rb +122 -0
- data/examples/line_demo.rb +301 -0
- data/examples/slide_show_demo.rb +139 -0
- data/examples/text_demo2.rb +189 -0
- data/examples/ttfont_demo.rb +106 -0
- data/ext/extconf.rb +6 -0
- data/ext/hpdf.c +3779 -0
- data/ext/hpdf_annotation.c +415 -0
- data/ext/hpdf_array.c +344 -0
- data/ext/hpdf_binary.c +117 -0
- data/ext/hpdf_boolean.c +47 -0
- data/ext/hpdf_catalog.c +354 -0
- data/ext/hpdf_destination.c +339 -0
- data/ext/hpdf_dict.c +488 -0
- data/ext/hpdf_doc.c +2020 -0
- data/ext/hpdf_doc_png.c +137 -0
- data/ext/hpdf_encoder.c +2991 -0
- data/ext/hpdf_encoder_cns.c +36359 -0
- data/ext/hpdf_encoder_cnt.c +15307 -0
- data/ext/hpdf_encoder_jp.c +16125 -0
- data/ext/hpdf_encoder_kr.c +27978 -0
- data/ext/hpdf_encrypt.c +632 -0
- data/ext/hpdf_encryptdict.c +240 -0
- data/ext/hpdf_error.c +114 -0
- data/ext/hpdf_ext_gstate.c +150 -0
- data/ext/hpdf_font.c +229 -0
- data/ext/hpdf_font_cid.c +1030 -0
- data/ext/hpdf_font_tt.c +406 -0
- data/ext/hpdf_font_type1.c +391 -0
- data/ext/hpdf_fontdef.c +56 -0
- data/ext/hpdf_fontdef_base14.c +4506 -0
- data/ext/hpdf_fontdef_cid.c +194 -0
- data/ext/hpdf_fontdef_cns.c +471 -0
- data/ext/hpdf_fontdef_cnt.c +250 -0
- data/ext/hpdf_fontdef_jp.c +1904 -0
- data/ext/hpdf_fontdef_kr.c +1572 -0
- data/ext/hpdf_fontdef_tt.c +2230 -0
- data/ext/hpdf_fontdef_type1.c +524 -0
- data/ext/hpdf_gstate.c +119 -0
- data/ext/hpdf_image.c +568 -0
- data/ext/hpdf_image_png.c +424 -0
- data/ext/hpdf_info.c +164 -0
- data/ext/hpdf_list.c +333 -0
- data/ext/hpdf_mmgr.c +243 -0
- data/ext/hpdf_name.c +71 -0
- data/ext/hpdf_null.c +31 -0
- data/ext/hpdf_number.c +49 -0
- data/ext/hpdf_objects.c +172 -0
- data/ext/hpdf_outline.c +329 -0
- data/ext/hpdf_page_label.c +74 -0
- data/ext/hpdf_page_operator.c +2764 -0
- data/ext/hpdf_pages.c +1508 -0
- data/ext/hpdf_real.c +61 -0
- data/ext/hpdf_streams.c +1435 -0
- data/ext/hpdf_string.c +189 -0
- data/ext/hpdf_utils.c +438 -0
- data/ext/hpdf_xref.c +348 -0
- data/ext/include/hpdf.h +1227 -0
- data/ext/include/hpdf_annotation.h +74 -0
- data/ext/include/hpdf_catalog.h +81 -0
- data/ext/include/hpdf_conf.h +76 -0
- data/ext/include/hpdf_consts.h +549 -0
- data/ext/include/hpdf_destination.h +41 -0
- data/ext/include/hpdf_doc.h +159 -0
- data/ext/include/hpdf_encoder.h +311 -0
- data/ext/include/hpdf_encrypt.h +156 -0
- data/ext/include/hpdf_encryptdict.h +66 -0
- data/ext/include/hpdf_error.h +201 -0
- data/ext/include/hpdf_ext_gstate.h +38 -0
- data/ext/include/hpdf_font.h +112 -0
- data/ext/include/hpdf_fontdef.h +403 -0
- data/ext/include/hpdf_gstate.h +80 -0
- data/ext/include/hpdf_image.h +72 -0
- data/ext/include/hpdf_info.h +48 -0
- data/ext/include/hpdf_list.h +85 -0
- data/ext/include/hpdf_mmgr.h +82 -0
- data/ext/include/hpdf_objects.h +587 -0
- data/ext/include/hpdf_outline.h +74 -0
- data/ext/include/hpdf_page_label.h +35 -0
- data/ext/include/hpdf_pages.h +128 -0
- data/ext/include/hpdf_streams.h +276 -0
- data/ext/include/hpdf_types.h +488 -0
- data/ext/include/hpdf_utils.h +161 -0
- data/tests/arc_demo.rb +82 -0
- data/tests/demo.rb +91 -0
- data/tests/encryption.rb +41 -0
- data/tests/ext_gstater_demo.rb +171 -0
- data/tests/font_demo.rb +67 -0
- data/tests/line_demo.rb +301 -0
- data/tests/slide_show_demo.rb +139 -0
- data/tests/test_all_examples.rb +31 -0
- data/tests/text_demo2.rb +189 -0
- metadata +147 -0
@@ -0,0 +1,80 @@
|
|
1
|
+
/*
|
2
|
+
* << Haru Free PDF Library 2.0.0 >> -- hpdf_gstate.h
|
3
|
+
*
|
4
|
+
* Copyright (c) 1999-2006 Takeshi Kanno <takeshi_kanno@est.hi-ho.ne.jp>
|
5
|
+
*
|
6
|
+
* Permission to use, copy, modify, distribute and sell this software
|
7
|
+
* and its documentation for any purpose is hereby granted without fee,
|
8
|
+
* provided that the above copyright notice appear in all copies and
|
9
|
+
* that both that copyright notice and this permission notice appear
|
10
|
+
* in supporting documentation.
|
11
|
+
* It is provided "as is" without express or implied warranty.
|
12
|
+
*
|
13
|
+
*/
|
14
|
+
|
15
|
+
#ifndef _HPDF_GSTATE_H
|
16
|
+
#define _HPDF_GSTATE_H
|
17
|
+
|
18
|
+
#include "hpdf_font.h"
|
19
|
+
|
20
|
+
#ifdef __cplusplus
|
21
|
+
extern "C" {
|
22
|
+
#endif
|
23
|
+
|
24
|
+
|
25
|
+
/*----------------------------------------------------------------------------*/
|
26
|
+
/*------ graphic state stack -------------------------------------------------*/
|
27
|
+
|
28
|
+
typedef struct _HPDF_GState_Rec *HPDF_GState;
|
29
|
+
|
30
|
+
typedef struct _HPDF_GState_Rec {
|
31
|
+
HPDF_TransMatrix trans_matrix;
|
32
|
+
HPDF_REAL line_width;
|
33
|
+
HPDF_LineCap line_cap;
|
34
|
+
HPDF_LineJoin line_join;
|
35
|
+
HPDF_REAL miter_limit;
|
36
|
+
HPDF_DashMode dash_mode;
|
37
|
+
HPDF_REAL flatness;
|
38
|
+
|
39
|
+
HPDF_REAL char_space;
|
40
|
+
HPDF_REAL word_space;
|
41
|
+
HPDF_REAL h_scalling;
|
42
|
+
HPDF_REAL text_leading;
|
43
|
+
HPDF_TextRenderingMode rendering_mode;
|
44
|
+
HPDF_REAL text_rise;
|
45
|
+
|
46
|
+
HPDF_ColorSpace cs_fill;
|
47
|
+
HPDF_ColorSpace cs_stroke;
|
48
|
+
HPDF_RGBColor rgb_fill;
|
49
|
+
HPDF_RGBColor rgb_stroke;
|
50
|
+
HPDF_CMYKColor cmyk_fill;
|
51
|
+
HPDF_CMYKColor cmyk_stroke;
|
52
|
+
HPDF_REAL gray_fill;
|
53
|
+
HPDF_REAL gray_stroke;
|
54
|
+
|
55
|
+
HPDF_Font font;
|
56
|
+
HPDF_REAL font_size;
|
57
|
+
HPDF_WritingMode writing_mode;
|
58
|
+
|
59
|
+
HPDF_GState prev;
|
60
|
+
HPDF_UINT depth;
|
61
|
+
} HPDF_GState_Rec;
|
62
|
+
|
63
|
+
/*----------------------------------------------------------------------------*/
|
64
|
+
/*----------------------------------------------------------------------------*/
|
65
|
+
|
66
|
+
HPDF_GState
|
67
|
+
HPDF_GState_New (HPDF_MMgr mmgr,
|
68
|
+
HPDF_GState current);
|
69
|
+
|
70
|
+
|
71
|
+
HPDF_GState
|
72
|
+
HPDF_GState_Free (HPDF_MMgr mmgr,
|
73
|
+
HPDF_GState gstate);
|
74
|
+
|
75
|
+
#ifdef __cplusplus
|
76
|
+
}
|
77
|
+
#endif /* __cplusplus */
|
78
|
+
|
79
|
+
#endif /* _HPDF_GSTATE_H */
|
80
|
+
|
@@ -0,0 +1,72 @@
|
|
1
|
+
/*
|
2
|
+
* << Haru Free PDF Library 2.0.3 >> -- hpdf_image.h
|
3
|
+
*
|
4
|
+
* Copyright (c) 1999-2006 Takeshi Kanno <takeshi_kanno@est.hi-ho.ne.jp>
|
5
|
+
*
|
6
|
+
* Permission to use, copy, modify, distribute and sell this software
|
7
|
+
* and its documentation for any purpose is hereby granted without fee,
|
8
|
+
* provided that the above copyright notice appear in all copies and
|
9
|
+
* that both that copyright notice and this permission notice appear
|
10
|
+
* in supporting documentation.
|
11
|
+
* It is provided "as is" without express or implied warranty.
|
12
|
+
*
|
13
|
+
*/
|
14
|
+
|
15
|
+
#ifndef _HPDF_IMAGE_H
|
16
|
+
#define _HPDF_IMAGE_H
|
17
|
+
|
18
|
+
#include "hpdf_objects.h"
|
19
|
+
|
20
|
+
#ifdef __cplusplus
|
21
|
+
extern "C" {
|
22
|
+
#endif
|
23
|
+
|
24
|
+
#ifndef HPDF_NOPNGLIB
|
25
|
+
|
26
|
+
HPDF_Image
|
27
|
+
HPDF_Image_LoadPngImage (HPDF_MMgr mmgr,
|
28
|
+
HPDF_Stream png_data,
|
29
|
+
HPDF_Xref xref,
|
30
|
+
HPDF_BOOL delayed_loading);
|
31
|
+
|
32
|
+
#endif
|
33
|
+
|
34
|
+
HPDF_Image
|
35
|
+
HPDF_Image_LoadJpegImage (HPDF_MMgr mmgr,
|
36
|
+
HPDF_Stream jpeg_data,
|
37
|
+
HPDF_Xref xref);
|
38
|
+
|
39
|
+
|
40
|
+
HPDF_Image
|
41
|
+
HPDF_Image_LoadRawImage (HPDF_MMgr mmgr,
|
42
|
+
HPDF_Stream stream,
|
43
|
+
HPDF_Xref xref,
|
44
|
+
HPDF_UINT width,
|
45
|
+
HPDF_UINT height,
|
46
|
+
HPDF_ColorSpace color_space);
|
47
|
+
|
48
|
+
|
49
|
+
HPDF_Image
|
50
|
+
HPDF_Image_LoadRawImageFromMem (HPDF_MMgr mmgr,
|
51
|
+
const HPDF_BYTE *buf,
|
52
|
+
HPDF_Xref xref,
|
53
|
+
HPDF_UINT width,
|
54
|
+
HPDF_UINT height,
|
55
|
+
HPDF_ColorSpace color_space,
|
56
|
+
HPDF_UINT bits_per_component);
|
57
|
+
|
58
|
+
|
59
|
+
HPDF_BOOL
|
60
|
+
HPDF_Image_Validate (HPDF_Image image);
|
61
|
+
|
62
|
+
|
63
|
+
HPDF_STATUS
|
64
|
+
HPDF_Image_SetMask (HPDF_Image image,
|
65
|
+
HPDF_BOOL mask);
|
66
|
+
|
67
|
+
#ifdef __cplusplus
|
68
|
+
}
|
69
|
+
#endif /* __cplusplus */
|
70
|
+
|
71
|
+
#endif /* _HPDF_XOBJECTS_H */
|
72
|
+
|
@@ -0,0 +1,48 @@
|
|
1
|
+
/*
|
2
|
+
* << Haru Free PDF Library 2.0.0 >> -- hpdf_info.c
|
3
|
+
*
|
4
|
+
* Copyright (c) 1999-2006 Takeshi Kanno <takeshi_kanno@est.hi-ho.ne.jp>
|
5
|
+
*
|
6
|
+
* Permission to use, copy, modify, distribute and sell this software
|
7
|
+
* and its documentation for any purpose is hereby granted without fee,
|
8
|
+
* provided that the above copyright notice appear in all copies and
|
9
|
+
* that both that copyright notice and this permission notice appear
|
10
|
+
* in supporting documentation.
|
11
|
+
* It is provided "as is" without express or implied warranty.
|
12
|
+
*
|
13
|
+
*/
|
14
|
+
|
15
|
+
|
16
|
+
#ifndef _HPDF_INFO_H
|
17
|
+
#define _HPDF_INFO_H
|
18
|
+
|
19
|
+
#include "hpdf_objects.h"
|
20
|
+
|
21
|
+
#ifdef __cplusplus
|
22
|
+
extern "C" {
|
23
|
+
#endif
|
24
|
+
|
25
|
+
|
26
|
+
HPDF_STATUS
|
27
|
+
HPDF_Info_SetInfoAttr (HPDF_Dict info,
|
28
|
+
HPDF_InfoType type,
|
29
|
+
const char *value,
|
30
|
+
HPDF_Encoder encoder);
|
31
|
+
|
32
|
+
|
33
|
+
const char*
|
34
|
+
HPDF_Info_GetInfoAttr (HPDF_Dict info,
|
35
|
+
HPDF_InfoType type);
|
36
|
+
|
37
|
+
|
38
|
+
HPDF_STATUS
|
39
|
+
HPDF_Info_SetInfoDateAttr (HPDF_Dict info,
|
40
|
+
HPDF_InfoType type,
|
41
|
+
HPDF_Date value);
|
42
|
+
|
43
|
+
#ifdef __cplusplus
|
44
|
+
}
|
45
|
+
#endif /* __cplusplus */
|
46
|
+
|
47
|
+
#endif /* _HPDF_INFO_H */
|
48
|
+
|
@@ -0,0 +1,85 @@
|
|
1
|
+
/*
|
2
|
+
* << Haru Free PDF Library 2.0.0 >> -- hpdf_list.h
|
3
|
+
*
|
4
|
+
* Copyright (c) 1999-2005 Takeshi Kanno <takeshi_kanno@est.hi-ho.ne.jp>
|
5
|
+
*
|
6
|
+
* Permission to use, copy, modify, distribute and sell this software
|
7
|
+
* and its documentation for any purpose is hereby granted without fee,
|
8
|
+
* provided that the above copyright notice appear in all copies and
|
9
|
+
* that both that copyright notice and this permission notice appear
|
10
|
+
* in supporting documentation.
|
11
|
+
* It is provided "as is" without express or implied warranty.
|
12
|
+
*
|
13
|
+
*/
|
14
|
+
|
15
|
+
#ifndef _HPDF_LIST_H
|
16
|
+
#define _HPDF_LIST_H
|
17
|
+
|
18
|
+
#include "hpdf_error.h"
|
19
|
+
#include "hpdf_mmgr.h"
|
20
|
+
|
21
|
+
#ifdef __cplusplus
|
22
|
+
extern "C" {
|
23
|
+
#endif
|
24
|
+
|
25
|
+
typedef struct _HPDF_List_Rec *HPDF_List;
|
26
|
+
|
27
|
+
typedef struct _HPDF_List_Rec {
|
28
|
+
HPDF_MMgr mmgr;
|
29
|
+
HPDF_Error error;
|
30
|
+
HPDF_UINT block_siz;
|
31
|
+
HPDF_UINT items_per_block;
|
32
|
+
HPDF_UINT count;
|
33
|
+
void **obj;
|
34
|
+
} HPDF_List_Rec;
|
35
|
+
|
36
|
+
|
37
|
+
HPDF_List
|
38
|
+
HPDF_List_New (HPDF_MMgr mmgr,
|
39
|
+
HPDF_UINT items_per_block);
|
40
|
+
|
41
|
+
|
42
|
+
void
|
43
|
+
HPDF_List_Free (HPDF_List list);
|
44
|
+
|
45
|
+
|
46
|
+
HPDF_STATUS
|
47
|
+
HPDF_List_Add (HPDF_List list,
|
48
|
+
void *item);
|
49
|
+
|
50
|
+
|
51
|
+
HPDF_STATUS
|
52
|
+
HPDF_List_Insert (HPDF_List list,
|
53
|
+
void *target,
|
54
|
+
void *item);
|
55
|
+
|
56
|
+
|
57
|
+
HPDF_STATUS
|
58
|
+
HPDF_List_Remove (HPDF_List list,
|
59
|
+
void *item);
|
60
|
+
|
61
|
+
|
62
|
+
void*
|
63
|
+
HPDF_List_RemoveByIndex (HPDF_List list,
|
64
|
+
HPDF_UINT index);
|
65
|
+
|
66
|
+
|
67
|
+
void*
|
68
|
+
HPDF_List_ItemAt (HPDF_List list,
|
69
|
+
HPDF_UINT index);
|
70
|
+
|
71
|
+
|
72
|
+
HPDF_INT32
|
73
|
+
HPDF_List_Find (HPDF_List list,
|
74
|
+
void *item);
|
75
|
+
|
76
|
+
|
77
|
+
void
|
78
|
+
HPDF_List_Clear (HPDF_List list);
|
79
|
+
|
80
|
+
#ifdef __cplusplus
|
81
|
+
}
|
82
|
+
#endif /* __cplusplus */
|
83
|
+
|
84
|
+
#endif /* _HPDF_LIST_H */
|
85
|
+
|
@@ -0,0 +1,82 @@
|
|
1
|
+
/*
|
2
|
+
* << Haru Free PDF Library 2.0.0 >> -- hpdf_mmgr.h
|
3
|
+
*
|
4
|
+
* Copyright (c) 1999-2006 Takeshi Kanno <takeshi_kanno@est.hi-ho.ne.jp>
|
5
|
+
*
|
6
|
+
* Permission to use, copy, modify, distribute and sell this software
|
7
|
+
* and its documentation for any purpose is hereby granted without fee,
|
8
|
+
* provided that the above copyright notice appear in all copies and
|
9
|
+
* that both that copyright notice and this permission notice appear
|
10
|
+
* in supporting documentation.
|
11
|
+
* It is provided "as is" without express or implied warranty.
|
12
|
+
*
|
13
|
+
*/
|
14
|
+
|
15
|
+
#ifndef _HPDF_MMGR_H
|
16
|
+
#define _HPDF_MMGR_H
|
17
|
+
|
18
|
+
#include "hpdf_types.h"
|
19
|
+
#include "hpdf_error.h"
|
20
|
+
|
21
|
+
#ifdef __cplusplus
|
22
|
+
extern "C" {
|
23
|
+
#endif
|
24
|
+
|
25
|
+
typedef struct _HPDF_MPool_Node_Rec *HPDF_MPool_Node;
|
26
|
+
|
27
|
+
typedef struct _HPDF_MPool_Node_Rec {
|
28
|
+
HPDF_BYTE* buf;
|
29
|
+
HPDF_UINT size;
|
30
|
+
HPDF_UINT used_size;
|
31
|
+
HPDF_MPool_Node next_node;
|
32
|
+
} HPDF_MPool_Node_Rec;
|
33
|
+
|
34
|
+
|
35
|
+
typedef struct _HPDF_MMgr_Rec *HPDF_MMgr;
|
36
|
+
|
37
|
+
typedef struct _HPDF_MMgr_Rec {
|
38
|
+
HPDF_Error error;
|
39
|
+
HPDF_Alloc_Func alloc_fn;
|
40
|
+
HPDF_Free_Func free_fn;
|
41
|
+
HPDF_MPool_Node mpool;
|
42
|
+
HPDF_UINT buf_size;
|
43
|
+
|
44
|
+
#ifdef HPDF_MEM_DEBUG
|
45
|
+
HPDF_UINT alloc_cnt;
|
46
|
+
HPDF_UINT free_cnt;
|
47
|
+
#endif
|
48
|
+
} HPDF_MMgr_Rec;
|
49
|
+
|
50
|
+
|
51
|
+
/* HPDF_mpool_new
|
52
|
+
*
|
53
|
+
* create new HPDF_mpool object. when memory allocation goes wrong,
|
54
|
+
* it returns NULL and error handling function will be called.
|
55
|
+
* if buf_size is non-zero, mmgr is configured to be using memory-pool
|
56
|
+
*/
|
57
|
+
HPDF_MMgr
|
58
|
+
HPDF_MMgr_New (HPDF_Error error,
|
59
|
+
HPDF_UINT buf_size,
|
60
|
+
HPDF_Alloc_Func alloc_fn,
|
61
|
+
HPDF_Free_Func free_fn);
|
62
|
+
|
63
|
+
|
64
|
+
void
|
65
|
+
HPDF_MMgr_Free (HPDF_MMgr mmgr);
|
66
|
+
|
67
|
+
|
68
|
+
void*
|
69
|
+
HPDF_GetMem (HPDF_MMgr mmgr,
|
70
|
+
HPDF_UINT size);
|
71
|
+
|
72
|
+
|
73
|
+
void
|
74
|
+
HPDF_FreeMem (HPDF_MMgr mmgr,
|
75
|
+
void *aptr);
|
76
|
+
|
77
|
+
#ifdef __cplusplus
|
78
|
+
}
|
79
|
+
#endif /* __cplusplus */
|
80
|
+
|
81
|
+
#endif /* _HPDF_MMGR_H */
|
82
|
+
|
@@ -0,0 +1,587 @@
|
|
1
|
+
/*
|
2
|
+
* << Haru Free PDF Library 2.0.5 >> -- hpdf_objects.c
|
3
|
+
*
|
4
|
+
* Copyright (c) 1999-2006 Takeshi Kanno <takeshi_kanno@est.hi-ho.ne.jp>
|
5
|
+
*
|
6
|
+
* Permission to use, copy, modify, distribute and sell this software
|
7
|
+
* and its documentation for any purpose is hereby granted without fee,
|
8
|
+
* provided that the above copyright notice appear in all copies and
|
9
|
+
* that both that copyright notice and this permission notice appear
|
10
|
+
* in supporting documentation.
|
11
|
+
* It is provided "as is" without express or implied warranty.
|
12
|
+
*
|
13
|
+
*/
|
14
|
+
|
15
|
+
#ifndef _HPDF_OBJECTS_H
|
16
|
+
#define _HPDF_OBJECTS_H
|
17
|
+
|
18
|
+
#include "hpdf_encoder.h"
|
19
|
+
|
20
|
+
#ifdef __cplusplus
|
21
|
+
extern "C" {
|
22
|
+
#endif
|
23
|
+
|
24
|
+
|
25
|
+
/* if HPDF_OTYPE_DIRECT bit is set, the object owned by other container
|
26
|
+
* object. if HPDF_OTYPE_INDIRECT bit is set, the object managed by xref.
|
27
|
+
*/
|
28
|
+
|
29
|
+
#define HPDF_OTYPE_NONE 0x00000000
|
30
|
+
#define HPDF_OTYPE_DIRECT 0x80000000
|
31
|
+
#define HPDF_OTYPE_INDIRECT 0x40000000
|
32
|
+
#define HPDF_OTYPE_ANY (HPDF_OTYPE_DIRECT | HPDF_OTYPE_INDIRECT)
|
33
|
+
#define HPDF_OTYPE_HIDDEN 0x10000000
|
34
|
+
|
35
|
+
#define HPDF_OCLASS_UNKNOWN 0x0001
|
36
|
+
#define HPDF_OCLASS_NULL 0x0002
|
37
|
+
#define HPDF_OCLASS_BOOLEAN 0x0003
|
38
|
+
#define HPDF_OCLASS_NUMBER 0x0004
|
39
|
+
#define HPDF_OCLASS_REAL 0x0005
|
40
|
+
#define HPDF_OCLASS_NAME 0x0006
|
41
|
+
#define HPDF_OCLASS_STRING 0x0007
|
42
|
+
#define HPDF_OCLASS_BINARY 0x0008
|
43
|
+
#define HPDF_OCLASS_ARRAY 0x0010
|
44
|
+
#define HPDF_OCLASS_DICT 0x0011
|
45
|
+
#define HPDF_OCLASS_PROXY 0x0012
|
46
|
+
#define HPDF_OCLASS_ANY 0x00FF
|
47
|
+
|
48
|
+
#define HPDF_OSUBCLASS_FONT 0x0100
|
49
|
+
#define HPDF_OSUBCLASS_CATALOG 0x0200
|
50
|
+
#define HPDF_OSUBCLASS_PAGES 0x0300
|
51
|
+
#define HPDF_OSUBCLASS_PAGE 0x0400
|
52
|
+
#define HPDF_OSUBCLASS_XOBJECT 0x0500
|
53
|
+
#define HPDF_OSUBCLASS_OUTLINE 0x0600
|
54
|
+
#define HPDF_OSUBCLASS_DESTINATION 0x0700
|
55
|
+
#define HPDF_OSUBCLASS_ANNOTATION 0x0800
|
56
|
+
#define HPDF_OSUBCLASS_ENCRYPT 0x0900
|
57
|
+
#define HPDF_OSUBCLASS_EXT_GSTATE 0x0A00
|
58
|
+
#define HPDF_OSUBCLASS_EXT_GSTATE_R 0x0B00 /* read only object */
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
/*----------------------------------------------------------------------------*/
|
63
|
+
/*------ Values related xref -------------------------------------------------*/
|
64
|
+
|
65
|
+
#define HPDF_FREE_ENTRY 'f'
|
66
|
+
#define HPDF_IN_USE_ENTRY 'n'
|
67
|
+
|
68
|
+
|
69
|
+
/*
|
70
|
+
* structure of Object-ID
|
71
|
+
*
|
72
|
+
* 1 direct-object
|
73
|
+
* 2 indirect-object
|
74
|
+
* 3 reserved
|
75
|
+
* 4 shadow-object
|
76
|
+
* 5-8 reserved
|
77
|
+
* 9-32 object-id�i0-8388607�j
|
78
|
+
*
|
79
|
+
* the real Object-ID is described "obj_id & 0x00FFFFFF"
|
80
|
+
*/
|
81
|
+
|
82
|
+
typedef struct _HPDF_Obj_Header {
|
83
|
+
HPDF_UINT32 obj_id;
|
84
|
+
HPDF_UINT16 gen_no;
|
85
|
+
HPDF_UINT16 obj_class;
|
86
|
+
} HPDF_Obj_Header;
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
HPDF_STATUS
|
91
|
+
HPDF_Obj_WriteValue (void *obj,
|
92
|
+
HPDF_Stream stream,
|
93
|
+
HPDF_Encrypt e);
|
94
|
+
|
95
|
+
|
96
|
+
HPDF_STATUS
|
97
|
+
HPDF_Obj_Write (void *obj,
|
98
|
+
HPDF_Stream stream,
|
99
|
+
HPDF_Encrypt e);
|
100
|
+
|
101
|
+
|
102
|
+
void
|
103
|
+
HPDF_Obj_Free (HPDF_MMgr mmgr,
|
104
|
+
void *obj);
|
105
|
+
|
106
|
+
|
107
|
+
void
|
108
|
+
HPDF_Obj_ForceFree (HPDF_MMgr mmgr,
|
109
|
+
void *obj);
|
110
|
+
|
111
|
+
|
112
|
+
/*---------------------------------------------------------------------------*/
|
113
|
+
/*----- HPDF_Null -----------------------------------------------------------*/
|
114
|
+
|
115
|
+
typedef struct _HPDF_Null_Rec *HPDF_Null;
|
116
|
+
|
117
|
+
typedef struct _HPDF_Null_Rec {
|
118
|
+
HPDF_Obj_Header header;
|
119
|
+
} HPDF_Null_Rec;
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
HPDF_Null
|
124
|
+
HPDF_Null_New (HPDF_MMgr mmgr);
|
125
|
+
|
126
|
+
|
127
|
+
/*---------------------------------------------------------------------------*/
|
128
|
+
/*----- HPDF_Boolean --------------------------------------------------------*/
|
129
|
+
|
130
|
+
typedef struct _HPDF_Boolean_Rec *HPDF_Boolean;
|
131
|
+
|
132
|
+
typedef struct _HPDF_Boolean_Rec {
|
133
|
+
HPDF_Obj_Header header;
|
134
|
+
HPDF_BOOL value;
|
135
|
+
} HPDF_Boolean_Rec;
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
HPDF_Boolean
|
140
|
+
HPDF_Boolean_New (HPDF_MMgr mmgr,
|
141
|
+
HPDF_BOOL value);
|
142
|
+
|
143
|
+
|
144
|
+
HPDF_STATUS
|
145
|
+
HPDF_Boolean_Write (HPDF_Boolean obj,
|
146
|
+
HPDF_Stream stream);
|
147
|
+
|
148
|
+
|
149
|
+
/*---------------------------------------------------------------------------*/
|
150
|
+
/*----- HPDF_Number ---------------------------------------------------------*/
|
151
|
+
|
152
|
+
typedef struct _HPDF_Number_Rec *HPDF_Number;
|
153
|
+
|
154
|
+
typedef struct _HPDF_Number_Rec {
|
155
|
+
HPDF_Obj_Header header;
|
156
|
+
HPDF_INT32 value;
|
157
|
+
} HPDF_Number_Rec;
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
HPDF_Number
|
162
|
+
HPDF_Number_New (HPDF_MMgr mmgr,
|
163
|
+
HPDF_INT32 value);
|
164
|
+
|
165
|
+
|
166
|
+
void
|
167
|
+
HPDF_Number_SetValue (HPDF_Number obj,
|
168
|
+
HPDF_INT32 value);
|
169
|
+
|
170
|
+
|
171
|
+
HPDF_STATUS
|
172
|
+
HPDF_Number_Write (HPDF_Number obj,
|
173
|
+
HPDF_Stream stream);
|
174
|
+
|
175
|
+
|
176
|
+
/*---------------------------------------------------------------------------*/
|
177
|
+
/*----- HPDF_Real -----------------------------------------------------------*/
|
178
|
+
|
179
|
+
typedef struct _HPDF_Real_Rec *HPDF_Real;
|
180
|
+
|
181
|
+
typedef struct _HPDF_Real_Rec {
|
182
|
+
HPDF_Obj_Header header;
|
183
|
+
HPDF_Error error;
|
184
|
+
HPDF_REAL value;
|
185
|
+
} HPDF_Real_Rec;
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
HPDF_Real
|
190
|
+
HPDF_Real_New (HPDF_MMgr mmgr,
|
191
|
+
HPDF_REAL value);
|
192
|
+
|
193
|
+
|
194
|
+
HPDF_STATUS
|
195
|
+
HPDF_Real_Write (HPDF_Real obj,
|
196
|
+
HPDF_Stream stream);
|
197
|
+
|
198
|
+
|
199
|
+
HPDF_STATUS
|
200
|
+
HPDF_Real_SetValue (HPDF_Real obj,
|
201
|
+
HPDF_REAL value);
|
202
|
+
|
203
|
+
|
204
|
+
/*---------------------------------------------------------------------------*/
|
205
|
+
/*----- HPDF_Name -----------------------------------------------------------*/
|
206
|
+
|
207
|
+
typedef struct _HPDF_Name_Rec *HPDF_Name;
|
208
|
+
|
209
|
+
typedef struct _HPDF_Name_Rec {
|
210
|
+
HPDF_Obj_Header header;
|
211
|
+
HPDF_Error error;
|
212
|
+
char value[HPDF_LIMIT_MAX_NAME_LEN + 1];
|
213
|
+
} HPDF_Name_Rec;
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
HPDF_Name
|
218
|
+
HPDF_Name_New (HPDF_MMgr mmgr,
|
219
|
+
const char *value);
|
220
|
+
|
221
|
+
|
222
|
+
HPDF_STATUS
|
223
|
+
HPDF_Name_SetValue (HPDF_Name obj,
|
224
|
+
const char *value);
|
225
|
+
|
226
|
+
|
227
|
+
HPDF_STATUS
|
228
|
+
HPDF_Name_Write (HPDF_Name obj,
|
229
|
+
HPDF_Stream stream);
|
230
|
+
|
231
|
+
const char*
|
232
|
+
HPDF_Name_GetValue (HPDF_Name obj);
|
233
|
+
|
234
|
+
|
235
|
+
/*---------------------------------------------------------------------------*/
|
236
|
+
/*----- HPDF_String ---------------------------------------------------------*/
|
237
|
+
|
238
|
+
typedef struct _HPDF_String_Rec *HPDF_String;
|
239
|
+
|
240
|
+
typedef struct _HPDF_String_Rec {
|
241
|
+
HPDF_Obj_Header header;
|
242
|
+
HPDF_MMgr mmgr;
|
243
|
+
HPDF_Error error;
|
244
|
+
HPDF_Encoder encoder;
|
245
|
+
HPDF_BYTE *value;
|
246
|
+
HPDF_UINT len;
|
247
|
+
} HPDF_String_Rec;
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
HPDF_String
|
252
|
+
HPDF_String_New (HPDF_MMgr mmgr,
|
253
|
+
const char *value,
|
254
|
+
HPDF_Encoder encoder);
|
255
|
+
|
256
|
+
|
257
|
+
HPDF_STATUS
|
258
|
+
HPDF_String_SetValue (HPDF_String obj,
|
259
|
+
const char *value);
|
260
|
+
|
261
|
+
|
262
|
+
void
|
263
|
+
HPDF_String_Free (HPDF_String obj);
|
264
|
+
|
265
|
+
|
266
|
+
HPDF_STATUS
|
267
|
+
HPDF_String_Write (HPDF_String obj,
|
268
|
+
HPDF_Stream stream,
|
269
|
+
HPDF_Encrypt e);
|
270
|
+
|
271
|
+
|
272
|
+
HPDF_STATUS
|
273
|
+
HPDF_String_SetValue (HPDF_String obj,
|
274
|
+
const char *value);
|
275
|
+
|
276
|
+
|
277
|
+
/*---------------------------------------------------------------------------*/
|
278
|
+
/*----- HPDF_Binary ---------------------------------------------------------*/
|
279
|
+
|
280
|
+
typedef struct _HPDF_Binary_Rec *HPDF_Binary;
|
281
|
+
|
282
|
+
typedef struct _HPDF_Binary_Rec {
|
283
|
+
HPDF_Obj_Header header;
|
284
|
+
HPDF_MMgr mmgr;
|
285
|
+
HPDF_Error error;
|
286
|
+
HPDF_BYTE *value;
|
287
|
+
HPDF_UINT len;
|
288
|
+
} HPDF_Binary_Rec;
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
HPDF_Binary
|
293
|
+
HPDF_Binary_New (HPDF_MMgr mmgr,
|
294
|
+
HPDF_BYTE *value,
|
295
|
+
HPDF_UINT len);
|
296
|
+
|
297
|
+
|
298
|
+
HPDF_STATUS
|
299
|
+
HPDF_Binary_SetValue (HPDF_Binary obj,
|
300
|
+
HPDF_BYTE *value,
|
301
|
+
HPDF_UINT len);
|
302
|
+
|
303
|
+
|
304
|
+
HPDF_BYTE*
|
305
|
+
HPDF_Binary_GetValue (HPDF_Binary obj);
|
306
|
+
|
307
|
+
|
308
|
+
void
|
309
|
+
HPDF_Binary_Free (HPDF_Binary obj);
|
310
|
+
|
311
|
+
|
312
|
+
HPDF_STATUS
|
313
|
+
HPDF_Binary_Write (HPDF_Binary obj,
|
314
|
+
HPDF_Stream stream,
|
315
|
+
HPDF_Encrypt e);
|
316
|
+
|
317
|
+
|
318
|
+
HPDF_UINT
|
319
|
+
HPDF_Binary_GetLen (HPDF_Binary obj);
|
320
|
+
|
321
|
+
|
322
|
+
/*---------------------------------------------------------------------------*/
|
323
|
+
/*----- HPDF_Array ----------------------------------------------------------*/
|
324
|
+
|
325
|
+
typedef struct _HPDF_Array_Rec *HPDF_Array;
|
326
|
+
|
327
|
+
typedef struct _HPDF_Array_Rec {
|
328
|
+
HPDF_Obj_Header header;
|
329
|
+
HPDF_MMgr mmgr;
|
330
|
+
HPDF_Error error;
|
331
|
+
HPDF_List list;
|
332
|
+
} HPDF_Array_Rec;
|
333
|
+
|
334
|
+
|
335
|
+
HPDF_Array
|
336
|
+
HPDF_Array_New (HPDF_MMgr mmgr);
|
337
|
+
|
338
|
+
|
339
|
+
HPDF_Array
|
340
|
+
HPDF_Box_Array_New (HPDF_MMgr mmgr,
|
341
|
+
HPDF_Box box);
|
342
|
+
|
343
|
+
|
344
|
+
void
|
345
|
+
HPDF_Array_Free (HPDF_Array array);
|
346
|
+
|
347
|
+
|
348
|
+
HPDF_STATUS
|
349
|
+
HPDF_Array_Write (HPDF_Array array,
|
350
|
+
HPDF_Stream stream,
|
351
|
+
HPDF_Encrypt e);
|
352
|
+
|
353
|
+
|
354
|
+
HPDF_STATUS
|
355
|
+
HPDF_Array_Add (HPDF_Array array,
|
356
|
+
void *obj);
|
357
|
+
|
358
|
+
|
359
|
+
HPDF_STATUS
|
360
|
+
HPDF_Array_Insert (HPDF_Array array,
|
361
|
+
void *target,
|
362
|
+
void *obj);
|
363
|
+
|
364
|
+
|
365
|
+
void*
|
366
|
+
HPDF_Array_GetItem (HPDF_Array array,
|
367
|
+
HPDF_UINT index,
|
368
|
+
HPDF_UINT16 obj_class);
|
369
|
+
|
370
|
+
|
371
|
+
HPDF_STATUS
|
372
|
+
HPDF_Array_AddNumber (HPDF_Array array,
|
373
|
+
HPDF_INT32 value);
|
374
|
+
|
375
|
+
|
376
|
+
HPDF_STATUS
|
377
|
+
HPDF_Array_AddReal (HPDF_Array array,
|
378
|
+
HPDF_REAL value);
|
379
|
+
|
380
|
+
|
381
|
+
HPDF_STATUS
|
382
|
+
HPDF_Array_AddName (HPDF_Array array,
|
383
|
+
const char *value);
|
384
|
+
|
385
|
+
void
|
386
|
+
HPDF_Array_Clear (HPDF_Array array);
|
387
|
+
|
388
|
+
|
389
|
+
/*---------------------------------------------------------------------------*/
|
390
|
+
/*----- HPDF_Dict -----------------------------------------------------------*/
|
391
|
+
|
392
|
+
typedef struct _HPDF_Xref_Rec *HPDF_Xref;
|
393
|
+
|
394
|
+
typedef struct _HPDF_Dict_Rec *HPDF_Dict;
|
395
|
+
|
396
|
+
typedef void
|
397
|
+
(*HPDF_Dict_FreeFunc) (HPDF_Dict obj);
|
398
|
+
|
399
|
+
typedef HPDF_STATUS
|
400
|
+
(*HPDF_Dict_BeforeWriteFunc) (HPDF_Dict obj);
|
401
|
+
|
402
|
+
typedef HPDF_STATUS
|
403
|
+
(*HPDF_Dict_AfterWriteFunc) (HPDF_Dict obj);
|
404
|
+
|
405
|
+
typedef HPDF_STATUS
|
406
|
+
(*HPDF_Dict_OnWriteFunc) (HPDF_Dict obj,
|
407
|
+
HPDF_Stream stream);
|
408
|
+
|
409
|
+
typedef struct _HPDF_Dict_Rec {
|
410
|
+
HPDF_Obj_Header header;
|
411
|
+
HPDF_MMgr mmgr;
|
412
|
+
HPDF_Error error;
|
413
|
+
HPDF_List list;
|
414
|
+
HPDF_Dict_BeforeWriteFunc before_write_fn;
|
415
|
+
HPDF_Dict_OnWriteFunc write_fn;
|
416
|
+
HPDF_Dict_AfterWriteFunc after_write_fn;
|
417
|
+
HPDF_Dict_FreeFunc free_fn;
|
418
|
+
HPDF_Stream stream;
|
419
|
+
HPDF_UINT filter;
|
420
|
+
void *attr;
|
421
|
+
} HPDF_Dict_Rec;
|
422
|
+
|
423
|
+
|
424
|
+
typedef struct _HPDF_DictElement_Rec *HPDF_DictElement;
|
425
|
+
|
426
|
+
typedef struct _HPDF_DictElement_Rec {
|
427
|
+
char key[HPDF_LIMIT_MAX_NAME_LEN + 1];
|
428
|
+
void *value;
|
429
|
+
} HPDF_DictElement_Rec;
|
430
|
+
|
431
|
+
|
432
|
+
HPDF_Dict
|
433
|
+
HPDF_Dict_New (HPDF_MMgr mmgr);
|
434
|
+
|
435
|
+
|
436
|
+
HPDF_Dict
|
437
|
+
HPDF_DictStream_New (HPDF_MMgr mmgr,
|
438
|
+
HPDF_Xref xref);
|
439
|
+
|
440
|
+
|
441
|
+
void
|
442
|
+
HPDF_Dict_Free (HPDF_Dict dict);
|
443
|
+
|
444
|
+
|
445
|
+
HPDF_STATUS
|
446
|
+
HPDF_Dict_Write (HPDF_Dict dict,
|
447
|
+
HPDF_Stream stream,
|
448
|
+
HPDF_Encrypt e);
|
449
|
+
|
450
|
+
|
451
|
+
const char*
|
452
|
+
HPDF_Dict_GetKeyByObj (HPDF_Dict dict,
|
453
|
+
void *obj);
|
454
|
+
|
455
|
+
|
456
|
+
HPDF_STATUS
|
457
|
+
HPDF_Dict_Add (HPDF_Dict dict,
|
458
|
+
const char *key,
|
459
|
+
void *obj);
|
460
|
+
|
461
|
+
|
462
|
+
void*
|
463
|
+
HPDF_Dict_GetItem (HPDF_Dict dict,
|
464
|
+
const char *key,
|
465
|
+
HPDF_UINT16 obj_class);
|
466
|
+
|
467
|
+
|
468
|
+
HPDF_STATUS
|
469
|
+
HPDF_Dict_AddName (HPDF_Dict dict,
|
470
|
+
const char *key,
|
471
|
+
const char *value);
|
472
|
+
|
473
|
+
|
474
|
+
HPDF_STATUS
|
475
|
+
HPDF_Dict_AddNumber (HPDF_Dict dict,
|
476
|
+
const char *key,
|
477
|
+
HPDF_INT32 value);
|
478
|
+
|
479
|
+
|
480
|
+
HPDF_STATUS
|
481
|
+
HPDF_Dict_AddReal (HPDF_Dict dict,
|
482
|
+
const char *key,
|
483
|
+
HPDF_REAL value);
|
484
|
+
|
485
|
+
|
486
|
+
HPDF_STATUS
|
487
|
+
HPDF_Dict_AddBoolean (HPDF_Dict dict,
|
488
|
+
const char *key,
|
489
|
+
HPDF_BOOL value);
|
490
|
+
|
491
|
+
|
492
|
+
HPDF_STATUS
|
493
|
+
HPDF_Dict_RemoveElement (HPDF_Dict dict,
|
494
|
+
const char *key);
|
495
|
+
|
496
|
+
|
497
|
+
/*---------------------------------------------------------------------------*/
|
498
|
+
/*----- HPDF_ProxyObject ----------------------------------------------------*/
|
499
|
+
|
500
|
+
|
501
|
+
|
502
|
+
typedef struct _HPDF_Proxy_Rec *HPDF_Proxy;
|
503
|
+
|
504
|
+
typedef struct _HPDF_Proxy_Rec {
|
505
|
+
HPDF_Obj_Header header;
|
506
|
+
void *obj;
|
507
|
+
} HPDF_Proxy_Rec;
|
508
|
+
|
509
|
+
|
510
|
+
HPDF_Proxy
|
511
|
+
HPDF_Proxy_New (HPDF_MMgr mmgr,
|
512
|
+
void *obj);
|
513
|
+
|
514
|
+
|
515
|
+
|
516
|
+
/*---------------------------------------------------------------------------*/
|
517
|
+
/*----- HPDF_Xref -----------------------------------------------------------*/
|
518
|
+
|
519
|
+
typedef struct _HPDF_XrefEntry_Rec *HPDF_XrefEntry;
|
520
|
+
|
521
|
+
typedef struct _HPDF_XrefEntry_Rec {
|
522
|
+
char entry_typ;
|
523
|
+
HPDF_UINT byte_offset;
|
524
|
+
HPDF_UINT16 gen_no;
|
525
|
+
void* obj;
|
526
|
+
} HPDF_XrefEntry_Rec;
|
527
|
+
|
528
|
+
|
529
|
+
typedef struct _HPDF_Xref_Rec {
|
530
|
+
HPDF_MMgr mmgr;
|
531
|
+
HPDF_Error error;
|
532
|
+
HPDF_UINT32 start_offset;
|
533
|
+
HPDF_List entries;
|
534
|
+
HPDF_UINT addr;
|
535
|
+
HPDF_Xref prev;
|
536
|
+
HPDF_Dict trailer;
|
537
|
+
} HPDF_Xref_Rec;
|
538
|
+
|
539
|
+
|
540
|
+
HPDF_Xref
|
541
|
+
HPDF_Xref_New (HPDF_MMgr mmgr,
|
542
|
+
HPDF_UINT32 offset);
|
543
|
+
|
544
|
+
|
545
|
+
void
|
546
|
+
HPDF_Xref_Free (HPDF_Xref xref);
|
547
|
+
|
548
|
+
|
549
|
+
HPDF_STATUS
|
550
|
+
HPDF_Xref_Add (HPDF_Xref xref,
|
551
|
+
void *obj);
|
552
|
+
|
553
|
+
|
554
|
+
HPDF_XrefEntry
|
555
|
+
HPDF_Xref_GetEntry (HPDF_Xref xref,
|
556
|
+
HPDF_UINT index);
|
557
|
+
|
558
|
+
|
559
|
+
HPDF_STATUS
|
560
|
+
HPDF_Xref_WriteToStream (HPDF_Xref xref,
|
561
|
+
HPDF_Stream stream,
|
562
|
+
HPDF_Encrypt e);
|
563
|
+
|
564
|
+
|
565
|
+
HPDF_XrefEntry
|
566
|
+
HPDF_Xref_GetEntryByObjectId (HPDF_Xref xref,
|
567
|
+
HPDF_UINT obj_id);
|
568
|
+
|
569
|
+
|
570
|
+
|
571
|
+
typedef HPDF_Dict HPDF_Pages;
|
572
|
+
typedef HPDF_Dict HPDF_Page;
|
573
|
+
typedef HPDF_Dict HPDF_Annotation;
|
574
|
+
typedef HPDF_Dict HPDF_XObject;
|
575
|
+
typedef HPDF_Dict HPDF_Image;
|
576
|
+
typedef HPDF_Dict HPDF_Outline;
|
577
|
+
typedef HPDF_Dict HPDF_EncryptDict;
|
578
|
+
typedef HPDF_Dict HPDF_Action;
|
579
|
+
typedef HPDF_Dict HPDF_ExtGState;
|
580
|
+
typedef HPDF_Array HPDF_Destination;
|
581
|
+
|
582
|
+
#ifdef __cplusplus
|
583
|
+
}
|
584
|
+
#endif /* __cplusplus */
|
585
|
+
|
586
|
+
#endif /* _HPDF_OBJECTS_H */
|
587
|
+
|