Haru Free PDF Library
hpdf_consts.h
Go to the documentation of this file.
1 /*
2  * << Haru Free PDF Library >> -- hpdf_consts.h
3  *
4  * URL: http://libharu.org
5  *
6  * Copyright (c) 1999-2006 Takeshi Kanno <takeshi_kanno@est.hi-ho.ne.jp>
7  * Copyright (c) 2007-2009 Antony Dovgal <tony@daylessday.org>
8  *
9  * Permission to use, copy, modify, distribute and sell this software
10  * and its documentation for any purpose is hereby granted without fee,
11  * provided that the above copyright notice appear in all copies and
12  * that both that copyright notice and this permission notice appear
13  * in supporting documentation.
14  * It is provided "as is" without express or implied warranty.
15  *
16  */
17 
18 
19 #ifndef _HPDF_CONSTS_H
20 #define _HPDF_CONSTS_H
21 
22 #include "hpdf_types.h"
23 
24 /*----------------------------------------------------------------------------*/
25 
26 #define HPDF_TRUE 1
27 #define HPDF_FALSE 0
28 
29 #define HPDF_OK 0
30 #define HPDF_NOERROR 0
31 
32 #define HPDF_PI 3.14159265358979323846
33 
34 /*----- default values -------------------------------------------------------*/
35 
36 /* buffer size which is required when we convert to character string. */
37 #define HPDF_TMP_BUF_SIZ 512
38 #define HPDF_SHORT_BUF_SIZ 32
39 #define HPDF_REAL_LEN 64
40 #define HPDF_INT_LEN 11
41 #define HPDF_TEXT_DEFAULT_LEN 256
42 #define HPDF_UNICODE_HEADER_LEN 2
43 #define HPDF_DATE_TIME_STR_LEN 23
44 
45 /* length of each item defined in PDF */
46 #define HPDF_BYTE_OFFSET_LEN 10
47 #define HPDF_OBJ_ID_LEN 7
48 #define HPDF_GEN_NO_LEN 5
49 
50 /* default value of Graphic State */
51 #define HPDF_DEF_FONT "Helvetica"
52 #define HPDF_DEF_PAGE_LAYOUT HPDF_PAGE_LAYOUT_SINGLE
53 #define HPDF_DEF_PAGE_MODE HPDF_PAGE_MODE_USE_NONE
54 #define HPDF_DEF_WORDSPACE 0
55 #define HPDF_DEF_CHARSPACE 0
56 #define HPDF_DEF_FONTSIZE 10
57 #define HPDF_DEF_HSCALING 100
58 #define HPDF_DEF_LEADING 0
59 #define HPDF_DEF_RENDERING_MODE HPDF_FILL
60 #define HPDF_DEF_RISE 0
61 #define HPDF_DEF_RAISE HPDF_DEF_RISE
62 #define HPDF_DEF_LINEWIDTH 1
63 #define HPDF_DEF_LINECAP HPDF_BUTT_END
64 #define HPDF_DEF_LINEJOIN HPDF_MITER_JOIN
65 #define HPDF_DEF_MITERLIMIT 10
66 #define HPDF_DEF_FLATNESS 1
67 #define HPDF_DEF_PAGE_NUM 1
68 
69 #define HPDF_BS_DEF_WIDTH 1
70 
71 /* default page-size */
72 #define HPDF_DEF_PAGE_WIDTH 595.276F
73 #define HPDF_DEF_PAGE_HEIGHT 841.89F
74 
75 /*---------------------------------------------------------------------------*/
76 /*----- compression mode ----------------------------------------------------*/
77 
78 #define HPDF_COMP_NONE 0x00
79 #define HPDF_COMP_TEXT 0x01
80 #define HPDF_COMP_IMAGE 0x02
81 #define HPDF_COMP_METADATA 0x04
82 #define HPDF_COMP_ALL 0x0F
83 /* #define HPDF_COMP_BEST_COMPRESS 0x10
84  * #define HPDF_COMP_BEST_SPEED 0x20
85  */
86 #define HPDF_COMP_MASK 0xFF
87 
88 
89 /*----------------------------------------------------------------------------*/
90 /*----- permission flags (only Revision 2 is supported)-----------------------*/
91 
92 #define HPDF_ENABLE_READ 0
93 #define HPDF_ENABLE_PRINT 4
94 #define HPDF_ENABLE_EDIT_ALL 8
95 #define HPDF_ENABLE_COPY 16
96 #define HPDF_ENABLE_EDIT 32
97 
98 
99 /*----------------------------------------------------------------------------*/
100 /*------ viewer preferences definitions --------------------------------------*/
101 
102 #define HPDF_HIDE_TOOLBAR 1
103 #define HPDF_HIDE_MENUBAR 2
104 #define HPDF_HIDE_WINDOW_UI 4
105 #define HPDF_FIT_WINDOW 8
106 #define HPDF_CENTER_WINDOW 16
107 #define HPDF_PRINT_SCALING_NONE 32
108 
109 
110 /*---------------------------------------------------------------------------*/
111 /*------ limitation of object implementation (PDF1.4) -----------------------*/
112 
113 #define HPDF_LIMIT_MAX_INT 2147483647
114 #define HPDF_LIMIT_MIN_INT -2147483647
115 
116 #define HPDF_LIMIT_MAX_REAL 3.4E38f // per PDF 1.7 spec, Annex C, old value 32767
117 #define HPDF_LIMIT_MIN_REAL -3.4E38f // per PDF 1.7 spec, Annex C, old value -32767
118 
119 #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
120 #define HPDF_LIMIT_MAX_NAME_LEN 127
121 
122 #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
123 #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
124 #define HPDF_LIMIT_MAX_XREF_ELEMENT 8388607
125 #define HPDF_LIMIT_MAX_GSTATE 28
126 #define HPDF_LIMIT_MAX_DEVICE_N 8
127 #define HPDF_LIMIT_MAX_DEVICE_N_V15 32
128 #define HPDF_LIMIT_MAX_CID 65535
129 #define HPDF_MAX_GENERATION_NUM 65535
130 
131 #define HPDF_MIN_MAGNIFICATION_FACTOR 0.08 // 8 percent
132 #define HPDF_MAX_MAGNIFICATION_FACTOR 64.00 // 6400 percent
133 
134 /*---------------------------------------------------------------------------*/
135 /*------ limitation of various properties -----------------------------------*/
136 
138 #define HPDF_MIN_PAGE_MEASURE 3
139 
141 #define HPDF_MAX_PAGE_MEASURE 14400
142 
143 #define HPDF_MIN_HORIZONTALSCALING 10
144 #define HPDF_MAX_HORIZONTALSCALING 300
145 #define HPDF_MIN_WORDSPACE -30
146 #define HPDF_MAX_WORDSPACE 300
147 #define HPDF_MIN_CHARSPACE -30
148 #define HPDF_MAX_CHARSPACE 300
149 #define HPDF_MAX_FONTSIZE 600
150 #define HPDF_MAX_ZOOMSIZE 10
151 #define HPDF_MAX_LEADING 300
152 #define HPDF_MAX_LINEWIDTH 100
153 #define HPDF_MAX_DASH_PATTERN 100
154 
155 #define HPDF_MAX_JWW_NUM 128
156 
157 static const HPDF_TransMatrix IDENTITY_MATRIX = {1, 0, 0, 1, 0, 0};
158 static const HPDF_RGBColor DEF_RGB_COLOR = {0, 0, 0};
159 static const HPDF_CMYKColor DEF_CMYK_COLOR = {0, 0, 0, 0};
160 static const HPDF_DashMode DEF_DASH_MODE = {{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, 0, 0.0f};
161 
162 /*----------------------------------------------------------------------------*/
163 /*----- Graphics mode --------------------------------------------------------*/
164 
165 #define HPDF_GMODE_PAGE_DESCRIPTION 0x0001
166 #define HPDF_GMODE_PATH_OBJECT 0x0002
167 #define HPDF_GMODE_TEXT_OBJECT 0x0004
168 #define HPDF_GMODE_CLIPPING_PATH 0x0008
169 #define HPDF_GMODE_SHADING 0x0010
170 #define HPDF_GMODE_INLINE_IMAGE 0x0020
171 #define HPDF_GMODE_EXTERNAL_OBJECT 0x0040
172 
173 
174 /*----------------------------------------------------------------------------*/
178 #define HPDF_MM 2.834646
179 
183 #define HPDF_IN 72.00000
184 
185 #endif /* _HPDF_CONSTS_H */
Definition: hpdf_types.h:296
Definition: hpdf_types.h:230
Definition: hpdf_types.h:287
Definition: hpdf_types.h:240