summaryrefslogtreecommitdiff
path: root/apps/mupdfinfo.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/mupdfinfo.c')
-rw-r--r--apps/mupdfinfo.c416
1 files changed, 208 insertions, 208 deletions
diff --git a/apps/mupdfinfo.c b/apps/mupdfinfo.c
index 3c98c772..e02d8d1a 100644
--- a/apps/mupdfinfo.c
+++ b/apps/mupdfinfo.c
@@ -4,7 +4,7 @@
*/
#include "fitz.h"
-#include "mupdf.h"
+#include "mupdf-internal.h"
pdf_document *xref;
fz_context *ctx;
@@ -28,48 +28,48 @@ enum
struct info
{
int page;
- fz_obj *pageref;
- fz_obj *pageobj;
+ pdf_obj *pageref;
+ pdf_obj *pageobj;
union {
struct {
- fz_obj *obj;
+ pdf_obj *obj;
} info;
struct {
- fz_obj *obj;
+ pdf_obj *obj;
} crypt;
struct {
- fz_obj *obj;
+ pdf_obj *obj;
fz_rect *bbox;
} dim;
struct {
- fz_obj *obj;
- fz_obj *subtype;
- fz_obj *name;
+ pdf_obj *obj;
+ pdf_obj *subtype;
+ pdf_obj *name;
} font;
struct {
- fz_obj *obj;
- fz_obj *width;
- fz_obj *height;
- fz_obj *bpc;
- fz_obj *filter;
- fz_obj *cs;
- fz_obj *altcs;
+ pdf_obj *obj;
+ pdf_obj *width;
+ pdf_obj *height;
+ pdf_obj *bpc;
+ pdf_obj *filter;
+ pdf_obj *cs;
+ pdf_obj *altcs;
} image;
struct {
- fz_obj *obj;
- fz_obj *type;
+ pdf_obj *obj;
+ pdf_obj *type;
} shading;
struct {
- fz_obj *obj;
- fz_obj *type;
- fz_obj *paint;
- fz_obj *tiling;
- fz_obj *shading;
+ pdf_obj *obj;
+ pdf_obj *type;
+ pdf_obj *paint;
+ pdf_obj *tiling;
+ pdf_obj *shading;
} pattern;
struct {
- fz_obj *obj;
- fz_obj *groupsubtype;
- fz_obj *reference;
+ pdf_obj *obj;
+ pdf_obj *groupsubtype;
+ pdf_obj *reference;
} form;
} u;
};
@@ -168,36 +168,36 @@ infousage(void)
static void
showglobalinfo(void)
{
- fz_obj *obj;
+ pdf_obj *obj;
printf("\nPDF-%d.%d\n", xref->version / 10, xref->version % 10);
- obj = fz_dict_gets(xref->trailer, "Info");
+ obj = pdf_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(fz_resolve_indirect(obj));
+ printf("Info object (%d %d R):\n", pdf_to_num(obj), pdf_to_gen(obj));
+ pdf_print_obj(pdf_resolve_indirect(obj));
}
- obj = fz_dict_gets(xref->trailer, "Encrypt");
+ obj = pdf_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(fz_resolve_indirect(obj));
+ printf("\nEncryption object (%d %d R):\n", pdf_to_num(obj), pdf_to_gen(obj));
+ pdf_print_obj(pdf_resolve_indirect(obj));
}
printf("\nPages: %d\n\n", pagecount);
}
static void
-gatherdimensions(int page, fz_obj *pageref, fz_obj *pageobj)
+gatherdimensions(int page, pdf_obj *pageref, pdf_obj *pageobj)
{
fz_rect bbox;
- fz_obj *obj;
+ pdf_obj *obj;
int j;
- obj = fz_dict_gets(pageobj, "MediaBox");
- if (!fz_is_array(obj))
+ obj = pdf_dict_gets(pageobj, "MediaBox");
+ if (!pdf_is_array(obj))
return;
bbox = pdf_to_rect(ctx, obj);
@@ -222,33 +222,33 @@ gatherdimensions(int page, fz_obj *pageref, fz_obj *pageobj)
}
static void
-gatherfonts(int page, fz_obj *pageref, fz_obj *pageobj, fz_obj *dict)
+gatherfonts(int page, pdf_obj *pageref, pdf_obj *pageobj, pdf_obj *dict)
{
int i, n;
- n = fz_dict_len(dict);
+ n = pdf_dict_len(dict);
for (i = 0; i < n; i++)
{
- fz_obj *fontdict = NULL;
- fz_obj *subtype = NULL;
- fz_obj *basefont = NULL;
- fz_obj *name = NULL;
+ pdf_obj *fontdict = NULL;
+ pdf_obj *subtype = NULL;
+ pdf_obj *basefont = NULL;
+ pdf_obj *name = NULL;
int k;
- fontdict = fz_dict_get_val(dict, i);
- if (!fz_is_dict(fontdict))
+ fontdict = pdf_dict_get_val(dict, i);
+ if (!pdf_is_dict(fontdict))
{
- fz_warn(ctx, "not a font dict (%d %d R)", fz_to_num(fontdict), fz_to_gen(fontdict));
+ fz_warn(ctx, "not a font dict (%d %d R)", pdf_to_num(fontdict), pdf_to_gen(fontdict));
continue;
}
- subtype = fz_dict_gets(fontdict, "Subtype");
- basefont = fz_dict_gets(fontdict, "BaseFont");
- if (!basefont || fz_is_null(basefont))
- name = fz_dict_gets(fontdict, "Name");
+ subtype = pdf_dict_gets(fontdict, "Subtype");
+ basefont = pdf_dict_gets(fontdict, "BaseFont");
+ if (!basefont || pdf_is_null(basefont))
+ name = pdf_dict_gets(fontdict, "Name");
for (k = 0; k < fonts; k++)
- if (!fz_objcmp(font[k].u.font.obj, fontdict))
+ if (!pdf_objcmp(font[k].u.font.obj, fontdict))
break;
if (k < fonts)
@@ -267,57 +267,57 @@ gatherfonts(int page, fz_obj *pageref, fz_obj *pageobj, fz_obj *dict)
}
static void
-gatherimages(int page, fz_obj *pageref, fz_obj *pageobj, fz_obj *dict)
+gatherimages(int page, pdf_obj *pageref, pdf_obj *pageobj, pdf_obj *dict)
{
int i, n;
- n = fz_dict_len(dict);
+ n = pdf_dict_len(dict);
for (i = 0; i < n; i++)
{
- fz_obj *imagedict;
- fz_obj *type;
- fz_obj *width;
- fz_obj *height;
- fz_obj *bpc = NULL;
- fz_obj *filter = NULL;
- fz_obj *cs = NULL;
- fz_obj *altcs;
+ pdf_obj *imagedict;
+ pdf_obj *type;
+ pdf_obj *width;
+ pdf_obj *height;
+ pdf_obj *bpc = NULL;
+ pdf_obj *filter = NULL;
+ pdf_obj *cs = NULL;
+ pdf_obj *altcs;
int k;
- imagedict = fz_dict_get_val(dict, i);
- if (!fz_is_dict(imagedict))
+ imagedict = pdf_dict_get_val(dict, i);
+ if (!pdf_is_dict(imagedict))
{
- fz_warn(ctx, "not an image dict (%d %d R)", fz_to_num(imagedict), fz_to_gen(imagedict));
+ fz_warn(ctx, "not an image dict (%d %d R)", pdf_to_num(imagedict), pdf_to_gen(imagedict));
continue;
}
- type = fz_dict_gets(imagedict, "Subtype");
- if (strcmp(fz_to_name(type), "Image"))
+ type = pdf_dict_gets(imagedict, "Subtype");
+ if (strcmp(pdf_to_name(type), "Image"))
continue;
- filter = fz_dict_gets(imagedict, "Filter");
+ filter = pdf_dict_gets(imagedict, "Filter");
altcs = NULL;
- cs = fz_dict_gets(imagedict, "ColorSpace");
- if (fz_is_array(cs))
+ cs = pdf_dict_gets(imagedict, "ColorSpace");
+ if (pdf_is_array(cs))
{
- fz_obj *cses = cs;
+ pdf_obj *cses = cs;
- cs = fz_array_get(cses, 0);
- if (fz_is_name(cs) && (!strcmp(fz_to_name(cs), "DeviceN") || !strcmp(fz_to_name(cs), "Separation")))
+ cs = pdf_array_get(cses, 0);
+ if (pdf_is_name(cs) && (!strcmp(pdf_to_name(cs), "DeviceN") || !strcmp(pdf_to_name(cs), "Separation")))
{
- altcs = fz_array_get(cses, 2);
- if (fz_is_array(altcs))
- altcs = fz_array_get(altcs, 0);
+ altcs = pdf_array_get(cses, 2);
+ if (pdf_is_array(altcs))
+ altcs = pdf_array_get(altcs, 0);
}
}
- width = fz_dict_gets(imagedict, "Width");
- height = fz_dict_gets(imagedict, "Height");
- bpc = fz_dict_gets(imagedict, "BitsPerComponent");
+ width = pdf_dict_gets(imagedict, "Width");
+ height = pdf_dict_gets(imagedict, "Height");
+ bpc = pdf_dict_gets(imagedict, "BitsPerComponent");
for (k = 0; k < images; k++)
- if (!fz_objcmp(image[k].u.image.obj, imagedict))
+ if (!pdf_objcmp(image[k].u.image.obj, imagedict))
break;
if (k < images)
@@ -340,42 +340,42 @@ gatherimages(int page, fz_obj *pageref, fz_obj *pageobj, fz_obj *dict)
}
static void
-gatherforms(int page, fz_obj *pageref, fz_obj *pageobj, fz_obj *dict)
+gatherforms(int page, pdf_obj *pageref, pdf_obj *pageobj, pdf_obj *dict)
{
int i, n;
- n = fz_dict_len(dict);
+ n = pdf_dict_len(dict);
for (i = 0; i < n; i++)
{
- fz_obj *xobjdict;
- fz_obj *type;
- fz_obj *subtype;
- fz_obj *group;
- fz_obj *groupsubtype;
- fz_obj *reference;
+ pdf_obj *xobjdict;
+ pdf_obj *type;
+ pdf_obj *subtype;
+ pdf_obj *group;
+ pdf_obj *groupsubtype;
+ pdf_obj *reference;
int k;
- xobjdict = fz_dict_get_val(dict, i);
- if (!fz_is_dict(xobjdict))
+ xobjdict = pdf_dict_get_val(dict, i);
+ if (!pdf_is_dict(xobjdict))
{
- fz_warn(ctx, "not a xobject dict (%d %d R)", fz_to_num(xobjdict), fz_to_gen(xobjdict));
+ fz_warn(ctx, "not a xobject dict (%d %d R)", pdf_to_num(xobjdict), pdf_to_gen(xobjdict));
continue;
}
- type = fz_dict_gets(xobjdict, "Subtype");
- if (strcmp(fz_to_name(type), "Form"))
+ type = pdf_dict_gets(xobjdict, "Subtype");
+ if (strcmp(pdf_to_name(type), "Form"))
continue;
- subtype = fz_dict_gets(xobjdict, "Subtype2");
- if (!strcmp(fz_to_name(subtype), "PS"))
+ subtype = pdf_dict_gets(xobjdict, "Subtype2");
+ if (!strcmp(pdf_to_name(subtype), "PS"))
continue;
- group = fz_dict_gets(xobjdict, "Group");
- groupsubtype = fz_dict_gets(group, "S");
- reference = fz_dict_gets(xobjdict, "Ref");
+ group = pdf_dict_gets(xobjdict, "Group");
+ groupsubtype = pdf_dict_gets(group, "S");
+ reference = pdf_dict_gets(xobjdict, "Ref");
for (k = 0; k < forms; k++)
- if (!fz_objcmp(form[k].u.form.obj, xobjdict))
+ if (!pdf_objcmp(form[k].u.form.obj, xobjdict))
break;
if (k < forms)
@@ -394,33 +394,33 @@ gatherforms(int page, fz_obj *pageref, fz_obj *pageobj, fz_obj *dict)
}
static void
-gatherpsobjs(int page, fz_obj *pageref, fz_obj *pageobj, fz_obj *dict)
+gatherpsobjs(int page, pdf_obj *pageref, pdf_obj *pageobj, pdf_obj *dict)
{
int i, n;
- n = fz_dict_len(dict);
+ n = pdf_dict_len(dict);
for (i = 0; i < n; i++)
{
- fz_obj *xobjdict;
- fz_obj *type;
- fz_obj *subtype;
+ pdf_obj *xobjdict;
+ pdf_obj *type;
+ pdf_obj *subtype;
int k;
- xobjdict = fz_dict_get_val(dict, i);
- if (!fz_is_dict(xobjdict))
+ xobjdict = pdf_dict_get_val(dict, i);
+ if (!pdf_is_dict(xobjdict))
{
- fz_warn(ctx, "not a xobject dict (%d %d R)", fz_to_num(xobjdict), fz_to_gen(xobjdict));
+ fz_warn(ctx, "not a xobject dict (%d %d R)", pdf_to_num(xobjdict), pdf_to_gen(xobjdict));
continue;
}
- 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")))
+ type = pdf_dict_gets(xobjdict, "Subtype");
+ subtype = pdf_dict_gets(xobjdict, "Subtype2");
+ if (strcmp(pdf_to_name(type), "PS") &&
+ (strcmp(pdf_to_name(type), "Form") || strcmp(pdf_to_name(subtype), "PS")))
continue;
for (k = 0; k < psobjs; k++)
- if (!fz_objcmp(psobj[k].u.form.obj, xobjdict))
+ if (!pdf_objcmp(psobj[k].u.form.obj, xobjdict))
break;
if (k < psobjs)
@@ -437,33 +437,33 @@ gatherpsobjs(int page, fz_obj *pageref, fz_obj *pageobj, fz_obj *dict)
}
static void
-gathershadings(int page, fz_obj *pageref, fz_obj *pageobj, fz_obj *dict)
+gathershadings(int page, pdf_obj *pageref, pdf_obj *pageobj, pdf_obj *dict)
{
int i, n;
- n = fz_dict_len(dict);
+ n = pdf_dict_len(dict);
for (i = 0; i < n; i++)
{
- fz_obj *shade;
- fz_obj *type;
+ pdf_obj *shade;
+ pdf_obj *type;
int k;
- shade = fz_dict_get_val(dict, i);
- if (!fz_is_dict(shade))
+ shade = pdf_dict_get_val(dict, i);
+ if (!pdf_is_dict(shade))
{
- fz_warn(ctx, "not a shading dict (%d %d R)", fz_to_num(shade), fz_to_gen(shade));
+ fz_warn(ctx, "not a shading dict (%d %d R)", pdf_to_num(shade), pdf_to_gen(shade));
continue;
}
- type = fz_dict_gets(shade, "ShadingType");
- if (!fz_is_int(type) || fz_to_int(type) < 1 || fz_to_int(type) > 7)
+ type = pdf_dict_gets(shade, "ShadingType");
+ if (!pdf_is_int(type) || pdf_to_int(type) < 1 || pdf_to_int(type) > 7)
{
- fz_warn(ctx, "not a shading type (%d %d R)", fz_to_num(shade), fz_to_gen(shade));
+ fz_warn(ctx, "not a shading type (%d %d R)", pdf_to_num(shade), pdf_to_gen(shade));
type = NULL;
}
for (k = 0; k < shadings; k++)
- if (!fz_objcmp(shading[k].u.shading.obj, shade))
+ if (!pdf_objcmp(shading[k].u.shading.obj, shade))
break;
if (k < shadings)
@@ -481,57 +481,57 @@ gathershadings(int page, fz_obj *pageref, fz_obj *pageobj, fz_obj *dict)
}
static void
-gatherpatterns(int page, fz_obj *pageref, fz_obj *pageobj, fz_obj *dict)
+gatherpatterns(int page, pdf_obj *pageref, pdf_obj *pageobj, pdf_obj *dict)
{
int i, n;
- n = fz_dict_len(dict);
+ n = pdf_dict_len(dict);
for (i = 0; i < n; i++)
{
- fz_obj *patterndict;
- fz_obj *type;
- fz_obj *paint = NULL;
- fz_obj *tiling = NULL;
- fz_obj *shading = NULL;
+ pdf_obj *patterndict;
+ pdf_obj *type;
+ pdf_obj *paint = NULL;
+ pdf_obj *tiling = NULL;
+ pdf_obj *shading = NULL;
int k;
- patterndict = fz_dict_get_val(dict, i);
- if (!fz_is_dict(patterndict))
+ patterndict = pdf_dict_get_val(dict, i);
+ if (!pdf_is_dict(patterndict))
{
- fz_warn(ctx, "not a pattern dict (%d %d R)", fz_to_num(patterndict), fz_to_gen(patterndict));
+ fz_warn(ctx, "not a pattern dict (%d %d R)", pdf_to_num(patterndict), pdf_to_gen(patterndict));
continue;
}
- type = fz_dict_gets(patterndict, "PatternType");
- if (!fz_is_int(type) || fz_to_int(type) < 1 || fz_to_int(type) > 2)
+ type = pdf_dict_gets(patterndict, "PatternType");
+ if (!pdf_is_int(type) || pdf_to_int(type) < 1 || pdf_to_int(type) > 2)
{
- fz_warn(ctx, "not a pattern type (%d %d R)", fz_to_num(patterndict), fz_to_gen(patterndict));
+ fz_warn(ctx, "not a pattern type (%d %d R)", pdf_to_num(patterndict), pdf_to_gen(patterndict));
type = NULL;
}
- if (fz_to_int(type) == 1)
+ if (pdf_to_int(type) == 1)
{
- paint = fz_dict_gets(patterndict, "PaintType");
- if (!fz_is_int(paint) || fz_to_int(paint) < 1 || fz_to_int(paint) > 2)
+ paint = pdf_dict_gets(patterndict, "PaintType");
+ if (!pdf_is_int(paint) || pdf_to_int(paint) < 1 || pdf_to_int(paint) > 2)
{
- fz_warn(ctx, "not a pattern paint type (%d %d R)", fz_to_num(patterndict), fz_to_gen(patterndict));
+ fz_warn(ctx, "not a pattern paint type (%d %d R)", pdf_to_num(patterndict), pdf_to_gen(patterndict));
paint = NULL;
}
- tiling = fz_dict_gets(patterndict, "TilingType");
- if (!fz_is_int(tiling) || fz_to_int(tiling) < 1 || fz_to_int(tiling) > 3)
+ tiling = pdf_dict_gets(patterndict, "TilingType");
+ if (!pdf_is_int(tiling) || pdf_to_int(tiling) < 1 || pdf_to_int(tiling) > 3)
{
- fz_warn(ctx, "not a pattern tiling type (%d %d R)", fz_to_num(patterndict), fz_to_gen(patterndict));
+ fz_warn(ctx, "not a pattern tiling type (%d %d R)", pdf_to_num(patterndict), pdf_to_gen(patterndict));
tiling = NULL;
}
}
else
{
- shading = fz_dict_gets(patterndict, "Shading");
+ shading = pdf_dict_gets(patterndict, "Shading");
}
for (k = 0; k < patterns; k++)
- if (!fz_objcmp(pattern[k].u.pattern.obj, patterndict))
+ if (!pdf_objcmp(pattern[k].u.pattern.obj, patterndict))
break;
if (k < patterns)
@@ -552,15 +552,15 @@ gatherpatterns(int page, fz_obj *pageref, fz_obj *pageobj, fz_obj *dict)
}
static void
-gatherresourceinfo(int page, fz_obj *rsrc)
+gatherresourceinfo(int page, pdf_obj *rsrc)
{
- fz_obj *pageobj;
- fz_obj *pageref;
- fz_obj *font;
- fz_obj *xobj;
- fz_obj *shade;
- fz_obj *pattern;
- fz_obj *subrsrc;
+ pdf_obj *pageobj;
+ pdf_obj *pageref;
+ pdf_obj *font;
+ pdf_obj *xobj;
+ pdf_obj *shade;
+ pdf_obj *pattern;
+ pdf_obj *subrsrc;
int i;
pageobj = xref->page_objs[page-1];
@@ -569,24 +569,24 @@ gatherresourceinfo(int page, fz_obj *rsrc)
if (!pageobj)
fz_throw(ctx, "cannot retrieve info from page %d", page);
- font = fz_dict_gets(rsrc, "Font");
+ font = pdf_dict_gets(rsrc, "Font");
if (font)
{
int n;
gatherfonts(page, pageref, pageobj, font);
- n = fz_dict_len(font);
+ n = pdf_dict_len(font);
for (i = 0; i < n; i++)
{
- fz_obj *obj = fz_dict_get_val(font, i);
+ pdf_obj *obj = pdf_dict_get_val(font, i);
- subrsrc = fz_dict_gets(obj, "Resources");
- if (subrsrc && fz_objcmp(rsrc, subrsrc))
+ subrsrc = pdf_dict_gets(obj, "Resources");
+ if (subrsrc && pdf_objcmp(rsrc, subrsrc))
gatherresourceinfo(page, subrsrc);
}
}
- xobj = fz_dict_gets(rsrc, "XObject");
+ xobj = pdf_dict_gets(rsrc, "XObject");
if (xobj)
{
int n;
@@ -594,31 +594,31 @@ 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(xobj);
+ n = pdf_dict_len(xobj);
for (i = 0; i < n; i++)
{
- fz_obj *obj = fz_dict_get_val(xobj, i);
- subrsrc = fz_dict_gets(obj, "Resources");
- if (subrsrc && fz_objcmp(rsrc, subrsrc))
+ pdf_obj *obj = pdf_dict_get_val(xobj, i);
+ subrsrc = pdf_dict_gets(obj, "Resources");
+ if (subrsrc && pdf_objcmp(rsrc, subrsrc))
gatherresourceinfo(page, subrsrc);
}
}
- shade = fz_dict_gets(rsrc, "Shading");
+ shade = pdf_dict_gets(rsrc, "Shading");
if (shade)
gathershadings(page, pageref, pageobj, shade);
- pattern = fz_dict_gets(rsrc, "Pattern");
+ pattern = pdf_dict_gets(rsrc, "Pattern");
if (pattern)
{
int n;
gatherpatterns(page, pageref, pageobj, pattern);
- n = fz_dict_len(pattern);
+ n = pdf_dict_len(pattern);
for (i = 0; i < n; i++)
{
- fz_obj *obj = fz_dict_get_val(pattern, i);
- subrsrc = fz_dict_gets(obj, "Resources");
- if (subrsrc && fz_objcmp(rsrc, subrsrc))
+ pdf_obj *obj = pdf_dict_get_val(pattern, i);
+ subrsrc = pdf_dict_gets(obj, "Resources");
+ if (subrsrc && pdf_objcmp(rsrc, subrsrc))
gatherresourceinfo(page, subrsrc);
}
}
@@ -627,9 +627,9 @@ gatherresourceinfo(int page, fz_obj *rsrc)
static void
gatherpageinfo(int page)
{
- fz_obj *pageobj;
- fz_obj *pageref;
- fz_obj *rsrc;
+ pdf_obj *pageobj;
+ pdf_obj *pageref;
+ pdf_obj *rsrc;
pageobj = xref->page_objs[page-1];
pageref = xref->page_refs[page-1];
@@ -639,7 +639,7 @@ gatherpageinfo(int page)
gatherdimensions(page, pageref, pageobj);
- rsrc = fz_dict_gets(pageobj, "Resources");
+ rsrc = pdf_dict_gets(pageobj, "Resources");
gatherresourceinfo(page, rsrc);
}
@@ -658,7 +658,7 @@ printinfo(char *filename, int show, int page)
{
printf(PAGE_FMT "[ %g %g %g %g ]\n",
dim[i].page,
- fz_to_num(dim[i].pageref), fz_to_gen(dim[i].pageref),
+ pdf_to_num(dim[i].pageref), pdf_to_gen(dim[i].pageref),
dim[i].u.dim.bbox->x0,
dim[i].u.dim.bbox->y0,
dim[i].u.dim.bbox->x1,
@@ -674,10 +674,10 @@ 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(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));
+ pdf_to_num(font[i].pageref), pdf_to_gen(font[i].pageref),
+ pdf_to_name(font[i].u.font.subtype),
+ pdf_to_name(font[i].u.font.name),
+ pdf_to_num(font[i].u.font.obj), pdf_to_gen(font[i].u.font.obj));
}
printf("\n");
}
@@ -692,29 +692,29 @@ printinfo(char *filename, int show, int page)
printf(PAGE_FMT "[ ",
image[i].page,
- fz_to_num(image[i].pageref), fz_to_gen(image[i].pageref));
+ pdf_to_num(image[i].pageref), pdf_to_gen(image[i].pageref));
- if (fz_is_array(image[i].u.image.filter))
+ if (pdf_is_array(image[i].u.image.filter))
{
- int n = fz_array_len(image[i].u.image.filter);
+ int n = pdf_array_len(image[i].u.image.filter);
for (j = 0; j < n; j++)
{
- fz_obj *obj = fz_array_get(image[i].u.image.filter, j);
- char *filter = fz_strdup(ctx, fz_to_name(obj));
+ pdf_obj *obj = pdf_array_get(image[i].u.image.filter, j);
+ char *filter = fz_strdup(ctx, pdf_to_name(obj));
if (strstr(filter, "Decode"))
*(strstr(filter, "Decode")) = '\0';
printf("%s%s",
filter,
- j == fz_array_len(image[i].u.image.filter) - 1 ? "" : " ");
+ j == pdf_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(obj));
+ pdf_obj *obj = image[i].u.image.filter;
+ char *filter = fz_strdup(ctx, pdf_to_name(obj));
if (strstr(filter, "Decode"))
*(strstr(filter, "Decode")) = '\0';
@@ -727,7 +727,7 @@ printinfo(char *filename, int show, int page)
if (image[i].u.image.cs)
{
- cs = fz_strdup(ctx, fz_to_name(image[i].u.image.cs));
+ cs = fz_strdup(ctx, pdf_to_name(image[i].u.image.cs));
if (!strncmp(cs, "Device", 6))
{
@@ -746,7 +746,7 @@ printinfo(char *filename, int show, int page)
}
if (image[i].u.image.altcs)
{
- altcs = fz_strdup(ctx, fz_to_name(image[i].u.image.altcs));
+ altcs = fz_strdup(ctx, pdf_to_name(image[i].u.image.altcs));
if (!strncmp(altcs, "Device", 6))
{
@@ -765,13 +765,13 @@ printinfo(char *filename, int show, int page)
}
printf(" ] %dx%d %dbpc %s%s%s (%d %d R)\n",
- 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,
+ pdf_to_int(image[i].u.image.width),
+ pdf_to_int(image[i].u.image.height),
+ image[i].u.image.bpc ? pdf_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 : "",
- fz_to_num(image[i].u.image.obj), fz_to_gen(image[i].u.image.obj));
+ pdf_to_num(image[i].u.image.obj), pdf_to_gen(image[i].u.image.obj));
fz_free(ctx, cs);
fz_free(ctx, altcs);
@@ -798,9 +798,9 @@ 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(shading[i].u.shading.type)],
- fz_to_num(shading[i].u.shading.obj), fz_to_gen(shading[i].u.shading.obj));
+ pdf_to_num(shading[i].pageref), pdf_to_gen(shading[i].pageref),
+ shadingtype[pdf_to_int(shading[i].u.shading.type)],
+ pdf_to_num(shading[i].u.shading.obj), pdf_to_gen(shading[i].u.shading.obj));
}
printf("\n");
}
@@ -810,7 +810,7 @@ printinfo(char *filename, int show, int page)
printf("Patterns (%d):\n", patterns);
for (i = 0; i < patterns; i++)
{
- if (fz_to_int(pattern[i].u.pattern.type) == 1)
+ if (pdf_to_int(pattern[i].u.pattern.type) == 1)
{
char *painttype[] =
{
@@ -828,18 +828,18 @@ 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(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));
+ pdf_to_num(pattern[i].pageref), pdf_to_gen(pattern[i].pageref),
+ painttype[pdf_to_int(pattern[i].u.pattern.paint)],
+ tilingtype[pdf_to_int(pattern[i].u.pattern.tiling)],
+ pdf_to_num(pattern[i].u.pattern.obj), pdf_to_gen(pattern[i].u.pattern.obj));
}
else
{
printf(PAGE_FMT "Shading %d %d R (%d %d R)\n",
pattern[i].page,
- fz_to_num(pattern[i].pageref), fz_to_gen(pattern[i].pageref),
- fz_to_num(pattern[i].u.pattern.shading), fz_to_gen(pattern[i].u.pattern.shading),
- fz_to_num(pattern[i].u.pattern.obj), fz_to_gen(pattern[i].u.pattern.obj));
+ pdf_to_num(pattern[i].pageref), pdf_to_gen(pattern[i].pageref),
+ pdf_to_num(pattern[i].u.pattern.shading), pdf_to_gen(pattern[i].u.pattern.shading),
+ pdf_to_num(pattern[i].u.pattern.obj), pdf_to_gen(pattern[i].u.pattern.obj));
}
}
printf("\n");
@@ -852,12 +852,12 @@ printinfo(char *filename, int show, int page)
{
printf(PAGE_FMT "Form%s%s%s%s (%d %d R)\n",
form[i].page,
- fz_to_num(form[i].pageref), fz_to_gen(form[i].pageref),
+ pdf_to_num(form[i].pageref), pdf_to_gen(form[i].pageref),
form[i].u.form.groupsubtype ? " " : "",
- form[i].u.form.groupsubtype ? fz_to_name(form[i].u.form.groupsubtype) : "",
+ form[i].u.form.groupsubtype ? pdf_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));
+ pdf_to_num(form[i].u.form.obj), pdf_to_gen(form[i].u.form.obj));
}
printf("\n");
}
@@ -869,8 +869,8 @@ printinfo(char *filename, int show, int page)
{
printf(PAGE_FMT "(%d %d R)\n",
psobj[i].page,
- fz_to_num(psobj[i].pageref), fz_to_gen(psobj[i].pageref),
- fz_to_num(psobj[i].u.form.obj), fz_to_gen(psobj[i].u.form.obj));
+ pdf_to_num(psobj[i].pageref), pdf_to_gen(psobj[i].pageref),
+ pdf_to_num(psobj[i].u.form.obj), pdf_to_gen(psobj[i].u.form.obj));
}
printf("\n");
}
@@ -996,7 +996,7 @@ int main(int argc, char **argv)
xref = pdf_open_document(ctx, filename);
if (pdf_needs_password(xref))
if (!pdf_authenticate_password(xref, password))
- fz_throw(ctx, "cannot authenticate password: %s\n", filename);
+ fz_throw(ctx, "cannot authenticate password: %s", filename);
pagecount = pdf_count_pages(xref);
showglobalinfo();