本文整理汇总了C++中pdf_new_dict函数的典型用法代码示例。如果您正苦于以下问题:C++ pdf_new_dict函数的具体用法?C++ pdf_new_dict怎么用?C++ pdf_new_dict使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pdf_new_dict函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: 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
示例2: 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
示例3: create_encoding_resource
/* Creates the PDF Encoding entry for the encoding.
* If baseenc is non-null, it is used as BaseEncoding entry.
*/
static pdf_obj *
create_encoding_resource (pdf_encoding *encoding, pdf_encoding *baseenc)
{
pdf_obj *differences;
ASSERT(encoding);
ASSERT(!encoding->resource);
differences = make_encoding_differences(encoding->glyphs,
baseenc ? baseenc->glyphs : NULL,
encoding->is_used);
if (differences) {
pdf_obj *resource = pdf_new_dict();
if (baseenc)
pdf_add_dict(resource, pdf_new_name("BaseEncoding"),
pdf_link_obj(baseenc->resource));
pdf_add_dict(resource, pdf_new_name("Differences"), differences);
return resource;
} else {
/* Fix a bug with the MinionPro package using MnSymbol fonts
* in its virtual fonts:
*
* Some font may have font_id even if no character is used.
* For example, suppose that a virtual file A.vf uses two
* other fonts, B and C. Even if only characters of B are used
* in a DVI document, C will have font_id too.
* In this case, both baseenc and differences can be NULL.
*
* Actually these fonts will be ignored in pdffont.c.
*/
return baseenc ? pdf_link_obj(baseenc->resource) : NULL;
}
}
开发者ID:MiKTeX,项目名称:miktex,代码行数:36,代码来源:pdfencoding.c
示例4: 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_text_filter_fn *text_filter, pdf_after_text_object_fn *after_text, void *arg,
int sanitize, int ascii)
{
pdf_processor *proc_buffer = NULL;
pdf_processor *proc_filter = NULL;
pdf_obj *res = NULL;
pdf_obj *ref;
fz_buffer *buffer;
if (!obj)
return;
fz_var(res);
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, ascii);
proc_filter = pdf_new_filter_processor_with_text_filter(ctx, doc, proc_buffer, orig_res, res, text_filter, after_text, arg);
pdf_process_contents(ctx, proc_filter, doc, orig_res, obj, cookie);
pdf_close_processor(ctx, proc_filter);
pdf_close_processor(ctx, proc_buffer);
pdf_update_stream(ctx, doc, obj, buffer, 0);
if (own_res)
{
ref = pdf_add_object(ctx, doc, res);
pdf_dict_put_drop(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);
}
fz_catch(ctx)
{
fz_rethrow(ctx);
}
}
开发者ID:JorjMcKie,项目名称:mupdf,代码行数:58,代码来源:pdf-clean.c
示例5: pdf_create_page
pdf_page *
pdf_create_page(pdf_document *doc, fz_rect mediabox, int res, int rotate)
{
pdf_page *page = NULL;
pdf_obj *pageobj;
float userunit = 1;
fz_context *ctx = doc->ctx;
fz_matrix ctm, tmp;
fz_rect realbox;
page = fz_malloc_struct(ctx, pdf_page);
fz_try(ctx)
{
page->resources = NULL;
page->contents = NULL;
page->transparency = 0;
page->links = NULL;
page->annots = NULL;
page->me = pageobj = pdf_new_dict(doc, 4);
pdf_dict_puts_drop(pageobj, "Type", pdf_new_name(doc, "Page"));
page->mediabox.x0 = fz_min(mediabox.x0, mediabox.x1) * userunit;
page->mediabox.y0 = fz_min(mediabox.y0, mediabox.y1) * userunit;
page->mediabox.x1 = fz_max(mediabox.x0, mediabox.x1) * userunit;
page->mediabox.y1 = fz_max(mediabox.y0, mediabox.y1) * userunit;
pdf_dict_puts_drop(pageobj, "MediaBox", pdf_new_rect(doc, &page->mediabox));
/* Snap page->rotate to 0, 90, 180 or 270 */
if (page->rotate < 0)
page->rotate = 360 - ((-page->rotate) % 360);
if (page->rotate >= 360)
page->rotate = page->rotate % 360;
page->rotate = 90*((page->rotate + 45)/90);
if (page->rotate > 360)
page->rotate = 0;
pdf_dict_puts_drop(pageobj, "Rotate", pdf_new_int(doc, page->rotate));
fz_pre_rotate(fz_scale(&ctm, 1, -1), -page->rotate);
realbox = page->mediabox;
fz_transform_rect(&realbox, &ctm);
fz_pre_scale(fz_translate(&tmp, -realbox.x0, -realbox.y0), userunit, userunit);
fz_concat(&ctm, &ctm, &tmp);
page->ctm = ctm;
/* Do not create a Contents, as an empty Contents dict is not
* valid. See Bug 694712 */
}
fz_catch(ctx)
{
pdf_drop_obj(page->me);
fz_free(ctx, page);
fz_rethrow_message(ctx, "Failed to create page");
}
return page;
}
开发者ID:codepongo,项目名称:sumatrapdf,代码行数:57,代码来源:pdf-page.c
示例6: 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
示例7: 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
示例8: 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
示例9: skip_white
pdf_obj *parse_pdf_dict (char **start, char *end)
{
pdf_obj *result, *tmp1, *tmp2;
char *save = *start;
skip_white(start, end);
if (*((*start)++) != '<' ||
*((*start)++) != '<') {
*start = save;
dump (*start, end);
return NULL;
}
result = pdf_new_dict ();
skip_white(start, end);
while (*start < end &&
**start != '>') {
if ((tmp1 = parse_pdf_name (start, end)) == NULL) {
pdf_release_obj (result);
{
*start = save;
dump (*start, end);
return NULL;
}
};
if ((tmp2 = parse_pdf_object (start, end)) == NULL) {
pdf_release_obj (result);
pdf_release_obj (tmp1);
{
*start = save;
dump (*start, end);
return NULL;
}
}
pdf_add_dict (result, tmp1, tmp2);
skip_white(start, end);
}
if (*start >= end) {
pdf_release_obj (result);
*start = save;
dump (*start, end);
return NULL;
}
if (*((*start)++) == '>' &&
*((*start)++) == '>') {
return result;
} else {
pdf_release_obj (result);
fprintf (stderr, "\nDictionary object ended prematurely\n");
*start = save;
dump (*start, end);
return NULL;
}
}
开发者ID:BackupTheBerlios,项目名称:texlive,代码行数:52,代码来源:pdfparse.c
示例10: html_make_link_dict
static void html_make_link_dict (char *name)
{
pdf_obj *color;
if (!link_dict) {
link_dict = pdf_new_dict();
pdf_add_dict(link_dict, pdf_new_name("Type"), pdf_new_name ("Annot"));
pdf_add_dict(link_dict, pdf_new_name("Subtype"), pdf_new_name ("Link"));
color = pdf_new_array ();
pdf_add_array (color, pdf_new_number (0));
pdf_add_array (color, pdf_new_number (1));
pdf_add_array (color, pdf_new_number (1));
pdf_add_dict(link_dict, pdf_new_name("C"), color);
if (name && *name == '#' && !(base_value)) {
pdf_add_dict (link_dict, pdf_new_name("Dest"), pdf_new_string(name+1,strlen(name+1)));
} else if (name) { /* Assume its a URL */
char *url;
int len;
pdf_obj *action;
len = strlen(name)+1;
if (base_value)
len+=strlen(base_value);
url = NEW (len, char);
if (base_value)
strcpy (url, base_value);
else
url[0] = 0;
strcat (url, name);
action = pdf_new_dict();
pdf_add_dict (action, pdf_new_name ("Type"), pdf_new_name ("Action"));
pdf_add_dict (action, pdf_new_name ("S"), pdf_new_name ("URI"));
pdf_add_dict (action, pdf_new_name ("URI"),
pdf_new_string (url, len));
pdf_add_dict (link_dict, pdf_new_name ("A"), pdf_ref_obj (action));
pdf_release_obj (action);
RELEASE (url);
}
pdf_doc_begin_annot (link_dict);
} else {
开发者ID:BackupTheBerlios,项目名称:texlive,代码行数:38,代码来源:htex.c
示例11: wmupdf_preserve_old_dests
/*
** From MuPDF pdfclean.c
*/
static void wmupdf_preserve_old_dests(pdf_obj *olddests,fz_context *ctx,pdf_document *xref,
pdf_obj *pages)
{
int i;
pdf_obj *names = pdf_new_dict(ctx,1);
pdf_obj *dests = pdf_new_dict(ctx,1);
pdf_obj *names_list = pdf_new_array(ctx,32);
int len = pdf_dict_len(olddests);
pdf_obj *root;
for (i=0;i<len;i++)
{
pdf_obj *key = pdf_dict_get_key(olddests,i);
pdf_obj *val = pdf_dict_get_val(olddests,i);
pdf_obj *key_str = pdf_new_string(ctx,pdf_to_name(key),strlen(pdf_to_name(key)));
pdf_obj *dest = pdf_dict_gets(val,"D");
dest = pdf_array_get(dest ? dest : val, 0);
if (pdf_array_contains(pdf_dict_gets(pages,"Kids"),dest))
{
pdf_array_push(names_list, key_str);
pdf_array_push(names_list, val);
}
pdf_drop_obj(key_str);
}
root = pdf_dict_gets(xref->trailer,"Root");
pdf_dict_puts(dests,"Names",names_list);
pdf_dict_puts(names,"Dests",dests);
pdf_dict_puts(root,"Names",names);
pdf_drop_obj(names);
pdf_drop_obj(dests);
pdf_drop_obj(names_list);
pdf_drop_obj(olddests);
}
开发者ID:chenkaigithub,项目名称:libk2pdfopt,代码行数:40,代码来源:wmupdf.c
示例12: hash_to_pdf_dict
static pdf_obj *
hash_to_pdf_dict (fz_context *ctx, pdf_document *doc, pdfout_data *hash,
int *page)
{
pdf_obj *dict_obj = pdf_new_dict (ctx, doc, 3);
int len = pdfout_data_hash_len (ctx, hash);
for (int j = 0; j < len; ++j)
{
char *key, *value;
int value_len;
pdfout_data_hash_get_key_value (ctx, hash, &key, &value, &value_len, j);
if (streq (key, "page"))
*page = pdfout_strtoint_null (ctx, value);
else if (streq (key, "prefix"))
{
pdf_obj *string = pdfout_utf8_to_str_obj (ctx, doc, value,
value_len);
pdf_dict_puts_drop (ctx, dict_obj, "P", string);
}
else if (streq (key, "first"))
{
int first = pdfout_strtoint_null (ctx, value);
pdf_dict_puts_drop (ctx, dict_obj, "St",
pdf_new_int (ctx, doc, first));
}
else if (streq (key, "style"))
{
const char *name;
if (streq (value, "arabic"))
name = "D";
else if (streq (value, "Roman"))
name = "R";
else if (streq (value, "roman"))
name = "r";
else if (streq (value, "Letters"))
name = "A";
else if (streq (value, "letters"))
name = "a";
else
abort ();
pdf_obj *name_obj = pdf_new_name (ctx, doc, name);
pdf_dict_puts_drop (ctx, dict_obj, "S", name_obj);
}
}
return dict_obj;
}
开发者ID:amba,项目名称:pdfout,代码行数:49,代码来源:page-labels.c
示例13: put_pages_on_new_sheet
/*
put_pages_on_new_sheet() - put the contents of pages onto one page in dest_doc
How does it work?
1. Create a page for the new sheet that will contain all source-pages
2. Analyze their sizes! If too small, just center. If too big, warn
3. Analye their userunit-value... if one of them != 1 we have to insert
scale-operations to all others and need to use userunit in the sheet too
4. Copy each entry of the resource-dicts of every page of the sheet
(if it has not already been copied for a previous sheet)
5. Create a dict that contains src-resource-name to dest-resource-name for
this sheet (this is an n:m relation where n >= m)
6. For each source-page-stream create a new content-stream and change
scale (if user-unit is needed), translation and rotation... And add a
clipping-path around the page
7. Copy all source content-streams of the current page to this new content-
stream renaming all its resources to the new names
8. TODO: Annots?
9. TODO: Preseparated pages
10. TODO: Merge procedure sets
*/
static int put_pages_on_new_sheet(fz_context *dest_ctx, pdf_document *dest_doc,
fz_context *src_ctx, pdf_document *src_doc,
struct pos_info *positions, size_t put_count)
{
/* copy each entry of the resource dict */
static const int RENAME_INITIAL_CAP = 128;
struct put_info put_info = { dest_doc, src_doc, NULL, NULL, 0 };
/* what destianation page is currently opened? */
int sheet_pagenum = -1;
pdf_page *sheet = NULL;
size_t i;
for(i = 0; i < put_count; i++) {
/* if the current sheet changes, we need to close the current and open
the new one*/
if(sheet_pagenum != positions[i].sheet_pagenum) {
if(sheet != NULL)
pdf_drop_page(dest_ctx, sheet);
sheet_pagenum = positions[i].sheet_pagenum;
sheet = pdf_load_page(dest_ctx, dest_doc, sheet_pagenum);
// TODO: We assume that the destination-page uses arrays for the
// content and has a usable resoruce-dict... TODO: add those checks
}
/* load the source-page */
pdf_page *src_page = pdf_load_page(src_ctx, src_doc, positions[i].src_pagenum);
/* create a rename_dict */
put_info.rename_dict = pdf_new_dict(dest_ctx, dest_doc, RENAME_INITIAL_CAP);
/* copy all resources, adjust the page and finally copy the content */
copy_and_rename_resources(dest_ctx, sheet->resources,
src_ctx, src_page->resources, &put_info);
adjust_page_position(src_ctx, src_doc, src_page, positions + i);
copy_content_streams_of_page(
dest_ctx, sheet, src_ctx, src_page, &put_info, positions + i);
/* free everything we created for that source-page */
pdf_drop_obj(dest_ctx, put_info.rename_dict);
pdf_drop_page(src_ctx, src_page);
}
if(sheet != NULL)
pdf_drop_page(dest_ctx, sheet);
return(0);
}
开发者ID:s-k2,项目名称:Juggler,代码行数:69,代码来源:put-content.c
示例14: return
static pdf_obj *start_new_destpage(fz_context *ctx,double width_pts,double height_pts)
{
pdf_obj *pageobj;
pdf_obj *mbox;
pageobj=pdf_new_dict(ctx,2);
pdf_dict_puts(pageobj,"Type",pdf_new_name(ctx,"Page"));
mbox=pdf_new_array(ctx,4);
pdf_array_push(mbox,pdf_new_real(ctx,0.));
pdf_array_push(mbox,pdf_new_real(ctx,0.));
pdf_array_push(mbox,pdf_new_real(ctx,width_pts));
pdf_array_push(mbox,pdf_new_real(ctx,height_pts));
pdf_dict_puts(pageobj,"MediaBox",mbox);
return(pageobj);
}
开发者ID:chenkaigithub,项目名称:libk2pdfopt,代码行数:16,代码来源:wmupdf.c
示例15: pdf_load_name_tree
pdf_obj *
pdf_load_name_tree(pdf_document *xref, char *which)
{
fz_context *ctx = xref->ctx;
pdf_obj *root = pdf_dict_gets(xref->trailer, "Root");
pdf_obj *names = pdf_dict_gets(root, "Names");
pdf_obj *tree = pdf_dict_gets(names, which);
if (pdf_is_dict(tree))
{
pdf_obj *dict = pdf_new_dict(ctx, 100);
pdf_load_name_tree_imp(dict, xref, tree);
return dict;
}
return NULL;
}
开发者ID:AvinashKiran,项目名称:mupdf,代码行数:16,代码来源:pdf_nametree.c
示例16: page_merge
static void page_merge(int page_from, int page_to, pdf_graft_map *graft_map)
{
pdf_obj *page_ref;
pdf_obj *page_dict;
pdf_obj *obj;
pdf_obj *ref = NULL;
int i;
/* Copy as few key/value pairs as we can. Do not include items that reference other pages. */
static pdf_obj * const copy_list[] = { 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) };
fz_var(ref);
fz_try(ctx)
{
page_ref = pdf_lookup_page_obj(ctx, doc_src, page_from - 1);
pdf_flatten_inheritable_page_items(ctx, page_ref);
/* Make a new page object dictionary to hold the items we copy from the source page. */
page_dict = pdf_new_dict(ctx, doc_des, 4);
pdf_dict_put(ctx, page_dict, PDF_NAME(Type), PDF_NAME(Page));
for (i = 0; i < nelem(copy_list); i++)
{
obj = pdf_dict_get(ctx, page_ref, copy_list[i]);
if (obj != NULL)
pdf_dict_put_drop(ctx, page_dict, copy_list[i], pdf_graft_mapped_object(ctx, graft_map, obj));
}
/* Add the page object to the destination document. */
ref = pdf_add_object_drop(ctx, doc_des, page_dict);
/* Insert it into the page tree. */
pdf_insert_page(ctx, doc_des, page_to - 1, ref);
}
fz_always(ctx)
{
pdf_drop_obj(ctx, ref);
}
fz_catch(ctx)
{
fz_rethrow(ctx);
}
}
开发者ID:muennich,项目名称:mupdf,代码行数:47,代码来源:pdfmerge.c
示例17: juggler_impose_create_sheet
static ErrorCode juggler_impose_create_sheet(fz_context *ctx, pdf_document *dest_doc, int width, int height)
{
/* create and insert page to dest_doc */
fz_rect rect = { 0, 0, width, height };// { 0, 0, 1390, 1684 };
pdf_page *sheet = pdf_create_page(ctx, dest_doc, rect, 0, 0);
sheet->resources = pdf_new_dict(ctx, dest_doc, 16);
pdf_dict_puts(ctx, sheet->me, "Resources", sheet->resources); /* will be droped when freeing the page */
sheet->contents = pdf_new_array(ctx, dest_doc, 8);
pdf_dict_puts(ctx, sheet->me, "Contents", sheet->contents); /* will be droped when freeing the page */
pdf_insert_page(ctx, dest_doc, sheet, INT_MAX);
pdf_drop_page(ctx, sheet);
return(NoError);
}
开发者ID:s-k2,项目名称:Juggler,代码行数:17,代码来源:put-content.c
示例18: insert_resource_name
static void insert_resource_name(pdf_csi *csi, pdf_filter_state *state, const char *key, const char *name)
{
pdf_obj *xobj;
pdf_obj *obj;
if (!state->resources || !name || name[0] == 0)
return;
xobj = pdf_dict_gets(csi->rdb, key);
obj = pdf_dict_gets(xobj, name);
xobj = pdf_dict_gets(state->resources, key);
if (xobj == NULL) {
xobj = pdf_new_dict(csi->doc, 1);
pdf_dict_puts_drop(state->resources, key, xobj);
}
pdf_dict_putp(xobj, name, obj);
}
开发者ID:Andy-Amoy,项目名称:sumatrapdf,代码行数:18,代码来源:pdf-op-filter.c
示例19: pdf_copy_dict
pdf_obj *
pdf_copy_dict(fz_context *ctx, pdf_obj *obj)
{
pdf_obj *dict;
int i, n;
RESOLVE(obj);
if (!obj)
return NULL; /* Can't warn :( */
if (obj->kind != PDF_DICT)
fz_warn(ctx, "assert: not a dict (%s)", pdf_objkindstr(obj));
n = pdf_dict_len(obj);
dict = pdf_new_dict(ctx, n);
for (i = 0; i < n; i++)
fz_dict_put(dict, pdf_dict_get_key(obj, i), pdf_dict_get_val(obj, i));
return dict;
}
开发者ID:Ernest0x,项目名称:mupdf,代码行数:19,代码来源:base_object.c
示例20: new_stream_object
static int new_stream_object(pdf_document *xref,fz_context *ctx,char *buf)
{
int ref;
pdf_obj *obj,*len;
fz_buffer *fzbuf;
ref = pdf_create_object(xref);
obj = pdf_new_dict(ctx,1);
len=pdf_new_int(ctx,strlen(buf));
pdf_dict_puts(obj,"Length",len);
pdf_drop_obj(len);
pdf_update_object(xref,ref,obj);
pdf_drop_obj(obj);
fzbuf=fz_new_buffer(ctx,strlen(buf));
fz_write_buffer(ctx,fzbuf,(unsigned char *)buf,strlen(buf));
pdf_update_stream(xref,ref,fzbuf);
fz_drop_buffer(ctx,fzbuf);
return(ref);
}
开发者ID:chenkaigithub,项目名称:libk2pdfopt,代码行数:20,代码来源:wmupdf.c
注:本文中的pdf_new_dict函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论