hpdf 2.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. data/History +57 -0
  2. data/License +25 -0
  3. data/README +165 -0
  4. data/examples/arc_demo.rb +82 -0
  5. data/examples/demo.rb +92 -0
  6. data/examples/encryption.rb +41 -0
  7. data/examples/ext_gstater_demo.rb +171 -0
  8. data/examples/font_demo.rb +67 -0
  9. data/examples/jpfont_demo.rb +122 -0
  10. data/examples/line_demo.rb +301 -0
  11. data/examples/slide_show_demo.rb +139 -0
  12. data/examples/text_demo2.rb +189 -0
  13. data/examples/ttfont_demo.rb +106 -0
  14. data/ext/extconf.rb +6 -0
  15. data/ext/hpdf.c +3779 -0
  16. data/ext/hpdf_annotation.c +415 -0
  17. data/ext/hpdf_array.c +344 -0
  18. data/ext/hpdf_binary.c +117 -0
  19. data/ext/hpdf_boolean.c +47 -0
  20. data/ext/hpdf_catalog.c +354 -0
  21. data/ext/hpdf_destination.c +339 -0
  22. data/ext/hpdf_dict.c +488 -0
  23. data/ext/hpdf_doc.c +2020 -0
  24. data/ext/hpdf_doc_png.c +137 -0
  25. data/ext/hpdf_encoder.c +2991 -0
  26. data/ext/hpdf_encoder_cns.c +36359 -0
  27. data/ext/hpdf_encoder_cnt.c +15307 -0
  28. data/ext/hpdf_encoder_jp.c +16125 -0
  29. data/ext/hpdf_encoder_kr.c +27978 -0
  30. data/ext/hpdf_encrypt.c +632 -0
  31. data/ext/hpdf_encryptdict.c +240 -0
  32. data/ext/hpdf_error.c +114 -0
  33. data/ext/hpdf_ext_gstate.c +150 -0
  34. data/ext/hpdf_font.c +229 -0
  35. data/ext/hpdf_font_cid.c +1030 -0
  36. data/ext/hpdf_font_tt.c +406 -0
  37. data/ext/hpdf_font_type1.c +391 -0
  38. data/ext/hpdf_fontdef.c +56 -0
  39. data/ext/hpdf_fontdef_base14.c +4506 -0
  40. data/ext/hpdf_fontdef_cid.c +194 -0
  41. data/ext/hpdf_fontdef_cns.c +471 -0
  42. data/ext/hpdf_fontdef_cnt.c +250 -0
  43. data/ext/hpdf_fontdef_jp.c +1904 -0
  44. data/ext/hpdf_fontdef_kr.c +1572 -0
  45. data/ext/hpdf_fontdef_tt.c +2230 -0
  46. data/ext/hpdf_fontdef_type1.c +524 -0
  47. data/ext/hpdf_gstate.c +119 -0
  48. data/ext/hpdf_image.c +568 -0
  49. data/ext/hpdf_image_png.c +424 -0
  50. data/ext/hpdf_info.c +164 -0
  51. data/ext/hpdf_list.c +333 -0
  52. data/ext/hpdf_mmgr.c +243 -0
  53. data/ext/hpdf_name.c +71 -0
  54. data/ext/hpdf_null.c +31 -0
  55. data/ext/hpdf_number.c +49 -0
  56. data/ext/hpdf_objects.c +172 -0
  57. data/ext/hpdf_outline.c +329 -0
  58. data/ext/hpdf_page_label.c +74 -0
  59. data/ext/hpdf_page_operator.c +2764 -0
  60. data/ext/hpdf_pages.c +1508 -0
  61. data/ext/hpdf_real.c +61 -0
  62. data/ext/hpdf_streams.c +1435 -0
  63. data/ext/hpdf_string.c +189 -0
  64. data/ext/hpdf_utils.c +438 -0
  65. data/ext/hpdf_xref.c +348 -0
  66. data/ext/include/hpdf.h +1227 -0
  67. data/ext/include/hpdf_annotation.h +74 -0
  68. data/ext/include/hpdf_catalog.h +81 -0
  69. data/ext/include/hpdf_conf.h +76 -0
  70. data/ext/include/hpdf_consts.h +549 -0
  71. data/ext/include/hpdf_destination.h +41 -0
  72. data/ext/include/hpdf_doc.h +159 -0
  73. data/ext/include/hpdf_encoder.h +311 -0
  74. data/ext/include/hpdf_encrypt.h +156 -0
  75. data/ext/include/hpdf_encryptdict.h +66 -0
  76. data/ext/include/hpdf_error.h +201 -0
  77. data/ext/include/hpdf_ext_gstate.h +38 -0
  78. data/ext/include/hpdf_font.h +112 -0
  79. data/ext/include/hpdf_fontdef.h +403 -0
  80. data/ext/include/hpdf_gstate.h +80 -0
  81. data/ext/include/hpdf_image.h +72 -0
  82. data/ext/include/hpdf_info.h +48 -0
  83. data/ext/include/hpdf_list.h +85 -0
  84. data/ext/include/hpdf_mmgr.h +82 -0
  85. data/ext/include/hpdf_objects.h +587 -0
  86. data/ext/include/hpdf_outline.h +74 -0
  87. data/ext/include/hpdf_page_label.h +35 -0
  88. data/ext/include/hpdf_pages.h +128 -0
  89. data/ext/include/hpdf_streams.h +276 -0
  90. data/ext/include/hpdf_types.h +488 -0
  91. data/ext/include/hpdf_utils.h +161 -0
  92. data/tests/arc_demo.rb +82 -0
  93. data/tests/demo.rb +91 -0
  94. data/tests/encryption.rb +41 -0
  95. data/tests/ext_gstater_demo.rb +171 -0
  96. data/tests/font_demo.rb +67 -0
  97. data/tests/line_demo.rb +301 -0
  98. data/tests/slide_show_demo.rb +139 -0
  99. data/tests/test_all_examples.rb +31 -0
  100. data/tests/text_demo2.rb +189 -0
  101. metadata +147 -0
@@ -0,0 +1,117 @@
1
+ /*
2
+ * << Haru Free PDF Library 2.0.0 >> -- hpdf_binary.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
+ #include "hpdf_conf.h"
16
+ #include "hpdf_utils.h"
17
+ #include "hpdf_objects.h"
18
+
19
+
20
+ HPDF_Binary
21
+ HPDF_Binary_New (HPDF_MMgr mmgr,
22
+ HPDF_BYTE *value,
23
+ HPDF_UINT len)
24
+ {
25
+ HPDF_Binary obj;
26
+
27
+ obj = HPDF_GetMem (mmgr, sizeof(HPDF_Binary_Rec));
28
+
29
+ if (obj) {
30
+ HPDF_MemSet(&obj->header, 0, sizeof(HPDF_Obj_Header));
31
+ obj->header.obj_class = HPDF_OCLASS_BINARY;
32
+
33
+ obj->mmgr = mmgr;
34
+ obj->error = mmgr->error;
35
+ obj->value = NULL;
36
+ obj->len = 0;
37
+ if (HPDF_Binary_SetValue (obj, value, len) != HPDF_OK) {
38
+ HPDF_FreeMem (mmgr, obj);
39
+ return NULL;
40
+ }
41
+ }
42
+
43
+ return obj;
44
+ }
45
+
46
+ HPDF_STATUS
47
+ HPDF_Binary_Write (HPDF_Binary obj,
48
+ HPDF_Stream stream,
49
+ HPDF_Encrypt e)
50
+ {
51
+ HPDF_STATUS ret;
52
+
53
+ if (obj->len == 0)
54
+ return HPDF_Stream_WriteStr (stream, "<>");
55
+
56
+ if ((ret = HPDF_Stream_WriteChar (stream, '<')) != HPDF_OK)
57
+ return ret;
58
+
59
+ if (e)
60
+ HPDF_Encrypt_Reset (e);
61
+
62
+ if ((ret = HPDF_Stream_WriteBinary (stream, obj->value, obj->len, e)) !=
63
+ HPDF_OK)
64
+ return ret;
65
+
66
+ return HPDF_Stream_WriteChar (stream, '>');
67
+ }
68
+
69
+
70
+ HPDF_STATUS
71
+ HPDF_Binary_SetValue (HPDF_Binary obj,
72
+ HPDF_BYTE *value,
73
+ HPDF_UINT len)
74
+ {
75
+ if (len > HPDF_LIMIT_MAX_STRING_LEN)
76
+ return HPDF_SetError (obj->error, HPDF_BINARY_LENGTH_ERR, 0);
77
+
78
+ if (obj->value) {
79
+ HPDF_FreeMem (obj->mmgr, obj->value);
80
+ obj->len = 0;
81
+ }
82
+
83
+ obj->value = HPDF_GetMem (obj->mmgr, len);
84
+ if (!obj->value)
85
+ return HPDF_Error_GetCode (obj->error);
86
+
87
+ HPDF_MemCpy (obj->value, value, len);
88
+ obj->len = len;
89
+
90
+ return HPDF_OK;
91
+ }
92
+
93
+
94
+ void
95
+ HPDF_Binary_Free (HPDF_Binary obj)
96
+ {
97
+ if (!obj)
98
+ return;
99
+
100
+ if (obj->value)
101
+ HPDF_FreeMem (obj->mmgr, obj->value);
102
+
103
+ HPDF_FreeMem (obj->mmgr, obj);
104
+ }
105
+
106
+ HPDF_UINT
107
+ HPDF_Binary_GetLen (HPDF_Binary obj)
108
+ {
109
+ return obj->len;
110
+ }
111
+
112
+ HPDF_BYTE*
113
+ HPDF_Binary_GetValue (HPDF_Binary obj)
114
+ {
115
+ return obj->value;
116
+ }
117
+
@@ -0,0 +1,47 @@
1
+ /*
2
+ * << Haru Free PDF Library 2.0.0 >> -- hpdf_boolean.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
+ #include "hpdf_utils.h"
16
+ #include "hpdf_objects.h"
17
+
18
+ HPDF_Boolean
19
+ HPDF_Boolean_New (HPDF_MMgr mmgr,
20
+ HPDF_BOOL value)
21
+ {
22
+ HPDF_Boolean obj = HPDF_GetMem (mmgr, sizeof(HPDF_Boolean_Rec));
23
+
24
+ if (obj) {
25
+ HPDF_MemSet(&obj->header, 0, sizeof(HPDF_Obj_Header));
26
+ obj->header.obj_class = HPDF_OCLASS_BOOLEAN;
27
+ obj->value = value;
28
+ }
29
+
30
+ return obj;
31
+ }
32
+
33
+
34
+ HPDF_STATUS
35
+ HPDF_Boolean_Write (HPDF_Boolean obj,
36
+ HPDF_Stream stream)
37
+ {
38
+ HPDF_STATUS ret;
39
+
40
+ if (obj->value)
41
+ ret = HPDF_Stream_WriteStr (stream, "true");
42
+ else
43
+ ret = HPDF_Stream_WriteStr (stream, "false");
44
+
45
+ return ret;
46
+ }
47
+
@@ -0,0 +1,354 @@
1
+ /*
2
+ * << Haru Free PDF Library 2.0.5 >> -- hpdf_catalog.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
+ * 2006.08.07 modified.
14
+ * 2006.09.01 added ViewerPreference functions.
15
+ */
16
+
17
+ #include "hpdf_conf.h"
18
+ #include "hpdf_utils.h"
19
+ #include "hpdf_catalog.h"
20
+ #include "hpdf_pages.h"
21
+
22
+ static const char *HPDF_PAGE_LAYOUT_NAMES[] = {
23
+ "SinglePage",
24
+ "OneColumn",
25
+ "TwoColumnLeft",
26
+ "TwoColumnRight",
27
+ NULL
28
+ };
29
+
30
+
31
+ static const char *HPDF_PAGE_MODE_NAMES[] = {
32
+ "UseNone",
33
+ "UseOutlines",
34
+ "UseThumbs",
35
+ "FullScreen",
36
+ "UseOC",
37
+ "UseAttachments",
38
+ NULL
39
+ };
40
+
41
+
42
+ HPDF_Catalog
43
+ HPDF_Catalog_New (HPDF_MMgr mmgr,
44
+ HPDF_Xref xref)
45
+ {
46
+ HPDF_Catalog catalog;
47
+ HPDF_STATUS ret = 0;
48
+
49
+ catalog = HPDF_Dict_New (mmgr);
50
+ if (!catalog)
51
+ return NULL;
52
+
53
+ catalog->header.obj_class |= HPDF_OSUBCLASS_CATALOG;
54
+
55
+ if (HPDF_Xref_Add (xref, catalog) != HPDF_OK)
56
+ return NULL;
57
+
58
+ /* add requiered elements */
59
+ ret += HPDF_Dict_AddName (catalog, "Type", "Catalog");
60
+ ret += HPDF_Dict_Add (catalog, "Pages", HPDF_Pages_New (mmgr, NULL, xref));
61
+
62
+ if (ret != HPDF_OK)
63
+ return NULL;
64
+
65
+ return catalog;
66
+ }
67
+
68
+
69
+ HPDF_Pages
70
+ HPDF_Catalog_GetRoot (HPDF_Catalog catalog)
71
+ {
72
+ HPDF_Dict pages;
73
+
74
+ if (!catalog)
75
+ return NULL;
76
+
77
+ pages = HPDF_Dict_GetItem (catalog, "Pages", HPDF_OCLASS_DICT);
78
+ if (!pages || pages->header.obj_class != (HPDF_OSUBCLASS_PAGES |
79
+ HPDF_OCLASS_DICT))
80
+ HPDF_SetError (catalog->error, HPDF_PAGE_CANNOT_GET_ROOT_PAGES, 0);
81
+
82
+ return pages;
83
+ }
84
+
85
+
86
+ HPDF_PageLayout
87
+ HPDF_Catalog_GetPageLayout (HPDF_Catalog catalog)
88
+ {
89
+ HPDF_Name layout;
90
+ HPDF_UINT i = 0;
91
+
92
+ layout = (HPDF_Name)HPDF_Dict_GetItem (catalog, "PageLayout",
93
+ HPDF_OCLASS_NAME);
94
+ if (!layout)
95
+ return HPDF_PAGE_LAYOUT_EOF;
96
+
97
+ while (HPDF_PAGE_LAYOUT_NAMES[i]) {
98
+ if (HPDF_StrCmp (layout->value, HPDF_PAGE_LAYOUT_NAMES[i]) == 0)
99
+ return (HPDF_PageLayout)i;
100
+ i++;
101
+ }
102
+
103
+ return HPDF_PAGE_LAYOUT_EOF;
104
+ }
105
+
106
+
107
+ HPDF_STATUS
108
+ HPDF_Catalog_SetPageLayout (HPDF_Catalog catalog,
109
+ HPDF_PageLayout layout)
110
+ {
111
+ return HPDF_Dict_AddName (catalog, "PageLayout",
112
+ HPDF_PAGE_LAYOUT_NAMES[(HPDF_INT)layout]);
113
+ }
114
+
115
+
116
+
117
+
118
+ HPDF_PageMode
119
+ HPDF_Catalog_GetPageMode (HPDF_Catalog catalog)
120
+ {
121
+ HPDF_Name mode;
122
+ HPDF_UINT i = 0;
123
+
124
+ mode = (HPDF_Name)HPDF_Dict_GetItem (catalog, "PageMode", HPDF_OCLASS_NAME);
125
+ if (!mode)
126
+ return HPDF_PAGE_MODE_USE_NONE;
127
+
128
+ while (HPDF_PAGE_MODE_NAMES[i]) {
129
+ if (HPDF_StrCmp (mode->value, HPDF_PAGE_MODE_NAMES[i]) == 0)
130
+ return (HPDF_PageMode)i;
131
+ i++;
132
+ }
133
+
134
+ return HPDF_PAGE_MODE_USE_NONE;
135
+ }
136
+
137
+
138
+ HPDF_STATUS
139
+ HPDF_Catalog_SetPageMode (HPDF_Catalog catalog,
140
+ HPDF_PageMode mode)
141
+ {
142
+ return HPDF_Dict_AddName (catalog, "PageMode",
143
+ HPDF_PAGE_MODE_NAMES[(HPDF_INT)mode]);
144
+ }
145
+
146
+
147
+ HPDF_STATUS
148
+ HPDF_Catalog_SetOpenAction (HPDF_Catalog catalog,
149
+ HPDF_Destination open_action)
150
+ {
151
+ if (!open_action) {
152
+ HPDF_Dict_RemoveElement (catalog, "OpenAction");
153
+ return HPDF_OK;
154
+ }
155
+
156
+ return HPDF_Dict_Add (catalog, "OpenAction", open_action);
157
+ }
158
+
159
+
160
+ HPDF_BOOL
161
+ HPDF_Catalog_Validate (HPDF_Catalog catalog)
162
+ {
163
+ if (!catalog)
164
+ return HPDF_FALSE;
165
+
166
+ if (catalog->header.obj_class != (HPDF_OSUBCLASS_CATALOG |
167
+ HPDF_OCLASS_DICT)) {
168
+ HPDF_SetError (catalog->error, HPDF_INVALID_OBJECT, 0);
169
+ return HPDF_FALSE;
170
+ }
171
+
172
+ return HPDF_TRUE;
173
+ }
174
+
175
+
176
+ HPDF_STATUS
177
+ HPDF_Catalog_AddPageLabel (HPDF_Catalog catalog,
178
+ HPDF_UINT page_num,
179
+ HPDF_Dict page_label)
180
+ {
181
+ HPDF_STATUS ret;
182
+ HPDF_Array nums;
183
+ HPDF_Dict labels = HPDF_Dict_GetItem (catalog, "PageLabels",
184
+ HPDF_OCLASS_DICT);
185
+
186
+ HPDF_PTRACE ((" HPDF_Catalog_AddPageLabel\n"));
187
+
188
+ if (!labels) {
189
+ labels = HPDF_Dict_New (catalog->mmgr);
190
+
191
+ if (!labels)
192
+ return catalog->error->error_no;
193
+
194
+ if ((ret = HPDF_Dict_Add (catalog, "PageLabels", labels)) != HPDF_OK)
195
+ return ret;
196
+ }
197
+
198
+ nums = HPDF_Dict_GetItem (labels, "Nums", HPDF_OCLASS_ARRAY);
199
+
200
+ if (!nums) {
201
+ nums = HPDF_Array_New (catalog->mmgr);
202
+
203
+ if (!nums)
204
+ return catalog->error->error_no;
205
+
206
+ if ((ret = HPDF_Dict_Add (labels, "Nums", nums)) != HPDF_OK)
207
+ return ret;
208
+ }
209
+
210
+ if ((ret = HPDF_Array_AddNumber (nums, page_num)) != HPDF_OK)
211
+ return ret;
212
+
213
+ return HPDF_Array_Add (nums, page_label);
214
+ }
215
+
216
+ HPDF_STATUS
217
+ HPDF_Catalog_SetViewerPreference (HPDF_Catalog catalog,
218
+ HPDF_UINT value)
219
+ {
220
+ HPDF_STATUS ret;
221
+ HPDF_Dict preferences;
222
+
223
+ HPDF_PTRACE ((" HPDF_Catalog_SetViewerPreference\n"));
224
+
225
+ if (!value) {
226
+ ret = HPDF_Dict_RemoveElement (catalog, "ViewerPreferences");
227
+
228
+ if (ret == HPDF_DICT_ITEM_NOT_FOUND)
229
+ ret = HPDF_OK;
230
+
231
+ return ret;
232
+ }
233
+
234
+ preferences = HPDF_Dict_New (catalog->mmgr);
235
+ if (!preferences)
236
+ return catalog->error->error_no;
237
+
238
+ if ((ret = HPDF_Dict_Add (catalog, "ViewerPreferences", preferences))
239
+ != HPDF_OK)
240
+ return ret;
241
+
242
+ /* */
243
+
244
+ if (value & HPDF_HIDE_TOOLBAR) {
245
+ if ((ret = HPDF_Dict_AddBoolean (preferences, "HideToolbar",
246
+ HPDF_TRUE)) != HPDF_OK)
247
+ return ret;
248
+ } else {
249
+ if ((ret = HPDF_Dict_RemoveElement (preferences, "HideToolbar")) !=
250
+ HPDF_OK)
251
+ if (ret != HPDF_DICT_ITEM_NOT_FOUND)
252
+ return ret;
253
+ }
254
+
255
+ if (value & HPDF_HIDE_MENUBAR) {
256
+ if ((ret = HPDF_Dict_AddBoolean (preferences, "HideMenubar",
257
+ HPDF_TRUE)) != HPDF_OK)
258
+ return ret;
259
+ } else {
260
+ if ((ret = HPDF_Dict_RemoveElement (preferences, "HideMenubar")) !=
261
+ HPDF_OK)
262
+ if (ret != HPDF_DICT_ITEM_NOT_FOUND)
263
+ return ret;
264
+ }
265
+
266
+ if (value & HPDF_HIDE_WINDOW_UI) {
267
+ if ((ret = HPDF_Dict_AddBoolean (preferences, "HideWindowUI",
268
+ HPDF_TRUE)) != HPDF_OK)
269
+ return ret;
270
+ } else {
271
+ if ((ret = HPDF_Dict_RemoveElement (preferences, "HideWindowUI")) !=
272
+ HPDF_OK)
273
+ if (ret != HPDF_DICT_ITEM_NOT_FOUND)
274
+ return ret;
275
+ }
276
+
277
+ if (value & HPDF_FIT_WINDOW) {
278
+ if ((ret = HPDF_Dict_AddBoolean (preferences, "FitWindow",
279
+ HPDF_TRUE)) != HPDF_OK)
280
+ return ret;
281
+ } else {
282
+ if ((ret = HPDF_Dict_RemoveElement (preferences, "FitWindow")) !=
283
+ HPDF_OK)
284
+ if (ret != HPDF_DICT_ITEM_NOT_FOUND)
285
+ return ret;
286
+ }
287
+
288
+ if (value & HPDF_CENTER_WINDOW) {
289
+ if ((ret = HPDF_Dict_AddBoolean (preferences, "CenterWindow",
290
+ HPDF_TRUE)) != HPDF_OK)
291
+ return ret;
292
+ } else {
293
+ if ((ret = HPDF_Dict_RemoveElement (preferences, "CenterWindow")) !=
294
+ HPDF_OK)
295
+ if (ret != HPDF_DICT_ITEM_NOT_FOUND)
296
+ return ret;
297
+ }
298
+
299
+ return HPDF_OK;
300
+ }
301
+
302
+ HPDF_UINT
303
+ HPDF_Catalog_GetViewerPreference (HPDF_Catalog catalog)
304
+ {
305
+ HPDF_Dict preferences;
306
+ HPDF_UINT value = 0;
307
+ HPDF_Boolean obj;
308
+
309
+ HPDF_PTRACE ((" HPDF_Catalog_GetViewerPreference\n"));
310
+
311
+ preferences = (HPDF_Dict)HPDF_Dict_GetItem (catalog, "ViewerPreferences",
312
+ HPDF_OCLASS_DICT);
313
+
314
+ if (!preferences)
315
+ return 0;
316
+
317
+ obj = (HPDF_Boolean)HPDF_Dict_GetItem (preferences, "HideToolbar",
318
+ HPDF_OCLASS_BOOLEAN);
319
+ if (obj) {
320
+ if (obj->value)
321
+ value += HPDF_HIDE_TOOLBAR;
322
+ }
323
+
324
+ obj = (HPDF_Boolean)HPDF_Dict_GetItem (preferences, "HideMenubar",
325
+ HPDF_OCLASS_BOOLEAN);
326
+ if (obj) {
327
+ if (obj->value)
328
+ value += HPDF_HIDE_MENUBAR;
329
+ }
330
+
331
+ obj = (HPDF_Boolean)HPDF_Dict_GetItem (preferences, "HideWindowUI",
332
+ HPDF_OCLASS_BOOLEAN);
333
+ if (obj) {
334
+ if (obj->value)
335
+ value += HPDF_HIDE_WINDOW_UI;
336
+ }
337
+
338
+ obj = (HPDF_Boolean)HPDF_Dict_GetItem (preferences, "FitWindow",
339
+ HPDF_OCLASS_BOOLEAN);
340
+ if (obj) {
341
+ if (obj->value)
342
+ value += HPDF_FIT_WINDOW;
343
+ }
344
+
345
+ obj = (HPDF_Boolean)HPDF_Dict_GetItem (preferences, "CenterWindow",
346
+ HPDF_OCLASS_BOOLEAN);
347
+ if (obj) {
348
+ if (obj->value)
349
+ value += HPDF_CENTER_WINDOW;
350
+ }
351
+
352
+ return value;
353
+ }
354
+