1 /* Copyright (C) 2001-2012 Artifex Software, Inc.
2    All Rights Reserved.
3 
4    This software is provided AS-IS with no warranty, either express or
5    implied.
6 
7    This software is distributed under license and may not be copied,
8    modified or distributed except as expressly authorized under the terms
9    of the license contained in the file LICENSE in this distribution.
10 
11    Refer to licensing information at http://www.artifex.com or contact
12    Artifex Software, Inc.,  7 Mt. Lassen Drive - Suite A-134, San Rafael,
13    CA  94903, U.S.A., +1(415)492-9861, for further information.
14 */
15 
16 
17 /* pdfwrite, ps2write device body template. */
18 
19 /* This file is allowed to #include several times into a single .c file.
20    The following macros to be defined in advance :
21    PDF_DEVICE_NAME - a string like "pdfwrite".
22    PDF_DEVICE_IDENT - an identifier like gs_pdfwrite_device.
23    PDF_DEVICE_MaxInlineImageSize - a value of PDF_DEVICE_MaxInlineImageSize.
24    PDF_FOR_OPDFREAD - an integer 0 (false) or 1 (true).
25  */
26 
27 const gx_device_pdf PDF_DEVICE_IDENT =
28 {std_device_dci_type_body(gx_device_pdf, 0, PDF_DEVICE_NAME,
29                           &st_device_pdfwrite,
30                           DEFAULT_WIDTH_10THS * X_DPI / 10,
31                           DEFAULT_HEIGHT_10THS * Y_DPI / 10,
32                           X_DPI, Y_DPI,
33                           3, 24, 255, 255, 256, 256),
34  {pdf_open,
35   gx_upright_get_initial_matrix,
36   NULL,				/* sync_output */
37   pdf_output_page,
38   pdf_close,
39   gx_default_rgb_map_rgb_color,
40   gx_default_rgb_map_color_rgb,
41   gdev_pdf_fill_rectangle,
42   NULL,				/* tile_rectangle */
43   gdev_pdf_copy_mono,
44   gdev_pdf_copy_color,
45   NULL,				/* draw_line */
46   psdf_get_bits,		/* get_bits */
47   gdev_pdf_get_params,
48   gdev_pdf_put_params,
49   NULL,				/* map_cmyk_color */
50   NULL,				/* get_xfont_procs */
51   NULL,				/* get_xfont_device */
52   NULL,				/* map_rgb_alpha_color */
53   gx_page_device_get_page_device,
54   NULL,				/* get_alpha_bits */
55   NULL,				/* copy_alpha */
56   NULL,				/* get_band */
57   NULL,				/* copy_rop */
58   gdev_pdf_fill_path,
59   gdev_pdf_stroke_path,
60   gdev_pdf_fill_mask,
61   NULL,				/* fill_trapezoid */
62   NULL,				/* fill_parallelogram */
63   NULL,				/* fill_triangle */
64   NULL,				/* draw_thin_line */
65   NULL,				/* begin_image */
66   NULL,				/* image_data */
67   NULL,				/* end_image */
68   gdev_pdf_strip_tile_rectangle,
69   NULL,				/* strip_copy_rop */
70   NULL,				/* get_clipping_box */
71   gdev_pdf_begin_typed_image,
72   psdf_get_bits_rectangle,	/* get_bits_rectangle */
73   NULL,				/* map_color_rgb_alpha */
74   gdev_pdf_create_compositor,	/* create_compositor */
75   NULL,				/* get_hardware_params */
76   gdev_pdf_text_begin,
77   NULL,				/* finish_copydevice */
78   gdev_pdf_begin_transparency_group,	/* begin_transparency_group */
79   gdev_pdf_end_transparency_group,	/* end_transparency_group */
80   gdev_pdf_begin_transparency_mask,	/* begin_transparency_mask */
81   gdev_pdf_end_transparency_mask,	/* end_transparency_mask */
82   gdev_pdf_discard_transparency_layer,	/* discard_transparency_layer */
83   NULL,				/* get_color_mapping_procs */
84   NULL,				/* get_color_comp_index */
85   NULL,				/* encode_color */
86   NULL,				/* decode_color */
87   NULL, 			/* pattern_manage */
88   gdev_pdf_fill_rectangle_hl_color, 	/* fill_rectangle_hl_color */
89   gdev_pdf_include_color_space, 	/* include_color_space */
90   NULL,				/* fill_linear_color_scanline */
91   NULL,				/* fill_linear_color_trapezoid */
92   NULL,				/* fill_linear_color_triangle */
93   NULL,				/* update_spot_equivalent_colors */
94   NULL,				/* ret_devn_params */
95   gdev_pdf_fillpage,		/* fillpage */
96   NULL,				/* push_transparency_state */
97   NULL,				/* pop_transparency_state */
98   NULL,				/* put_image */
99   gdev_pdf_dev_spec_op		/* dev_spec_op */
100  },
101  psdf_initial_values(PSDF_VERSION_INITIAL, 0 /*false */ ),  /* (!ASCII85EncodePages) */
102  PDF_FOR_OPDFREAD,		/* is_ps2write */
103  PDF_COMPATIBILITY_LEVEL_INITIAL,  /* CompatibilityLevel */
104  -1,				/* EndPage */
105  1,				/* StartPage */
106  1 /*true*/,			/* Optimize */
107  0 /*false*/,			/* ParseDSCCommentsForDocInfo */
108  1 /*true*/,			/* ParseDSCComments */
109  0 /*false*/,			/* EmitDSCWarnings */
110  0 /*false*/,			/* CreateJobTicket */
111  0 /*false*/,			/* PreserveEPSInfo */
112  1 /*true*/,			/* AutoPositionEPSFiles */
113  1 /*true*/,			/* PreserveCopyPage */
114  0 /*false*/,			/* UsePrologue */
115  0,				/* OffOptimizations */
116  {0,0},				/* PDFXTrimBoxToMediaBoxOffset */
117  {0,0},				/* PDFXBleedBoxToTrimBoxOffset */
118  1 /* true */,			/* PDFXSetBleedBoxToMediaBox */
119  1 /*true*/,			/* ReAssignCharacters */
120  1 /*true*/,			/* ReEncodeCharacters */
121  1,				/* FirstObjectNumber */
122  1 /*true*/,			/* CompressFonts */
123  0 /*false*/,			/* PrintStatistics */
124  {0, 0, 0},			/* DocumentUUID */
125  {0, 0, 0},			/* InstanceUUID */
126  0,				/* DocumentTimeSeq */
127  PDF_FOR_OPDFREAD,		/* ForOPDFRead */
128  false,				/* CompressEntireFile */
129  0 /*false*/,			/* ResourcesBeforeUsage */
130  1 /*true*/,			/* HavePDFWidths */
131  0 /*false*/,			/* HaveStrokeColor */
132  1 /*true*/,			/* ProduceDSC */
133  1 /*true*/,			/* HaveTransparency */
134  0 /*false*/,			/* PatternImagemask */
135  0 /*false*/,			/* PDFX */
136  0 /*false*/,			/* PDFA */
137  0 /*false*/,			/* Abort generation of PDFA or X, produce PDF */
138  12000,				/* MaxClipPathSize */ /* HP LaserJet 1320 hangs with 14000. */
139 #ifdef DEPRECATED_906
140  max_long,                      /* MaxViewerMemorySize */
141 #endif
142  256000,			/* MaxShadingBitmapSize */
143  PDF_DEVICE_MaxInlineImageSize,	/* MaxInlineImageSize */
144  {0, 0},                        /* DSCEncodingToUnicode */
145  {0, 0, 0},			/* OwnerPassword */
146  {0, 0, 0},			/* UserPassword */
147  0,				/* KeyLength */
148  -4,				/* Permissions */
149  0,				/* EncryptionR */
150  {0, 0, 0},			/* NoEncrypt */
151  true,				/* EncryptMetadata */
152  true,                          /* ComputeDocumentDigest */
153  {0},				/* EncryptionO */
154  {0},				/* EncryptionU */
155  {0},				/* EncryptionKey */
156  0,				/* EncryptionV */
157  0 /*false*/,			/* is_EPS */
158  {-1, -1},			/* doc_dsc_info */
159  {-1, -1},			/* page_dsc_info */
160  0 /*false*/,			/* fill_overprint */
161  0 /*false*/,			/* stroke_overprint */
162  0 /*false*/,                   /* remap_fill_coilor */
163  0 /*false*/,                   /* remap_stroke_coilor */
164  0,				/* overprint_mode */
165  gs_no_id,			/* halftone_id */
166  {gs_no_id, gs_no_id, gs_no_id, gs_no_id}, /* transfer_ids */
167  0,				/* transfer_not_identity */
168  gs_no_id,			/* black_generation_id */
169  gs_no_id,			/* undercolor_removal_id */
170  pdf_compress_none,		/* compression */
171  pdf_compress_none,		/* compression_at_page_start */
172  {{0}},				/* xref */
173  {{0}},				/* asides */
174  {{0}},				/* streams */
175  {{0}},				/* pictures */
176  0,				/* next_id */
177  0,				/* Catalog */
178  0,				/* Info */
179  0,				/* Pages */
180  0,				/* outlines_id */
181  0,				/* next_page */
182  -1,				/* max_referred_page */
183  0,				/* contents_id */
184  PDF_IN_NONE,			/* context */
185  0,				/* contents_length_id */
186  0,				/* contents_pos */
187  NoMarks,			/* procsets */
188  0,				/* text */
189  {{0}},				/* text_rotation */
190  0,				/* pages */
191  0,				/* num_pages */
192  1,				/* used_mask */
193  {
194      {
195          {0}}},			/* resources */
196  {0},				/* cs_Patterns */
197  {0},				/* Identity_ToUnicode_CMaps */
198  0,				/* last_resource */
199  0,				/* OneByteIdentityH */
200  gs_no_id,			/* IdentityCIDSystemInfo_id */
201  {
202      {
203          {0}}},			/* outline_levels */
204  0,				/* outline_depth */
205  0,				/* closed_outline_depth */
206  0,				/* outlines_open */
207  0,				/* articles */
208  0,				/* Dests */
209  {0},				/* fileID */
210          {0, 0},		/* uuid_time */
211  0,				/* global_named_objects */
212  0,				/* local_named_objects */
213  0,				/* NI_stack */
214  0,				/* Namespace_stack */
215  0,				/* font_cache */
216  {0, 0},			/* char_width */
217  0,				/* clip_path */
218  0,                             /* PageLabels */
219  -1,                            /* PageLabels_current_page */
220  0,                             /* PageLabels_current_label */
221  0,				/* */
222  {				/* vgstack[2] */
223     {0}, {0}
224  },
225  0,				/* vgstack_depth */
226  0,				/* vgstack_bottom */
227  {0},				/* vg_initial */
228  false,				/* vg_initial_set */
229  0,				/* sbstack_size */
230  0,				/* sbstack_depth */
231  0,				/* sbstack */
232  0,				/* FormDepth */
233  0,				/* PatternDepth */
234  {0,0,0,0,0,0},                 /* AccumulatedPatternMatrix */
235  0,				/* substream_Resources */
236  1,				/* pcm_color_info_index == DeviceRGB */
237  false,				/* skip_colors */
238  false,				/* AR4_save_bug */
239  0,				/* font3 */
240  0,				/* accumulating_substream_resource */
241  {0,0,0,0,0,0,0,0,0},		/* charproc_ctm */
242  0,				/* charproc_just_accumulated */
243  1,             /* PS_accumulator */
244  0,				/* accumulating_a_global_object */
245  0,				/* cgp */
246  0,				/* substituted_pattern_count */
247  0,				/* substituted_pattern_drop_page */
248  0,				/* image_mask_id */
249  0,				/* image_mask_is_SMask */
250  0,				/* image_mask_skip */
251  0,				/* image_with_SMask */
252  {0,0,0,0,0,0}, 		/* gs_matrix converting_image_matrix */
253  0,				/* image_mask_scale */
254  NULL,				/* pres_soft_mask_dict */
255  {0, 0},			/* objname */
256  0,				/* OPDFRead_procset_length */
257  0,				/* find_resource_param */
258  0,				/* last_charpath_op */
259  0,				/* type3charpath */
260  0,				/* SetPageSize */
261  0,				/* RotatePages */
262  0,				/* Fit Pages */
263  0,				/* CenterPages */
264  0,				/* DoNumCopies */
265  true,				/* PreserveSeparation */
266  true,				/* PreserveDeviceN */
267  0,				/* PDFACompatibilityPolicy */
268  true,				/* DetectDuplicateImages */
269  false,				/* AllowIncrementalCFF */
270  !PDF_FOR_OPDFREAD,		/* WantsToUnicode */
271  PDF_FOR_OPDFREAD,		/* AllowPSRepeatFunctions */
272  true,				/* IsDistiller (true even for ps2write!) */
273  !PDF_FOR_OPDFREAD,		/* PreserveSMask */
274  !PDF_FOR_OPDFREAD,		/* PreserveTrMode */
275  false                          /* NoT3CCITT */
276 };
277