本文整理汇总了C++中pdf_drop_obj函数的典型用法代码示例。如果您正苦于以下问题:C++ pdf_drop_obj函数的具体用法?C++ pdf_drop_obj怎么用?C++ pdf_drop_obj使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pdf_drop_obj函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: pdf_delete_portfolio_schema
void pdf_delete_portfolio_schema(fz_context *ctx, pdf_document *doc, int entry)
{
pdf_portfolio **pp;
pdf_portfolio *p;
pdf_obj *s;
if (!doc)
fz_throw(ctx, FZ_ERROR_GENERIC, "Bad pdf_delete_portfolio_schema call");
if (doc->portfolio == NULL)
load_portfolio(ctx, doc);
pp = &doc->portfolio;
while (*pp && entry > 0)
pp = &(*pp)->next, entry--;
p = *pp;
if (p == NULL || entry)
fz_throw(ctx, FZ_ERROR_GENERIC, "entry out of range in pdf_delete_portfolio_schema");
*pp = p->next;
/* Delete the key from the schema */
s = pdf_dict_getl(ctx, pdf_trailer(ctx, doc), PDF_NAME_Root, PDF_NAME_Collection, PDF_NAME_Schema, NULL);
pdf_dict_del(ctx, s, p->key);
/* Delete this entry from all the collection entries */
s = pdf_dict_getl(ctx, pdf_trailer(ctx, doc), PDF_NAME_Root, PDF_NAME_Names, PDF_NAME_EmbeddedFiles, NULL);
pdf_name_tree_map(ctx, s, delete_from_node, p->key);
pdf_drop_obj(ctx, p->entry.name);
pdf_drop_obj(ctx, p->key);
pdf_drop_obj(ctx, p->val);
fz_free(ctx, p);
}
开发者ID:ArtifexSoftware,项目名称:mupdf,代码行数:34,代码来源:pdf-portfolio.c
示例2: pdf_free_xref_sections
static void pdf_free_xref_sections(pdf_document *doc)
{
fz_context *ctx = doc->ctx;
int x, e;
for (x = 0; x < doc->num_xref_sections; x++)
{
pdf_xref *xref = &doc->xref_sections[x];
for (e = 0; e < xref->len; e++)
{
pdf_xref_entry *entry = &xref->table[e];
if (entry->obj)
{
pdf_drop_obj(entry->obj);
fz_drop_buffer(ctx, entry->stm_buf);
}
}
fz_free(ctx, xref->table);
pdf_drop_obj(xref->trailer);
}
fz_free(ctx, doc->xref_sections);
doc->xref_sections = NULL;
doc->num_xref_sections = 0;
}
开发者ID:suyuancheng13,项目名称:Mupdf_S,代码行数:28,代码来源:pdf-xref.c
示例3: pdf_clean_stream_object
static void
pdf_clean_stream_object(fz_context *ctx, pdf_document *doc, pdf_obj *obj, pdf_obj *orig_res, fz_cookie *cookie, int own_res)
{
pdf_processor *proc_buffer = NULL;
pdf_processor *proc_filter = NULL;
pdf_obj *res = NULL;
pdf_obj *ref = NULL;
fz_buffer *buffer;
if (!obj)
return;
fz_var(res);
fz_var(ref);
fz_var(proc_buffer);
fz_var(proc_filter);
buffer = fz_new_buffer(ctx, 1024);
fz_try(ctx)
{
if (own_res)
{
pdf_obj *r = pdf_dict_get(ctx, obj, PDF_NAME_Resources);
if (r)
orig_res = r;
}
res = pdf_new_dict(ctx, doc, 1);
proc_buffer = pdf_new_buffer_processor(ctx, buffer);
proc_filter = pdf_new_filter_processor(ctx, proc_buffer, doc, orig_res, res);
pdf_process_contents(ctx, proc_filter, doc, orig_res, obj, cookie);
pdf_update_stream(ctx, doc, obj, buffer, 0);
if (own_res)
{
ref = pdf_new_ref(ctx, doc, res);
pdf_dict_put(ctx, obj, PDF_NAME_Resources, ref);
}
}
fz_always(ctx)
{
pdf_drop_processor(ctx, proc_filter);
pdf_drop_processor(ctx, proc_buffer);
fz_drop_buffer(ctx, buffer);
pdf_drop_obj(ctx, res);
pdf_drop_obj(ctx, ref);
}
fz_catch(ctx)
{
fz_rethrow_message(ctx, "Failed while cleaning xobject");
}
}
开发者ID:PuzzleFlow,项目名称:mupdf,代码行数:56,代码来源:pdf-clean.c
示例4: pdf_drop_pattern_imp
static void
pdf_drop_pattern_imp(fz_context *ctx, fz_storable *pat_)
{
pdf_pattern *pat = (pdf_pattern *)pat_;
if (pat->resources)
pdf_drop_obj(ctx, pat->resources);
if (pat->contents)
pdf_drop_obj(ctx, pat->contents);
fz_free(ctx, pat);
}
开发者ID:GKerison,项目名称:mupdf-1,代码行数:10,代码来源:pdf-pattern.c
示例5: pdf_dev_alpha
static void
pdf_dev_alpha(fz_context *ctx, pdf_device *pdev, float alpha, int stroke)
{
int i;
pdf_document *doc = pdev->doc;
gstate *gs = CURRENT_GSTATE(pdev);
/* If the alpha is unchanged, nothing to do */
if (gs->alpha[stroke] == alpha)
return;
/* Have we sent such an alpha before? */
for (i = 0; i < pdev->num_alphas; i++)
if (pdev->alphas[i].alpha == alpha && pdev->alphas[i].stroke == stroke)
break;
if (i == pdev->num_alphas)
{
pdf_obj *o;
pdf_obj *ref = NULL;
fz_var(ref);
/* No. Need to make a new one */
if (pdev->num_alphas == pdev->max_alphas)
{
int newmax = pdev->max_alphas * 2;
if (newmax == 0)
newmax = 4;
pdev->alphas = fz_resize_array(ctx, pdev->alphas, newmax, sizeof(*pdev->alphas));
pdev->max_alphas = newmax;
}
pdev->alphas[i].alpha = alpha;
pdev->alphas[i].stroke = stroke;
o = pdf_new_dict(ctx, doc, 1);
fz_try(ctx)
{
char text[32];
pdf_dict_put_drop(ctx, o, (stroke ? PDF_NAME_CA : PDF_NAME_ca), pdf_new_real(ctx, doc, alpha));
ref = pdf_add_object(ctx, doc, o);
fz_snprintf(text, sizeof(text), "ExtGState/Alp%d", i);
pdf_dict_putp(ctx, pdev->resources, text, ref);
}
fz_always(ctx)
{
pdf_drop_obj(ctx, o);
pdf_drop_obj(ctx, ref);
}
fz_catch(ctx)
{
fz_rethrow(ctx);
}
pdev->num_alphas++;
}
开发者ID:catello74000,项目名称:mupdf,代码行数:55,代码来源:pdf-device.c
示例6: page_merge
static void page_merge(int page_from, int page_to, pdf_graft_map *graft_map)
{
pdf_obj *pageref = NULL;
pdf_obj *page_dict;
pdf_obj *obj = NULL, *ref = NULL;
/* Include minimal number of objects for page. Do not include items that
* reference other pages */
pdf_obj *known_page_objs[] = { PDF_NAME_Contents, PDF_NAME_Resources,
PDF_NAME_MediaBox, PDF_NAME_CropBox, PDF_NAME_BleedBox, PDF_NAME_TrimBox,
PDF_NAME_ArtBox, PDF_NAME_Rotate, PDF_NAME_UserUnit};
int n = nelem(known_page_objs);
int i;
int num;
fz_var(obj);
fz_var(ref);
fz_try(ctx)
{
pageref = pdf_lookup_page_obj(ctx, doc_src, page_from - 1);
/* Make a new dictionary and copy over the items from the source object to
* the new dict that we want to deep copy. */
page_dict = pdf_new_dict(ctx, doc_des, 4);
pdf_dict_put_drop(ctx, page_dict, PDF_NAME_Type, PDF_NAME_Page);
for (i = 0; i < n; i++)
{
obj = pdf_dict_get(ctx, pageref, known_page_objs[i]);
if (obj != NULL)
pdf_dict_put_drop(ctx, page_dict, known_page_objs[i], pdf_graft_object(ctx, doc_des, doc_src, obj, graft_map));
}
/* Add the dictionary */
obj = pdf_add_object_drop(ctx, doc_des, page_dict);
/* Get indirect ref */
num = pdf_to_num(ctx, obj);
ref = pdf_new_indirect(ctx, doc_des, num, 0);
/* Insert */
pdf_insert_page(ctx, doc_des, page_to - 1, ref);
}
fz_always(ctx)
{
pdf_drop_obj(ctx, obj);
pdf_drop_obj(ctx, ref);
}
fz_catch(ctx)
{
fz_rethrow(ctx);
}
}
开发者ID:gavanx,项目名称:mupdf-1.9a-source,代码行数:54,代码来源:pdfmerge.c
示例7: pdf_free_xobject_imp
static void
pdf_free_xobject_imp(fz_context *ctx, fz_storable *xobj_)
{
pdf_xobject *xobj = (pdf_xobject *)xobj_;
if (xobj->colorspace)
fz_drop_colorspace(ctx, xobj->colorspace);
pdf_drop_obj(xobj->resources);
pdf_drop_obj(xobj->contents);
pdf_drop_obj(xobj->me);
fz_free(ctx, xobj);
}
开发者ID:suyuancheng13,项目名称:Mupdf_S,代码行数:12,代码来源:pdf-xobject.c
示例8: res_image_init
/* Image specific methods */
static void
res_image_init(fz_context *ctx, pdf_document *doc, pdf_res_table *table)
{
int len, k;
pdf_obj *obj;
pdf_obj *type;
pdf_obj *res = NULL;
fz_image *image = NULL;
unsigned char digest[16];
fz_var(obj);
fz_var(image);
fz_var(res);
fz_try(ctx)
{
table->hash = fz_new_hash_table(ctx, 4096, 16, -1);
len = pdf_count_objects(ctx, doc);
for (k = 1; k < len; k++)
{
obj = pdf_load_object(ctx, doc, k, 0);
type = pdf_dict_get(ctx, obj, PDF_NAME_Subtype);
if (pdf_name_eq(ctx, type, PDF_NAME_Image))
{
image = pdf_load_image(ctx, doc, obj);
res_image_get_md5(ctx, image, digest);
fz_drop_image(ctx, image);
image = NULL;
/* Don't allow overwrites. */
if (fz_hash_find(ctx, table->hash, digest) == NULL)
fz_hash_insert(ctx, table->hash, digest, obj);
}
else
{
pdf_drop_obj(ctx, obj);
}
obj = NULL;
}
}
fz_always(ctx)
{
fz_drop_image(ctx, image);
pdf_drop_obj(ctx, obj);
}
fz_catch(ctx)
{
res_table_free(ctx, table);
fz_rethrow(ctx);
}
}
开发者ID:bradgearon,项目名称:mupdf,代码行数:52,代码来源:pdf-resources.c
示例9: fz_var
static pdf_obj *draw_check_button(fz_context *ctx, pdf_annot *annot, fz_rect bbox, fz_matrix matrix, float w, float h, int yes)
{
float black[3] = { 0, 0, 0 };
pdf_obj *ap, *res = NULL;
fz_buffer *buf;
float b;
fz_var(res);
buf = fz_new_buffer(ctx, 1024);
fz_try(ctx)
{
fz_append_string(ctx, buf, "q\n");
if (pdf_write_MK_BG_appearance(ctx, annot, buf))
fz_append_printf(ctx, buf, "0 0 %g %g re\nf\n", w, h);
b = pdf_write_border_appearance(ctx, annot, buf);
if (b > 0 && pdf_write_MK_BC_appearance(ctx, annot, buf))
fz_append_printf(ctx, buf, "%g %g %g %g re\nS\n", b/2, b/2, w-b, h-b);
if (yes)
write_variable_text(ctx, annot, buf, &res, "3", "ZaDb", h, black, 0, w, h, b+h/10, 0.8f, 1.2f, 0, 0, 0);
fz_append_string(ctx, buf, "Q\n");
ap = pdf_new_xobject(ctx, annot->page->doc, bbox, matrix, res, buf);
}
fz_always(ctx)
{
pdf_drop_obj(ctx, res);
fz_drop_buffer(ctx, buf);
}
fz_catch(ctx)
fz_rethrow(ctx);
return ap;
}
开发者ID:TamirEvan,项目名称:mupdf,代码行数:32,代码来源:pdf-appearance.c
示例10: info_update
static void info_update(fz_context *ctx,pdf_document *xref,char *producer)
{
char moddate[64];
time_t now;
struct tm date;
pdf_obj *info;
int newinfo;
if (xref->trailer==NULL)
return;
time(&now);
date=(*localtime(&now));
sprintf(moddate,"D:%04d%02d%02d%02d%02d%02d%s",
date.tm_year+1900,date.tm_mon+1,date.tm_mday,
date.tm_hour,date.tm_min,date.tm_sec,
wsys_utc_string());
info=pdf_dict_gets(xref->trailer,"Info");
if (info==NULL)
{
newinfo=1;
info=pdf_new_dict(ctx,2);
}
else
newinfo=0;
dict_put_string(ctx,info,"Producer",producer);
dict_put_string(ctx,info,"ModDate",moddate);
if (newinfo)
{
pdf_dict_puts(xref->trailer,"Info",info);
pdf_drop_obj(info);
}
}
开发者ID:chenkaigithub,项目名称:libk2pdfopt,代码行数:33,代码来源:wmupdf.c
示例11: pdf_load_name_tree_imp
static void
pdf_load_name_tree_imp(pdf_obj *dict, pdf_document *xref, pdf_obj *node)
{
fz_context *ctx = xref->ctx;
pdf_obj *kids = pdf_dict_gets(node, "Kids");
pdf_obj *names = pdf_dict_gets(node, "Names");
int i;
if (kids && !pdf_dict_mark(node))
{
for (i = 0; i < pdf_array_len(kids); i++)
pdf_load_name_tree_imp(dict, xref, pdf_array_get(kids, i));
pdf_dict_unmark(node);
}
if (names)
{
for (i = 0; i + 1 < pdf_array_len(names); i += 2)
{
pdf_obj *key = pdf_array_get(names, i);
pdf_obj *val = pdf_array_get(names, i + 1);
if (pdf_is_string(key))
{
key = pdf_to_utf8_name(ctx, key);
pdf_dict_put(dict, key, val);
pdf_drop_obj(key);
}
else if (pdf_is_name(key))
{
pdf_dict_put(dict, key, val);
}
}
}
}
开发者ID:JMQCode,项目名称:iBooks,代码行数:34,代码来源:pdf_nametree.c
示例12: pdf_copy_dict
pdf_obj *
pdf_copy_dict(fz_context *ctx, pdf_obj *obj)
{
pdf_document *doc;
pdf_obj *dict;
int i, n;
RESOLVE(obj);
if (!OBJ_IS_DICT(obj))
fz_throw(ctx, FZ_ERROR_GENERIC, "not a dict (%s)", pdf_objkindstr(obj));
doc = DICT(obj)->doc;
n = pdf_dict_len(ctx, obj);
dict = pdf_new_dict(ctx, doc, n);
fz_try(ctx)
for (i = 0; i < n; i++)
pdf_dict_put(ctx, dict, pdf_dict_get_key(ctx, obj, i), pdf_dict_get_val(ctx, obj, i));
fz_catch(ctx)
{
pdf_drop_obj(ctx, dict);
fz_rethrow(ctx);
}
return dict;
}
开发者ID:muennich,项目名称:mupdf,代码行数:25,代码来源:pdf-object.c
示例13: pdf_load_raw_renumbered_stream
fz_buffer *
pdf_load_raw_renumbered_stream(pdf_document *xref, int num, int gen, int orig_num, int orig_gen)
{
fz_stream *stm;
pdf_obj *dict;
int len;
fz_buffer *buf;
if (num > 0 && num < xref->len && xref->table[num].stm_buf)
return fz_keep_buffer(xref->ctx, xref->table[num].stm_buf);
dict = pdf_load_object(xref, num, gen);
/* RJW: "cannot load stream dictionary (%d %d R)", num, gen */
len = pdf_to_int(pdf_dict_gets(dict, "Length"));
pdf_drop_obj(dict);
stm = pdf_open_raw_renumbered_stream(xref, num, gen, orig_num, orig_gen);
/* RJW: "cannot open raw stream (%d %d R)", num, gen */
buf = fz_read_all(stm, len);
/* RJW: "cannot read raw stream (%d %d R)", num, gen */
fz_close(stm);
return buf;
}
开发者ID:JMQCode,项目名称:iBooks,代码行数:27,代码来源:pdf_stream.c
示例14: update_field_value
static void update_field_value(pdf_document *doc, pdf_obj *obj, char *text)
{
fz_context *ctx = doc->ctx;
pdf_obj *sobj = NULL;
pdf_obj *grp;
if (!text)
text = "";
/* All fields of the same name should be updated, so
* set the value at the head of the group */
grp = find_head_of_field_group(obj);
if (grp)
obj = grp;
fz_var(sobj);
fz_try(ctx)
{
sobj = pdf_new_string(doc, text, strlen(text));
pdf_dict_puts(obj, "V", sobj);
}
fz_always(ctx)
{
pdf_drop_obj(sobj);
}
fz_catch(ctx)
{
fz_rethrow(ctx);
}
pdf_field_mark_dirty(doc, obj);
}
开发者ID:ArphonePei,项目名称:PDFConverter,代码行数:32,代码来源:pdf-form.c
示例15: pdf_load_raw_renumbered_stream
fz_buffer *
pdf_load_raw_renumbered_stream(fz_context *ctx, pdf_document *doc, int num, int gen, int orig_num, int orig_gen)
{
fz_stream *stm;
pdf_obj *dict;
int len;
fz_buffer *buf;
if (num > 0 && num < pdf_xref_len(ctx, doc))
{
pdf_xref_entry *entry = pdf_get_xref_entry(ctx, doc, num);
if (entry->stm_buf)
return fz_keep_buffer(ctx, entry->stm_buf);
}
dict = pdf_load_object(ctx, doc, num, gen);
len = pdf_to_int(ctx, pdf_dict_get(ctx, dict, PDF_NAME_Length));
pdf_drop_obj(ctx, dict);
stm = pdf_open_raw_renumbered_stream(ctx, doc, num, gen, orig_num, orig_gen);
buf = fz_read_all(ctx, stm, len);
fz_drop_stream(ctx, stm);
return buf;
}
开发者ID:PuzzleFlow,项目名称:mupdf,代码行数:28,代码来源:pdf-stream.c
示例16: saveimage
static void saveimage(int num)
{
fz_image *image = NULL;
fz_pixmap *pix = NULL;
pdf_obj *ref;
char buf[32];
ref = pdf_new_indirect(ctx, doc, num, 0);
fz_var(image);
fz_var(pix);
fz_try(ctx)
{
/* TODO: detect DCTD and save as jpeg */
image = pdf_load_image(ctx, doc, ref);
pix = fz_get_pixmap_from_image(ctx, image, NULL, NULL, 0, 0);
snprintf(buf, sizeof(buf), "img-%04d", num);
writepixmap(ctx, pix, buf, dorgb);
}
fz_always(ctx)
{
fz_drop_image(ctx, image);
fz_drop_pixmap(ctx, pix);
pdf_drop_obj(ctx, ref);
}
fz_catch(ctx)
fz_rethrow(ctx);
}
开发者ID:iezbli,项目名称:zbli,代码行数:30,代码来源:pdfextract.c
示例17: pdf_set_populating_xref_trailer
void pdf_set_populating_xref_trailer(pdf_document *doc, pdf_obj *trailer)
{
/* Update the trailer of the xref section being populated */
pdf_xref *xref = &doc->xref_sections[doc->num_xref_sections - 1];
pdf_drop_obj(xref->trailer);
xref->trailer = pdf_keep_obj(trailer);
}
开发者ID:suyuancheng13,项目名称:Mupdf_S,代码行数:7,代码来源:pdf-xref.c
示例18: ensure_incremental_xref
/*
Ensure we have an incremental xref section where we can store
updated versions of indirect objects
*/
static void ensure_incremental_xref(pdf_document *doc)
{
fz_context *ctx = doc->ctx;
if (!doc->xref_altered)
{
pdf_xref *xref = &doc->xref_sections[0];
pdf_xref *pxref;
pdf_xref_entry *new_table = fz_calloc(ctx, xref->len, sizeof(pdf_xref_entry));
pdf_obj *trailer = NULL;
fz_var(trailer);
fz_try(ctx)
{
trailer = pdf_copy_dict(xref->trailer);
doc->xref_sections = fz_resize_array(ctx, doc->xref_sections, doc->num_xref_sections + 1, sizeof(pdf_xref));
xref = &doc->xref_sections[0];
pxref = &doc->xref_sections[1];
memmove(pxref, xref, doc->num_xref_sections * sizeof(pdf_xref));
/* xref->len is already correct */
xref->table = new_table;
xref->trailer = trailer;
doc->num_xref_sections++;
doc->xref_altered = 1;
}
fz_catch(ctx)
{
fz_free(ctx, new_table);
pdf_drop_obj(trailer);
fz_rethrow(ctx);
}
}
开发者ID:suyuancheng13,项目名称:Mupdf_S,代码行数:36,代码来源:pdf-xref.c
示例19: pdf_copy_array
pdf_obj *
pdf_copy_array(fz_context *ctx, pdf_obj *obj)
{
pdf_document *doc;
pdf_obj *arr;
int i;
int n;
RESOLVE(obj);
if (!OBJ_IS_ARRAY(obj))
fz_throw(ctx, FZ_ERROR_GENERIC, "not an array (%s)", pdf_objkindstr(obj));
doc = ARRAY(obj)->doc;
n = pdf_array_len(ctx, obj);
arr = pdf_new_array(ctx, doc, n);
fz_try(ctx)
for (i = 0; i < n; i++)
pdf_array_push(ctx, arr, pdf_array_get(ctx, obj, i));
fz_catch(ctx)
{
pdf_drop_obj(ctx, arr);
fz_rethrow(ctx);
}
return arr;
}
开发者ID:muennich,项目名称:mupdf,代码行数:27,代码来源:pdf-object.c
示例20: parse_inline_image
static fz_image *
parse_inline_image(fz_context *ctx, pdf_csi *csi, fz_stream *stm)
{
pdf_document *doc = csi->doc;
pdf_obj *rdb = csi->rdb;
pdf_obj *obj = NULL;
fz_image *img = NULL;
int ch, found;
fz_var(obj);
fz_var(img);
fz_try(ctx)
{
obj = pdf_parse_dict(ctx, doc, stm, &doc->lexbuf.base);
/* read whitespace after ID keyword */
ch = fz_read_byte(ctx, stm);
if (ch == '\r')
if (fz_peek_byte(ctx, stm) == '\n')
fz_read_byte(ctx, stm);
img = pdf_load_inline_image(ctx, doc, rdb, obj, stm);
/* find EI */
found = 0;
ch = fz_read_byte(ctx, stm);
do
{
while (ch != 'E' && ch != EOF)
ch = fz_read_byte(ctx, stm);
if (ch == 'E')
{
ch = fz_read_byte(ctx, stm);
if (ch == 'I')
{
ch = fz_peek_byte(ctx, stm);
if (ch == ' ' || ch <= 32 || ch == EOF || ch == '<' || ch == '/')
{
found = 1;
break;
}
}
}
} while (ch != EOF);
if (!found)
fz_throw(ctx, FZ_ERROR_GENERIC, "syntax error after inline image");
}
fz_always(ctx)
{
pdf_drop_obj(ctx, obj);
}
fz_catch(ctx)
{
fz_drop_image(ctx, img);
fz_rethrow(ctx);
}
return img;
}
开发者ID:ArtifexSoftware,项目名称:mupdf,代码行数:60,代码来源:pdf-interpret.c
注:本文中的pdf_drop_obj函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论