void pdf_write_outlines(PDF *p) { int i; if (p->outline_count == 0) /* no outlines: return */ return; pdc_begin_obj(p->out, p->outlines[0].obj_id); /* root outline object */ pdc_begin_dict(p->out); if (p->outlines[0].count != 0) pdc_printf(p->out, "/Count %d\n", COUNT(0)); pdc_objref(p->out, "/First", OBJ_ID(FIRST(0))); pdc_objref(p->out, "/Last", OBJ_ID(LAST(0))); pdc_end_dict(p->out); pdc_end_obj(p->out); /* root outline object */ #define PDF_FLUSH_AFTER_MANY_OUTLINES 1000 /* ca. 50-100 KB */ for (i = 1; i <= p->outline_count; i++) { /* reduce memory usage for many outline entries */ if (i % PDF_FLUSH_AFTER_MANY_OUTLINES == 0) pdc_flush_stream(p->out); pdf_write_outline_dict(p, i); } }
int pdf__shading_pattern(PDF *p, int shading, const char *optlist) { pdc_resopt *results; pdc_clientdata data; int gstate = -1; int retval = -1; if (p->compatibility == PDC_1_3) pdc_error(p->pdc, PDF_E_SHADING13, 0, 0, 0, 0); pdf_check_handle(p, shading, pdc_shadinghandle); if (optlist && strlen(optlist)) { pdf_set_clientdata(p, &data); results = pdc_parse_optionlist(p->pdc, optlist, pdf_shading_pattern_options, &data, pdc_true); (void) pdc_get_optvalues("gstate", results, &gstate, NULL); pdc_cleanup_optionlist(p->pdc, results); } if (p->pattern_number == p->pattern_capacity) pdf_grow_pattern(p); if (PDF_GET_STATE(p) == pdf_state_page) pdf_end_contents_section(p); /* Pattern object */ p->pattern[p->pattern_number].obj_id = pdc_begin_obj(p->out, PDC_NEW_ID); /* Shadings don't have a painttype, but this signals to the * code which writes the pattern usage that no color values * will be required when setting the pattern color space. */ p->pattern[p->pattern_number].painttype = 1; pdc_begin_dict(p->out); /* Pattern dict*/ pdc_puts(p->out, "/PatternType 2\n"); /* shading pattern */ pdc_objref(p->out, "/Shading", p->shadings[shading].obj_id); p->shadings[shading].used_on_current_page = pdc_true; if (gstate != -1) pdc_objref(p->out, "/ExtGState", pdf_get_gstate_id(p, gstate)); pdc_end_dict(p->out); /* Pattern dict*/ pdc_end_obj(p->out); /* Pattern object */ if (PDF_GET_STATE(p) == pdf_state_page) pdf_begin_contents_section(p); retval = p->pattern_number; p->pattern_number++; return retval; }
void pdf_write_page_shadings(PDF *p) { int i, total = 0; for (i = 0; i < p->shadings_number; i++) if (p->shadings[i].used_on_current_page) total++; if (total > 0) { pdc_puts(p->out, "/Shading"); pdc_begin_dict(p->out); } if (total > 0) { for (i = 0; i < p->shadings_number; i++) { if (p->shadings[i].used_on_current_page) { p->shadings[i].used_on_current_page = pdc_false; /* reset */ pdc_printf(p->out, "/Sh%d", i); pdc_objref(p->out, "", p->shadings[i].obj_id); } } pdc_end_dict(p->out); } }
void pdf_write_page_extgstates(PDF *p) { int i, total = 0; int bias = p->curr_ppt->eg_bias; for (i = 0; i < p->extgstates_number; i++) if (p->extgstates[i].used_on_current_page) total++; if (total > 0 || bias) { pdc_puts(p->out, "/ExtGState"); pdc_begin_dict(p->out); } if (total > 0) { for (i = 0; i < p->extgstates_number; i++) { if (p->extgstates[i].used_on_current_page) { p->extgstates[i].used_on_current_page = pdc_false; /* reset */ pdc_printf(p->out, "/GS%d", bias + i); pdc_objref(p->out, "", p->extgstates[i].obj_id); } } if (!bias) pdc_end_dict(p->out); } }
void pdf_write_colormap(PDF *p, int slot) { PDF_data_source src; pdf_colorspace *cs, *base; pdc_id length_id; cs = &p->colorspaces[slot]; if (cs->type != Indexed || cs->val.indexed.colormap_done == pdc_true) return; base = &p->colorspaces[cs->val.indexed.base]; pdc_begin_obj(p->out, cs->val.indexed.colormap_id); /* colormap object */ pdc_begin_dict(p->out); if (pdc_get_compresslevel(p->out)) pdc_puts(p->out, "/Filter/FlateDecode\n"); /* Length of colormap object */ length_id = pdc_alloc_id(p->out); pdc_objref(p->out, "/Length", length_id); pdc_end_dict(p->out); src.init = NULL; src.fill = pdf_data_source_buf_fill; src.terminate = NULL; src.buffer_start = (unsigned char *) cs->val.indexed.colormap; src.buffer_length = (size_t) (cs->val.indexed.palette_size * pdf_color_components(p, cs->val.indexed.base)); src.bytes_available = 0; src.next_byte = NULL; /* Write colormap data */ pdf_copy_stream(p, &src, pdc_true); /* colormap data */ pdc_end_obj(p->out); /* colormap object */ pdc_put_pdfstreamlength(p->out, length_id); /* free the colormap now that it's written */ pdc_free(p->pdc, cs->val.indexed.colormap); cs->val.indexed.colormap = NULL; cs->val.indexed.colormap_done = pdc_true; } /* pdf_write_colormap */
void pdf_write_page_colorspaces(PDF *p) { int i, total = 0; for (i = 0; i < p->colorspaces_number; i++) if (p->colorspaces[i].used_on_current_page) total++; if (total > 0 ) { pdc_puts(p->out, "/ColorSpace"); pdc_begin_dict(p->out); if (total > 0) { for (i = 0; i < p->colorspaces_number; i++) { pdf_colorspace *cs = &p->colorspaces[i]; if (cs->used_on_current_page) { cs->used_on_current_page = pdc_false; /* reset */ /* don't write simple color spaces as resource */ if (!PDF_SIMPLE_COLORSPACE(cs)) { pdc_printf(p->out, "/C%d", i); pdc_objref(p->out, "", cs->obj_id); } } } } pdc_end_dict(p->out); /* color space names */ } } /* pdf_write_page_colorspaces */
static pdc_id pdf_write_action(PDF *p, pdf_action *action, pdc_id next_id) { pdc_id ret_id = PDC_BAD_ID; int i, flags = 0; ret_id = pdc_begin_obj(p->out, PDC_NEW_ID); /* Action object */ pdc_begin_dict(p->out); /* Action dict */ pdc_puts(p->out, "/Type/Action\n"); pdc_printf(p->out, "/S/%s\n", pdc_get_keyword(action->atype, pdf_action_pdfkeylist)); /* next action */ if (next_id != PDC_BAD_ID) pdc_objref(p->out, "/Next", next_id); else action->obj_id = ret_id; /* destination */ switch (action->atype) { case pdf_goto: case pdf_gotor: pdc_puts(p->out, "/D"); pdf_write_destination(p, action->dest); default: break; } /* file specification */ switch (action->atype) { case pdf_gotor: case pdf_launch: if (action->newwindow != pdc_undef) pdc_printf(p->out, "/NewWindow %s\n", PDC_BOOLSTR(action->newwindow)); case pdf_importdata: if (action->parameters || action->operation || action->defaultdir) { /* Windows-specific launch parameters */ pdc_puts(p->out, "/Win"); pdc_begin_dict(p->out); /* Win dict */ pdc_puts(p->out, "/F"); pdf_put_pdffilename(p, action->nativefilename); pdc_puts(p->out, "\n"); if (p->compatibility >= PDC_1_7) { pdc_puts(p->out, "/UF"); pdf_put_pdfunifilename(p, action->filename); pdc_puts(p->out, "\n"); } if (action->parameters) { pdc_puts(p->out, "/P"); pdf_put_hypertext(p, action->parameters); pdc_puts(p->out, "\n"); pdc_free(p->pdc, action->parameters); action->parameters = NULL; } if (action->operation) { pdc_puts(p->out, "/O"); pdf_put_hypertext(p, action->operation); pdc_puts(p->out, "\n"); action->operation = NULL; } if (action->defaultdir) { pdc_puts(p->out, "/D"); pdf_put_hypertext(p, action->defaultdir); pdc_puts(p->out, "\n"); pdc_free(p->pdc, action->defaultdir); action->defaultdir = NULL; } pdc_end_dict(p->out); /* Win dict */ } else { pdc_puts(p->out, "/F"); pdc_begin_dict(p->out); /* F dict */ pdc_puts(p->out, "/Type/Filespec\n"); pdc_puts(p->out, "/F"); pdf_put_pdffilename(p, action->nativefilename); pdc_puts(p->out, "\n"); if (p->compatibility >= PDC_1_7) { pdc_puts(p->out, "/UF"); pdf_put_pdfunifilename(p, action->filename); pdc_puts(p->out, "\n"); } pdc_end_dict(p->out); /* F dict */ } default: break; } /* URI */ switch (action->atype) { case pdf_uri: pdc_puts(p->out, "/URI"); pdf_put_hypertext(p, action->filename); pdc_puts(p->out, "\n"); /* IsMap */ if (action->ismap == pdc_true) pdc_puts(p->out, "/IsMap true\n"); default: break; } /* Named */ switch (action->atype) { case pdf_named: pdc_puts(p->out, "/N"); pdf_put_pdfname(p, action->menuname); pdc_puts(p->out, "\n"); default: break; } /* name list */ switch (action->atype) { case pdf_hide: if (action->hide == pdc_false) pdc_puts(p->out, "/H false\n"); case pdf_submitform: case pdf_resetform: if (action->nsnames) { pdc_printf(p->out, "/%s", (action->atype == pdf_hide) ? "T" : "Fields"); pdc_begin_array(p->out); for (i = 0; i < action->nsnames; i++) { pdf_put_hypertext(p, action->namelist[i]); if (i < action->nsnames - 1) pdc_puts(p->out, "\n"); else pdc_end_array(p->out); } } default: break; } /* URL */ switch (action->atype) { case pdf_submitform: pdc_puts(p->out, "/F"); pdc_begin_dict(p->out); /* F dict */ pdc_puts(p->out, "/FS/URL\n"); pdc_printf(p->out, "/F"); pdf_put_hypertext(p, action->filename); pdc_puts(p->out, "\n"); pdc_end_dict(p->out); /* F dict */ default: break; } /* Trans */ switch (action->atype) { case pdf_trans: pdc_puts(p->out, "/Trans"); pdc_begin_dict(p->out); /* Trans dict */ pdc_puts(p->out, "/Type/Trans\n"); if (action->transition != trans_replace) pdc_printf(p->out, "/S/%s", pdc_get_keyword(action->transition, pdf_transition_pdfkeylist)); if (action->duration > 0) pdc_printf(p->out, "/D %f\n", action->duration); pdc_end_dict(p->out); /* Trans dict */ default: break; } /* Flags */ switch (action->atype) { case pdf_submitform: flags = (int) action->exportmethod; if (action->submitemptyfields) flags |= (1<<1); if (action->canonicaldate) flags |= (1<<9); case pdf_resetform: if (action->exclude) flags |= (1<<0); if (flags) pdc_printf(p->out, "/Flags %d\n", flags); default: break; } /* Movie */ pdc_end_dict(p->out); /* Action dict */ pdc_end_obj(p->out); /* Action object */ return ret_id; }
void pdf_write_outline_root(PDF *p) { if (p->outline_count != 0) pdc_objref(p->out, "/Outlines", p->outlines[0].obj_id); }
static void pdf_write_outline_dict(PDF *p, int entry) { pdf_outline *outline = &p->outlines[entry]; pdc_id act_idlist[PDF_MAX_EVENTS]; /* write action objects */ if (outline->action) pdf_parse_and_write_actionlist(p, event_bookmark, act_idlist, (const char *) outline->action); pdc_begin_obj(p->out, OBJ_ID(entry)); /* outline object */ pdc_begin_dict(p->out); pdc_objref(p->out, "/Parent", OBJ_ID(PARENT(entry))); /* outline destination */ if (outline->dest) { pdc_puts(p->out, "/Dest"); pdf_write_destination(p, outline->dest); } /* write Action entries */ else if (outline->action) pdf_write_action_entries(p, event_bookmark, act_idlist); pdc_puts(p->out, "/Title"); /* outline text */ pdf_put_hypertext(p, outline->text); pdc_puts(p->out, "\n"); if (PREV(entry)) pdc_objref(p->out, "/Prev", OBJ_ID(PREV(entry))); if (NEXT(entry)) pdc_objref(p->out, "/Next", OBJ_ID(NEXT(entry))); if (FIRST(entry)) { pdc_objref(p->out, "/First", OBJ_ID(FIRST(entry))); pdc_objref(p->out, "/Last", OBJ_ID(LAST(entry))); } if (COUNT(entry)) { if (OPEN(entry)) pdc_printf(p->out, "/Count %d\n", COUNT(entry)); /* open */ else pdc_printf(p->out, "/Count %d\n", -COUNT(entry));/* closed */ } /* Color */ if (outline->textcolor[0] != 0.0 || outline->textcolor[1] != 0.0 || outline->textcolor[2] != 0.0) pdc_printf(p->out, "/C[%f %f %f]\n", outline->textcolor[0], outline->textcolor[1], outline->textcolor[2]); /* FontStyle */ if (outline->fontstyle != fnt_Normal) { int fontstyle = 0; if (outline->fontstyle == fnt_Bold) fontstyle = 2; if (outline->fontstyle == fnt_Italic) fontstyle = 1; if (outline->fontstyle == fnt_BoldItalic) fontstyle = 3; pdc_printf(p->out, "/F %d\n", fontstyle); } pdc_end_dict(p->out); pdc_end_obj(p->out); /* outline object */ }
/* Start a new pattern definition. */ int pdf__begin_pattern( PDF *p, pdc_scalar width, pdc_scalar height, pdc_scalar xstep, pdc_scalar ystep, int painttype) { int slot = -1; pdc_check_number_limits(p->pdc, "width", width, PDC_FLOAT_PREC, PDC_FLOAT_MAX); pdc_check_number_limits(p->pdc, "height", height, PDC_FLOAT_PREC, PDC_FLOAT_MAX); pdc_check_number_zero(p->pdc, "xstep", xstep); pdc_check_number_zero(p->pdc, "ystep", ystep); if (painttype != 1 && painttype != 2) pdc_error(p->pdc, PDC_E_ILLARG_INT, "painttype", pdc_errprintf(p->pdc, "%d", painttype), 0, 0); if (p->pattern_number == p->pattern_capacity) pdf_grow_pattern(p); pdf_pg_suspend(p); PDF_SET_STATE(p, pdf_state_pattern); p->pattern[p->pattern_number].obj_id = pdc_begin_obj(p->out, PDC_NEW_ID); p->pattern[p->pattern_number].painttype = painttype; pdc_begin_dict(p->out); /* pattern dict*/ p->res_id = pdc_alloc_id(p->out); pdc_puts(p->out, "/PatternType 1\n"); /* tiling pattern */ /* colored or uncolored pattern */ pdc_printf(p->out, "/PaintType %d\n", painttype); pdc_puts(p->out, "/TilingType 1\n"); /* constant spacing */ pdc_printf(p->out, "/BBox[0 0 %f %f]\n", width, height); pdc_printf(p->out, "/XStep %f\n", xstep); pdc_printf(p->out, "/YStep %f\n", ystep); pdc_objref(p->out, "/Resources", p->res_id); p->length_id = pdc_alloc_id(p->out); pdc_objref(p->out, "/Length", p->length_id); if (pdc_get_compresslevel(p->out)) pdc_puts(p->out, "/Filter/FlateDecode\n"); pdc_end_dict(p->out); /* pattern dict*/ pdc_begin_pdfstream(p->out); slot = p->pattern_number; p->pattern_number++; /* top-down y-coordinates */ pdf_set_topdownsystem(p, height); /* set color differing from PDF default */ pdf_set_default_color(p, pdc_false); if (!p->pdc->smokerun) pdc_logg_cond(p->pdc, 1, trc_api, "[Begin pattern %d]\n", slot); return slot; }
void pdf__begin_glyph( PDF *p, const char *glyphname, pdc_scalar wx, pdc_scalar llx, pdc_scalar lly, pdc_scalar urx, pdc_scalar ury) { static const char fn[] = "pdf__begin_glyph"; pdf_font *font; pdf_t3font *t3font; pdf_t3glyph *glyph = NULL; pdc_scalar tbc; int ig; if (glyphname == NULL || *glyphname == '\0') pdc_error(p->pdc, PDC_E_ILLARG_EMPTY, "glyphname", 0, 0, 0); font = &p->fonts[p->t3slot]; t3font = font->t3font; /* error message prefix */ pdc_push_errmsg(p->pdc, PDF_E_T3_FONT_PREFIX, font->apiname, 0, 0, 0); for (ig = 0; ig < t3font->next_glyph; ig++) { glyph = &t3font->glyphs[ig]; if (!pdc_strcmp(glyph->name, glyphname)) { if (t3font->pass == glyph->pass) pdc_error(p->pdc, PDF_E_T3_GLYPH, glyphname, 0, 0, 0); else break; } } /* new glyph */ if (ig == t3font->next_glyph) { if (t3font->pass == 2) pdc_error(p->pdc, PDF_E_T3_UNKOWNGLYPH, glyphname, 0, 0, 0); pdc_check_number(p->pdc, "wx", wx); pdc_check_number(p->pdc, "llx", llx); pdc_check_number(p->pdc, "lly", lly); pdc_check_number(p->pdc, "urx", urx); pdc_check_number(p->pdc, "ury", ury); if (t3font->colorized == pdc_true && (llx != 0 || lly != 0 || urx != 0 || ury != 0)) pdc_error(p->pdc, PDF_E_T3_BADBBOX, 0, 0, 0, 0); if (urx < llx) { tbc = llx; llx = urx; urx = tbc; } if (ury < lly) { tbc = lly; lly = ury; ury = tbc; } if (ig == t3font->capacity) { t3font->capacity *= 2; t3font->glyphs = (pdf_t3glyph *) pdc_realloc(p->pdc, t3font->glyphs, t3font->capacity * sizeof (pdf_t3glyph), fn); } glyph = &t3font->glyphs[ig]; glyph->charproc_id = PDC_BAD_ID; glyph->name = pdc_strdup(p->pdc, glyphname); glyph->wx = wx; glyph->llx = llx; glyph->lly = lly; glyph->urx = urx; glyph->ury = ury; /* see comment in p_font.c for explanation */ glyph->width = 1000 * wx * font->ft.matrix.a; /* if the strdup above fails, cleanup won't touch this slot. */ t3font->next_glyph++; } glyph->pass = t3font->pass; t3font->curr_glyph = ig; pdc_logg_cond(p->pdc, 1, trc_font, "\tBegin of Type3 font glyph \"%s\"\n", glyphname); if (t3font->pass != 1) { if (t3font->pass == 2) pdc_logg_cond(p->pdc, 2, trc_font, "\t\tglyph [%d] was used in text\n", ig); glyph->charproc_id = pdc_begin_obj(p->out, PDC_NEW_ID); pdc_begin_dict(p->out); p->length_id = pdc_alloc_id(p->out); pdc_objref(p->out, "/Length", p->length_id); if (pdc_get_compresslevel(p->out)) pdc_puts(p->out, "/Filter/FlateDecode\n"); pdc_end_dict(p->out); pdc_begin_pdfstream(p->out); if (t3font->colorized == pdc_true) pdc_printf(p->out, "%f 0 d0\n", glyph->wx); else { pdc_printf(p->out, "%f 0 %f %f %f %f d1\n", glyph->wx, glyph->llx, glyph->lly, glyph->urx, glyph->ury); /* adjust the font's bounding box */ if (glyph->llx < font->ft.bbox.llx) font->ft.bbox.llx = glyph->llx; if (glyph->lly < font->ft.bbox.lly) font->ft.bbox.lly = glyph->lly; if (glyph->urx > font->ft.bbox.urx) font->ft.bbox.urx = glyph->urx; if (glyph->ury > font->ft.bbox.ury) font->ft.bbox.ury = glyph->ury; } /* we must initialize the text, graphics and color state * otherwise the user get unpredictable appearance of a * glyph because of optimizing outputting graphics properties. * Following statements were inserted due to bug #719 */ pdf_init_tstate(p); pdf_init_gstate(p); pdf_init_cstate(p); PDF_SET_STATE(p, pdf_state_glyph); } else { PDF_SET_STATE(p, pdf_state_glyphmetrics); } pdc_pop_errmsg(p->pdc); if (!p->pdc->smokerun) pdc_logg_cond(p->pdc, 1, trc_api, "[Begin glyph %d]\n", ig); }
void pdf__end_font(PDF *p) { int ig; pdf_font *font; pdf_t3font *t3font; PDF_SET_STATE(p, pdf_state_document); font = &p->fonts[p->t3slot]; t3font = font->t3font; /* error message prefix */ pdc_push_errmsg(p->pdc, PDF_E_T3_FONT_PREFIX, font->apiname, 0, 0, 0); if (t3font->pass == 0) { pdf_t3glyph glyph0 = t3font->glyphs[0]; /* search for .notdef glyph */ if (pdc_strcmp(glyph0.name, (char *) pdc_get_notdef_glyphname())) { for (ig = 0; ig < t3font->next_glyph; ig++) { if (!pdc_strcmp(t3font->glyphs[ig].name, (char *) pdc_get_notdef_glyphname())) break; } if (ig < t3font->next_glyph) { pdc_logg_cond(p->pdc, 2, trc_font, "\tGlyph id %d: \"%s\" will be exchanged " "with glyph id 0: \"%s\"\n", ig, t3font->glyphs[ig].name, glyph0.name); t3font->glyphs[0] = t3font->glyphs[ig]; t3font->glyphs[ig] = glyph0; } else { pdc_warning(p->pdc, PDF_E_T3_MISSNOTDEF, 0, 0, 0, 0); } } } if (t3font->pass != 1) { t3font->charprocs_id = pdc_alloc_id(p->out); pdc_begin_obj(p->out, t3font->charprocs_id); /* CharProcs dict */ pdc_begin_dict(p->out); for (ig = 0; ig < t3font->next_glyph; ig++) { pdf_t3glyph *glyph = &t3font->glyphs[ig]; if (glyph->charproc_id != PDC_BAD_ID) { pdf_put_pdfname(p, glyph->name); pdc_objref(p->out, "", glyph->charproc_id); } } pdc_end_dict(p->out); pdc_end_obj(p->out); /* CharProcs dict */ pdc_begin_obj(p->out, t3font->res_id); pdc_begin_dict(p->out); /* Resource dict */ pdf_write_page_fonts(p); /* Font resources */ pdf_write_page_colorspaces(p); /* Color space resources */ pdf_write_page_pattern(p); /* Pattern resources */ pdf_write_xobjects(p); /* XObject resources */ pdc_end_dict(p->out); /* Resource dict */ pdc_end_obj(p->out); /* Resource object */ pdf_pg_resume(p, -1); if (p->flush & pdc_flush_content) pdc_flush_stream(p->out); /* see pdf__begin_glyph */ pdf_init_tstate(p); pdf_init_gstate(p); pdf_init_cstate(p); } pdc_logg_cond(p->pdc, 1, trc_font, "\tEnd of Type3 font \"%s\"\n", font->apiname); pdc_pop_errmsg(p->pdc); if (!p->pdc->smokerun) pdc_logg_cond(p->pdc, 1, trc_api, "[End font %d]\n", p->t3slot); p->t3slot = -1; }
void pdf_write_doc_extgstates(PDF *p) { int i, j; pdf_extgstateresource *gs; for (i = 0; i < p->extgstates_number; i++) { gs = &p->extgstates[i]; pdc_begin_obj(p->out, gs->obj_id); /* ExtGState resource */ pdc_begin_dict(p->out); pdc_puts(p->out, "/Type/ExtGState\n"); if (gs->font_obj != PDC_NEW_ID) { pdc_puts(p->out, "/Font"); pdc_begin_array(p->out); pdc_objref(p->out, "", gs->font_obj); pdc_printf(p->out, "%f", gs->font_size); pdc_end_array(p->out); } if (gs->line_width != pdc_undef) pdc_printf(p->out, "/LW %f\n", gs->line_width); if (gs->line_cap != pdc_undef) pdc_printf(p->out, "/LC %d\n", gs->line_cap); if (gs->line_join != pdc_undef) pdc_printf(p->out, "/LJ %d\n", gs->line_join); if (gs->miter_limit != pdc_undef) pdc_printf(p->out, "/ML %f\n", gs->miter_limit); if (gs->dash_count > 0) { pdc_printf(p->out, "/D"); pdc_begin_array(p->out); pdc_begin_array(p->out); for (j = 0; j < gs->dash_count; ++j) pdc_printf(p->out, "%f ", gs->dash_array[j]); pdc_end_array_c(p->out); pdc_printf(p->out, "%f", gs->dash_phase); pdc_end_array(p->out); /* but see page 157 of PDF Reference: integer */ } if (gs->ri != AutoIntent) pdc_printf(p->out, "/RI/%s\n", pdc_get_keyword((long) gs->ri, pdf_renderingintent_pdfkeylist)); if (gs->stroke_adjust != pdc_undef) pdc_printf(p->out, "/SA %s\n", PDC_BOOLSTR(gs->stroke_adjust)); if (gs->overprint_stroke != pdc_undef) pdc_printf(p->out, "/OP %s\n", PDC_BOOLSTR(gs->overprint_stroke)); if (gs->overprint_fill != pdc_undef) pdc_printf(p->out, "/op %s\n", PDC_BOOLSTR(gs->overprint_fill)); else if (gs->overprint_stroke == pdc_true) pdc_puts(p->out, "/op false\n"); if (gs->overprint_mode != pdc_undef) pdc_printf(p->out, "/OPM %d\n", gs->overprint_mode); if (gs->flatness != pdc_undef) pdc_printf(p->out, "/FL %f\n", gs->flatness); if (gs->smoothness != pdc_undef) pdc_printf(p->out, "/SM %f\n", gs->smoothness); if (gs->opacity_fill != pdc_undef) pdc_printf(p->out, "/ca %f\n", gs->opacity_fill); if (gs->blendmode != BM_None) { const char *modename; int modecount=0; for (j = 0; ; j++) { if (!pdf_blendmode_pdfkeylist[j].word) break; if (gs->blendmode & pdf_blendmode_pdfkeylist[j].code) modecount++; } pdc_printf(p->out, "/BM"); /* * ACROBUG: Acrobat 7 doesn't like Blend mode arrays with a * singly entry under some circumstances (many entries? images * involved?) so we avoid the array if we have only one entry. */ if (modecount > 1) pdc_begin_array(p->out); for (j = 0; ; j++) { modename = pdf_blendmode_pdfkeylist[j].word; if (!modename) break; if (gs->blendmode & pdf_blendmode_pdfkeylist[j].code) pdc_printf(p->out, "/%s", modename); } if (modecount > 1) pdc_end_array(p->out); } if (gs->opacity_stroke != pdc_undef) pdc_printf(p->out, "/CA %f\n", gs->opacity_stroke); if (gs->alpha_is_shape != pdc_undef) pdc_printf(p->out, "/AIS %s\n", PDC_BOOLSTR(gs->alpha_is_shape)); if (gs->text_knockout != pdc_undef) pdc_printf(p->out, "/TK %s\n", PDC_BOOLSTR(gs->text_knockout)); pdc_end_dict(p->out); pdc_end_obj(p->out); /* ExtGState resource */ } }