diff options
Diffstat (limited to 'apps/pdfinfo.c')
-rw-r--r-- | apps/pdfinfo.c | 188 |
1 files changed, 94 insertions, 94 deletions
diff --git a/apps/pdfinfo.c b/apps/pdfinfo.c index 2006b0be..cf81105c 100644 --- a/apps/pdfinfo.c +++ b/apps/pdfinfo.c @@ -185,18 +185,18 @@ showglobalinfo(void) printf("\nPDF-%d.%d\n", xref->version / 10, xref->version % 10); - obj = fz_dict_gets(ctx, xref->trailer, "Info"); + obj = fz_dict_gets(xref->trailer, "Info"); if (obj) { printf("Info object (%d %d R):\n", fz_to_num(obj), fz_to_gen(obj)); - fz_debug_obj(ctx, fz_resolve_indirect(xref->ctx, obj)); + fz_debug_obj(fz_resolve_indirect(obj)); } - obj = fz_dict_gets(ctx, xref->trailer, "Encrypt"); + obj = fz_dict_gets(xref->trailer, "Encrypt"); if (obj) { printf("\nEncryption object (%d %d R):\n", fz_to_num(obj), fz_to_gen(obj)); - fz_debug_obj(ctx, fz_resolve_indirect(xref->ctx, obj)); + fz_debug_obj(fz_resolve_indirect(obj)); } printf("\nPages: %d\n\n", pagecount); @@ -209,8 +209,8 @@ gatherdimensions(int page, fz_obj *pageref, fz_obj *pageobj) fz_obj *obj; int j; - obj = fz_dict_gets(ctx, pageobj, "MediaBox"); - if (!fz_is_array(ctx, obj)) + obj = fz_dict_gets(pageobj, "MediaBox"); + if (!fz_is_array(obj)) return; bbox = pdf_to_rect(ctx, obj); @@ -239,7 +239,7 @@ gatherfonts(int page, fz_obj *pageref, fz_obj *pageobj, fz_obj *dict) { int i, n; - n = fz_dict_len(ctx, dict); + n = fz_dict_len(dict); for (i = 0; i < n; i++) { fz_obj *fontdict = NULL; @@ -248,17 +248,17 @@ gatherfonts(int page, fz_obj *pageref, fz_obj *pageobj, fz_obj *dict) fz_obj *name = NULL; int k; - fontdict = fz_dict_get_val(ctx, dict, i); - if (!fz_is_dict(ctx, fontdict)) + fontdict = fz_dict_get_val(dict, i); + if (!fz_is_dict(fontdict)) { fz_warn("not a font dict (%d %d R)", fz_to_num(fontdict), fz_to_gen(fontdict)); continue; } - subtype = fz_dict_gets(ctx, fontdict, "Subtype"); - basefont = fz_dict_gets(ctx, fontdict, "BaseFont"); - if (!basefont || fz_is_null(ctx, basefont)) - name = fz_dict_gets(ctx, fontdict, "Name"); + subtype = fz_dict_gets(fontdict, "Subtype"); + basefont = fz_dict_gets(fontdict, "BaseFont"); + if (!basefont || fz_is_null(basefont)) + name = fz_dict_gets(fontdict, "Name"); for (k = 0; k < fonts; k++) if (!fz_objcmp(font[k].u.font.obj, fontdict)) @@ -284,7 +284,7 @@ gatherimages(int page, fz_obj *pageref, fz_obj *pageobj, fz_obj *dict) { int i, n; - n = fz_dict_len(ctx, dict); + n = fz_dict_len(dict); for (i = 0; i < n; i++) { fz_obj *imagedict; @@ -297,37 +297,37 @@ gatherimages(int page, fz_obj *pageref, fz_obj *pageobj, fz_obj *dict) fz_obj *altcs; int k; - imagedict = fz_dict_get_val(ctx, dict, i); - if (!fz_is_dict(ctx, imagedict)) + imagedict = fz_dict_get_val(dict, i); + if (!fz_is_dict(imagedict)) { fz_warn("not an image dict (%d %d R)", fz_to_num(imagedict), fz_to_gen(imagedict)); continue; } - type = fz_dict_gets(ctx, imagedict, "Subtype"); - if (strcmp(fz_to_name(ctx, type), "Image")) + type = fz_dict_gets(imagedict, "Subtype"); + if (strcmp(fz_to_name(type), "Image")) continue; - filter = fz_dict_gets(ctx, imagedict, "Filter"); + filter = fz_dict_gets(imagedict, "Filter"); altcs = NULL; - cs = fz_dict_gets(ctx, imagedict, "ColorSpace"); - if (fz_is_array(ctx, cs)) + cs = fz_dict_gets(imagedict, "ColorSpace"); + if (fz_is_array(cs)) { fz_obj *cses = cs; - cs = fz_array_get(ctx, cses, 0); - if (fz_is_name(ctx, cs) && (!strcmp(fz_to_name(ctx, cs), "DeviceN") || !strcmp(fz_to_name(ctx, cs), "Separation"))) + cs = fz_array_get(cses, 0); + if (fz_is_name(cs) && (!strcmp(fz_to_name(cs), "DeviceN") || !strcmp(fz_to_name(cs), "Separation"))) { - altcs = fz_array_get(ctx, cses, 2); - if (fz_is_array(ctx, altcs)) - altcs = fz_array_get(ctx, altcs, 0); + altcs = fz_array_get(cses, 2); + if (fz_is_array(altcs)) + altcs = fz_array_get(altcs, 0); } } - width = fz_dict_gets(ctx, imagedict, "Width"); - height = fz_dict_gets(ctx, imagedict, "Height"); - bpc = fz_dict_gets(ctx, imagedict, "BitsPerComponent"); + width = fz_dict_gets(imagedict, "Width"); + height = fz_dict_gets(imagedict, "Height"); + bpc = fz_dict_gets(imagedict, "BitsPerComponent"); for (k = 0; k < images; k++) if (!fz_objcmp(image[k].u.image.obj, imagedict)) @@ -357,7 +357,7 @@ gatherforms(int page, fz_obj *pageref, fz_obj *pageobj, fz_obj *dict) { int i, n; - n = fz_dict_len(ctx, dict); + n = fz_dict_len(dict); for (i = 0; i < n; i++) { fz_obj *xobjdict; @@ -368,24 +368,24 @@ gatherforms(int page, fz_obj *pageref, fz_obj *pageobj, fz_obj *dict) fz_obj *reference; int k; - xobjdict = fz_dict_get_val(ctx, dict, i); - if (!fz_is_dict(ctx, xobjdict)) + xobjdict = fz_dict_get_val(dict, i); + if (!fz_is_dict(xobjdict)) { fz_warn("not a xobject dict (%d %d R)", fz_to_num(xobjdict), fz_to_gen(xobjdict)); continue; } - type = fz_dict_gets(ctx, xobjdict, "Subtype"); - if (strcmp(fz_to_name(ctx, type), "Form")) + type = fz_dict_gets(xobjdict, "Subtype"); + if (strcmp(fz_to_name(type), "Form")) continue; - subtype = fz_dict_gets(ctx, xobjdict, "Subtype2"); - if (!strcmp(fz_to_name(ctx, subtype), "PS")) + subtype = fz_dict_gets(xobjdict, "Subtype2"); + if (!strcmp(fz_to_name(subtype), "PS")) continue; - group = fz_dict_gets(ctx, xobjdict, "Group"); - groupsubtype = fz_dict_gets(ctx, group, "S"); - reference = fz_dict_gets(ctx, xobjdict, "Ref"); + group = fz_dict_gets(xobjdict, "Group"); + groupsubtype = fz_dict_gets(group, "S"); + reference = fz_dict_gets(xobjdict, "Ref"); for (k = 0; k < forms; k++) if (!fz_objcmp(form[k].u.form.obj, xobjdict)) @@ -411,7 +411,7 @@ gatherpsobjs(int page, fz_obj *pageref, fz_obj *pageobj, fz_obj *dict) { int i, n; - n = fz_dict_len(ctx, dict); + n = fz_dict_len(dict); for (i = 0; i < n; i++) { fz_obj *xobjdict; @@ -419,17 +419,17 @@ gatherpsobjs(int page, fz_obj *pageref, fz_obj *pageobj, fz_obj *dict) fz_obj *subtype; int k; - xobjdict = fz_dict_get_val(ctx, dict, i); - if (!fz_is_dict(ctx, xobjdict)) + xobjdict = fz_dict_get_val(dict, i); + if (!fz_is_dict(xobjdict)) { fz_warn("not a xobject dict (%d %d R)", fz_to_num(xobjdict), fz_to_gen(xobjdict)); continue; } - type = fz_dict_gets(ctx, xobjdict, "Subtype"); - subtype = fz_dict_gets(ctx, xobjdict, "Subtype2"); - if (strcmp(fz_to_name(ctx, type), "PS") && - (strcmp(fz_to_name(ctx, type), "Form") || strcmp(fz_to_name(ctx, subtype), "PS"))) + type = fz_dict_gets(xobjdict, "Subtype"); + subtype = fz_dict_gets(xobjdict, "Subtype2"); + if (strcmp(fz_to_name(type), "PS") && + (strcmp(fz_to_name(type), "Form") || strcmp(fz_to_name(subtype), "PS"))) continue; for (k = 0; k < psobjs; k++) @@ -454,22 +454,22 @@ gathershadings(int page, fz_obj *pageref, fz_obj *pageobj, fz_obj *dict) { int i, n; - n = fz_dict_len(ctx, dict); + n = fz_dict_len(dict); for (i = 0; i < n; i++) { fz_obj *shade; fz_obj *type; int k; - shade = fz_dict_get_val(ctx, dict, i); - if (!fz_is_dict(ctx, shade)) + shade = fz_dict_get_val(dict, i); + if (!fz_is_dict(shade)) { fz_warn("not a shading dict (%d %d R)", fz_to_num(shade), fz_to_gen(shade)); continue; } - type = fz_dict_gets(ctx, shade, "ShadingType"); - if (!fz_is_int(ctx, type) || fz_to_int(ctx, type) < 1 || fz_to_int(ctx, type) > 7) + type = fz_dict_gets(shade, "ShadingType"); + if (!fz_is_int(type) || fz_to_int(type) < 1 || fz_to_int(type) > 7) { fz_warn("not a shading type (%d %d R)", fz_to_num(shade), fz_to_gen(shade)); type = NULL; @@ -498,7 +498,7 @@ gatherpatterns(int page, fz_obj *pageref, fz_obj *pageobj, fz_obj *dict) { int i, n; - n = fz_dict_len(ctx, dict); + n = fz_dict_len(dict); for (i = 0; i < n; i++) { fz_obj *patterndict; @@ -508,31 +508,31 @@ gatherpatterns(int page, fz_obj *pageref, fz_obj *pageobj, fz_obj *dict) fz_obj *shading = NULL; int k; - patterndict = fz_dict_get_val(ctx, dict, i); - if (!fz_is_dict(ctx, patterndict)) + patterndict = fz_dict_get_val(dict, i); + if (!fz_is_dict(patterndict)) { fz_warn("not a pattern dict (%d %d R)", fz_to_num(patterndict), fz_to_gen(patterndict)); continue; } - type = fz_dict_gets(ctx, patterndict, "PatternType"); - if (!fz_is_int(ctx, type) || fz_to_int(ctx, type) < 1 || fz_to_int(ctx, type) > 2) + type = fz_dict_gets(patterndict, "PatternType"); + if (!fz_is_int(type) || fz_to_int(type) < 1 || fz_to_int(type) > 2) { fz_warn("not a pattern type (%d %d R)", fz_to_num(patterndict), fz_to_gen(patterndict)); type = NULL; } - if (fz_to_int(ctx, type) == 1) + if (fz_to_int(type) == 1) { - paint = fz_dict_gets(ctx, patterndict, "PaintType"); - if (!fz_is_int(ctx, paint) || fz_to_int(ctx, paint) < 1 || fz_to_int(ctx, paint) > 2) + paint = fz_dict_gets(patterndict, "PaintType"); + if (!fz_is_int(paint) || fz_to_int(paint) < 1 || fz_to_int(paint) > 2) { fz_warn("not a pattern paint type (%d %d R)", fz_to_num(patterndict), fz_to_gen(patterndict)); paint = NULL; } - tiling = fz_dict_gets(ctx, patterndict, "TilingType"); - if (!fz_is_int(ctx, tiling) || fz_to_int(ctx, tiling) < 1 || fz_to_int(ctx, tiling) > 3) + tiling = fz_dict_gets(patterndict, "TilingType"); + if (!fz_is_int(tiling) || fz_to_int(tiling) < 1 || fz_to_int(tiling) > 3) { fz_warn("not a pattern tiling type (%d %d R)", fz_to_num(patterndict), fz_to_gen(patterndict)); tiling = NULL; @@ -540,7 +540,7 @@ gatherpatterns(int page, fz_obj *pageref, fz_obj *pageobj, fz_obj *dict) } else { - shading = fz_dict_gets(ctx, patterndict, "Shading"); + shading = fz_dict_gets(patterndict, "Shading"); } for (k = 0; k < patterns; k++) @@ -582,24 +582,24 @@ gatherresourceinfo(int page, fz_obj *rsrc) if (!pageobj) die(fz_error_make("cannot retrieve info from page %d", page)); - font = fz_dict_gets(ctx, rsrc, "Font"); + font = fz_dict_gets(rsrc, "Font"); if (font) { int n; gatherfonts(page, pageref, pageobj, font); - n = fz_dict_len(ctx, font); + n = fz_dict_len(font); for (i = 0; i < n; i++) { - fz_obj *obj = fz_dict_get_val(ctx, font, i); + fz_obj *obj = fz_dict_get_val(font, i); - subrsrc = fz_dict_gets(ctx, obj, "Resources"); + subrsrc = fz_dict_gets(obj, "Resources"); if (subrsrc && fz_objcmp(rsrc, subrsrc)) gatherresourceinfo(page, subrsrc); } } - xobj = fz_dict_gets(ctx, rsrc, "XObject"); + xobj = fz_dict_gets(rsrc, "XObject"); if (xobj) { int n; @@ -607,30 +607,30 @@ gatherresourceinfo(int page, fz_obj *rsrc) gatherimages(page, pageref, pageobj, xobj); gatherforms(page, pageref, pageobj, xobj); gatherpsobjs(page, pageref, pageobj, xobj); - n = fz_dict_len(ctx, xobj); + n = fz_dict_len(xobj); for (i = 0; i < n; i++) { - fz_obj *obj = fz_dict_get_val(ctx, xobj, i); - subrsrc = fz_dict_gets(ctx, obj, "Resources"); + fz_obj *obj = fz_dict_get_val(xobj, i); + subrsrc = fz_dict_gets(obj, "Resources"); if (subrsrc && fz_objcmp(rsrc, subrsrc)) gatherresourceinfo(page, subrsrc); } } - shade = fz_dict_gets(ctx, rsrc, "Shading"); + shade = fz_dict_gets(rsrc, "Shading"); if (shade) gathershadings(page, pageref, pageobj, shade); - pattern = fz_dict_gets(ctx, rsrc, "Pattern"); + pattern = fz_dict_gets(rsrc, "Pattern"); if (pattern) { int n; gatherpatterns(page, pageref, pageobj, pattern); - n = fz_dict_len(ctx, pattern); + n = fz_dict_len(pattern); for (i = 0; i < n; i++) { - fz_obj *obj = fz_dict_get_val(ctx, pattern, i); - subrsrc = fz_dict_gets(ctx, obj, "Resources"); + fz_obj *obj = fz_dict_get_val(pattern, i); + subrsrc = fz_dict_gets(obj, "Resources"); if (subrsrc && fz_objcmp(rsrc, subrsrc)) gatherresourceinfo(page, subrsrc); } @@ -652,7 +652,7 @@ gatherpageinfo(int page) gatherdimensions(page, pageref, pageobj); - rsrc = fz_dict_gets(ctx, pageobj, "Resources"); + rsrc = fz_dict_gets(pageobj, "Resources"); gatherresourceinfo(page, rsrc); } @@ -688,8 +688,8 @@ printinfo(char *filename, int show, int page) printf(PAGE_FMT "%s '%s' (%d %d R)\n", font[i].page, fz_to_num(font[i].pageref), fz_to_gen(font[i].pageref), - fz_to_name(ctx, font[i].u.font.subtype), - fz_to_name(ctx, font[i].u.font.name), + fz_to_name(font[i].u.font.subtype), + fz_to_name(font[i].u.font.name), fz_to_num(font[i].u.font.obj), fz_to_gen(font[i].u.font.obj)); } printf("\n"); @@ -707,27 +707,27 @@ printinfo(char *filename, int show, int page) image[i].page, fz_to_num(image[i].pageref), fz_to_gen(image[i].pageref)); - if (fz_is_array(ctx, image[i].u.image.filter)) + if (fz_is_array(image[i].u.image.filter)) { - int n = fz_array_len(ctx, image[i].u.image.filter); + int n = fz_array_len(image[i].u.image.filter); for (j = 0; j < n; j++) { - fz_obj *obj = fz_array_get(ctx, image[i].u.image.filter, j); - char *filter = fz_strdup(ctx, fz_to_name(ctx, obj)); + fz_obj *obj = fz_array_get(image[i].u.image.filter, j); + char *filter = fz_strdup(ctx, fz_to_name(obj)); if (strstr(filter, "Decode")) *(strstr(filter, "Decode")) = '\0'; printf("%s%s", filter, - j == fz_array_len(ctx, image[i].u.image.filter) - 1 ? "" : " "); + j == fz_array_len(image[i].u.image.filter) - 1 ? "" : " "); fz_free(ctx, filter); } } else if (image[i].u.image.filter) { fz_obj *obj = image[i].u.image.filter; - char *filter = fz_strdup(ctx, fz_to_name(ctx, obj)); + char *filter = fz_strdup(ctx, fz_to_name(obj)); if (strstr(filter, "Decode")) *(strstr(filter, "Decode")) = '\0'; @@ -740,7 +740,7 @@ printinfo(char *filename, int show, int page) if (image[i].u.image.cs) { - cs = fz_strdup(ctx, fz_to_name(ctx, image[i].u.image.cs)); + cs = fz_strdup(ctx, fz_to_name(image[i].u.image.cs)); if (!strncmp(cs, "Device", 6)) { @@ -759,7 +759,7 @@ printinfo(char *filename, int show, int page) } if (image[i].u.image.altcs) { - altcs = fz_strdup(ctx, fz_to_name(ctx, image[i].u.image.altcs)); + altcs = fz_strdup(ctx, fz_to_name(image[i].u.image.altcs)); if (!strncmp(altcs, "Device", 6)) { @@ -778,9 +778,9 @@ printinfo(char *filename, int show, int page) } printf(" ] %dx%d %dbpc %s%s%s (%d %d R)\n", - fz_to_int(ctx, image[i].u.image.width), - fz_to_int(ctx, image[i].u.image.height), - image[i].u.image.bpc ? fz_to_int(ctx, image[i].u.image.bpc) : 1, + fz_to_int(image[i].u.image.width), + fz_to_int(image[i].u.image.height), + image[i].u.image.bpc ? fz_to_int(image[i].u.image.bpc) : 1, image[i].u.image.cs ? cs : "ImageMask", image[i].u.image.altcs ? " " : "", image[i].u.image.altcs ? altcs : "", @@ -812,7 +812,7 @@ printinfo(char *filename, int show, int page) printf(PAGE_FMT "%s (%d %d R)\n", shading[i].page, fz_to_num(shading[i].pageref), fz_to_gen(shading[i].pageref), - shadingtype[fz_to_int(ctx, shading[i].u.shading.type)], + shadingtype[fz_to_int(shading[i].u.shading.type)], fz_to_num(shading[i].u.shading.obj), fz_to_gen(shading[i].u.shading.obj)); } printf("\n"); @@ -823,7 +823,7 @@ printinfo(char *filename, int show, int page) printf("Patterns (%d):\n", patterns); for (i = 0; i < patterns; i++) { - if (fz_to_int(ctx, pattern[i].u.pattern.type) == 1) + if (fz_to_int(pattern[i].u.pattern.type) == 1) { char *painttype[] = { @@ -842,8 +842,8 @@ printinfo(char *filename, int show, int page) printf(PAGE_FMT "Tiling %s %s (%d %d R)\n", pattern[i].page, fz_to_num(pattern[i].pageref), fz_to_gen(pattern[i].pageref), - painttype[fz_to_int(ctx, pattern[i].u.pattern.paint)], - tilingtype[fz_to_int(ctx, pattern[i].u.pattern.tiling)], + painttype[fz_to_int(pattern[i].u.pattern.paint)], + tilingtype[fz_to_int(pattern[i].u.pattern.tiling)], fz_to_num(pattern[i].u.pattern.obj), fz_to_gen(pattern[i].u.pattern.obj)); } else @@ -867,7 +867,7 @@ printinfo(char *filename, int show, int page) form[i].page, fz_to_num(form[i].pageref), fz_to_gen(form[i].pageref), form[i].u.form.groupsubtype ? " " : "", - form[i].u.form.groupsubtype ? fz_to_name(ctx, form[i].u.form.groupsubtype) : "", + form[i].u.form.groupsubtype ? fz_to_name(form[i].u.form.groupsubtype) : "", form[i].u.form.groupsubtype ? " Group" : "", form[i].u.form.reference ? " Reference" : "", fz_to_num(form[i].u.form.obj), fz_to_gen(form[i].u.form.obj)); |