293 lines
11 KiB
Text
293 lines
11 KiB
Text
Index: willuslib/wmupdfinfo.c
|
|
--- willuslib/wmupdfinfo.c.orig
|
|
+++ willuslib/wmupdfinfo.c
|
|
@@ -227,7 +227,7 @@ static void showglobalinfo(fz_context *ctx, globals *g
|
|
fz_printf(ctx, out, "\nPages: %d\n\n", glo->pagecount);
|
|
}
|
|
*/
|
|
- fz_printf(ctx,out,"PDF VERSION: %d.%d\n",doc->version/10,doc->version%10);
|
|
+ fz_write_printf(ctx,out,"PDF VERSION: %d.%d\n",doc->version/10,doc->version%10);
|
|
|
|
obj = pdf_dict_gets(ctx,pdf_trailer(ctx,doc), "Info");
|
|
if (obj)
|
|
@@ -241,7 +241,7 @@ static void showglobalinfo(fz_context *ctx, globals *g
|
|
buf=malloc(n+2);
|
|
if (buf==NULL)
|
|
{
|
|
- fz_printf(ctx,out,"Info object (%d %d R):\n",pdf_to_num(ctx,obj),pdf_to_gen(ctx,obj));
|
|
+ fz_write_printf(ctx,out,"Info object (%d %d R):\n",pdf_to_num(ctx,obj),pdf_to_gen(ctx,obj));
|
|
pdf_print_obj(ctx,out,robj,1);
|
|
}
|
|
else
|
|
@@ -263,18 +263,18 @@ static void showglobalinfo(fz_context *ctx, globals *g
|
|
sprintf(buf1,"PAGE SIZE: %.2f x %.2f in\n",
|
|
(glo->dim[0].u.dim.bbox->x1-glo->dim[0].u.dim.bbox->x0)/72.,
|
|
(glo->dim[0].u.dim.bbox->y1-glo->dim[0].u.dim.bbox->y0)/72.);
|
|
- fz_printf(ctx,out,"%s",buf1);
|
|
+ fz_write_printf(ctx,out,"%s",buf1);
|
|
}
|
|
else
|
|
{
|
|
if (glo->dims>1)
|
|
- fz_printf(ctx,out,"PAGE SIZE: (varies)\n");
|
|
+ fz_write_printf(ctx,out,"PAGE SIZE: (varies)\n");
|
|
}
|
|
- fz_printf(ctx,out, "PAGES: %d\n\n", glo->pagecount);
|
|
+ fz_write_printf(ctx,out, "PAGES: %d\n\n", glo->pagecount);
|
|
obj = pdf_dict_gets(ctx,pdf_trailer(ctx,doc), "Encrypt");
|
|
if (obj)
|
|
{
|
|
- fz_printf(ctx,out, "\nEncryption object (%d %d R):\n", pdf_to_num(ctx,obj), pdf_to_gen(ctx,obj));
|
|
+ fz_write_printf(ctx,out, "\nEncryption object (%d %d R):\n", pdf_to_num(ctx,obj), pdf_to_gen(ctx,obj));
|
|
pdf_print_obj(ctx,out, pdf_resolve_indirect(ctx,obj), 1);
|
|
}
|
|
}
|
|
@@ -302,15 +302,15 @@ static void display_pdf_field(fz_context *ctx,fz_outpu
|
|
int j;
|
|
for (j=i+lenfn+1;buf[j]!='\0' && buf[j]!=')';j++);
|
|
buf[j]='\0';
|
|
- fz_printf(ctx,out,"%s",label3);
|
|
+ fz_write_printf(ctx,out,"%s",label3);
|
|
if (in_string(fieldname,"date")>=0)
|
|
{
|
|
char newdate[128];
|
|
date_convert(newdate,&buf[i+lenfn+1]);
|
|
- fz_printf(ctx,out,"%s\n",newdate);
|
|
+ fz_write_printf(ctx,out,"%s\n",newdate);
|
|
}
|
|
else
|
|
- fz_printf(ctx,out,"%s\n",&buf[i+lenfn+1]);
|
|
+ fz_write_printf(ctx,out,"%s\n",&buf[i+lenfn+1]);
|
|
break;
|
|
}
|
|
}
|
|
@@ -334,7 +334,7 @@ static void display_file_size(fz_context *ctx,fz_outpu
|
|
fclose(f);
|
|
str_format_int_grouped(sizecommas,sz);
|
|
sprintf(buf,"FILE SIZE: %.1f kB (%s bytes)\n",sz/1024.,sizecommas);
|
|
- fz_printf(ctx,out,"%s",buf);
|
|
+ fz_write_printf(ctx,out,"%s",buf);
|
|
}
|
|
|
|
|
|
@@ -819,7 +819,7 @@ static void gatherpageinfo(fz_context *ctx, globals *g
|
|
|
|
if (page > glo->pagecount)
|
|
{
|
|
- fz_printf(ctx,glo->out,"[Error: Page %d not found.]\n",page);
|
|
+ fz_write_printf(ctx,glo->out,"[Error: Page %d not found.]\n",page);
|
|
return;
|
|
}
|
|
pageref = pdf_lookup_page_obj(ctx, glo->doc, page-1);
|
|
@@ -845,7 +845,7 @@ printinfo(fz_context *ctx, globals *glo, char *filenam
|
|
|
|
if (show & DIMENSIONS && glo->dims > 0)
|
|
{
|
|
- fz_printf(ctx, out, "Mediaboxes (%d):\n", glo->dims);
|
|
+ fz_write_printf(ctx, out, "Mediaboxes (%d):\n", glo->dims);
|
|
for (i = 0; i < glo->dims; i++)
|
|
{
|
|
char buf1[64];
|
|
@@ -853,7 +853,7 @@ printinfo(fz_context *ctx, globals *glo, char *filenam
|
|
sprintf(buf1,"%.2f x %.2f",
|
|
(glo->dim[i].u.dim.bbox->x1-glo->dim[i].u.dim.bbox->x0)/72.,
|
|
(glo->dim[i].u.dim.bbox->y1-glo->dim[i].u.dim.bbox->y0)/72.);
|
|
- fz_printf(ctx, out, PAGE_FMT "[ %g %g %g %g ] (%s in)\n",
|
|
+ fz_write_printf(ctx, out, PAGE_FMT "[ %g %g %g %g ] (%s in)\n",
|
|
glo->dim[i].page,
|
|
pdf_to_num(ctx, glo->dim[i].pageref),
|
|
pdf_to_gen(ctx, glo->dim[i].pageref),
|
|
@@ -862,15 +862,15 @@ printinfo(fz_context *ctx, globals *glo, char *filenam
|
|
glo->dim[i].u.dim.bbox->x1,
|
|
glo->dim[i].u.dim.bbox->y1,buf1);
|
|
}
|
|
- fz_printf(ctx, out, "\n");
|
|
+ fz_write_printf(ctx, out, "\n");
|
|
}
|
|
|
|
if (show & FONTS && glo->fonts > 0)
|
|
{
|
|
- fz_printf(ctx, out, "Fonts (%d):\n", glo->fonts);
|
|
+ fz_write_printf(ctx, out, "Fonts (%d):\n", glo->fonts);
|
|
for (i = 0; i < glo->fonts; i++)
|
|
{
|
|
- fz_printf(ctx, out, PAGE_FMT "%s '%s' (%d %d R)\n",
|
|
+ fz_write_printf(ctx, out, PAGE_FMT "%s '%s' (%d %d R)\n",
|
|
glo->font[i].page,
|
|
pdf_to_num(ctx, glo->font[i].pageref),
|
|
pdf_to_gen(ctx, glo->font[i].pageref),
|
|
@@ -879,18 +879,18 @@ printinfo(fz_context *ctx, globals *glo, char *filenam
|
|
pdf_to_num(ctx, glo->font[i].u.font.obj),
|
|
pdf_to_gen(ctx, glo->font[i].u.font.obj));
|
|
}
|
|
- fz_printf(ctx, out, "\n");
|
|
+ fz_write_printf(ctx, out, "\n");
|
|
}
|
|
|
|
if (show & IMAGES && glo->images > 0)
|
|
{
|
|
- fz_printf(ctx, out, "Images (%d):\n", glo->images);
|
|
+ fz_write_printf(ctx, out, "Images (%d):\n", glo->images);
|
|
for (i = 0; i < glo->images; i++)
|
|
{
|
|
char *cs = NULL;
|
|
char *altcs = NULL;
|
|
|
|
- fz_printf(ctx, out, PAGE_FMT "[ ",
|
|
+ fz_write_printf(ctx, out, PAGE_FMT "[ ",
|
|
glo->image[i].page,
|
|
pdf_to_num(ctx, glo->image[i].pageref),
|
|
pdf_to_gen(ctx, glo->image[i].pageref));
|
|
@@ -906,7 +906,7 @@ printinfo(fz_context *ctx, globals *glo, char *filenam
|
|
if (strstr(filter, "Decode"))
|
|
*(strstr(filter, "Decode")) = '\0';
|
|
|
|
- fz_printf(ctx, out, "%s%s",
|
|
+ fz_write_printf(ctx, out, "%s%s",
|
|
filter,
|
|
j == pdf_array_len(ctx, glo->image[i].u.image.filter) - 1 ? "" : " ");
|
|
fz_free(ctx, filter);
|
|
@@ -920,11 +920,11 @@ printinfo(fz_context *ctx, globals *glo, char *filenam
|
|
if (strstr(filter, "Decode"))
|
|
*(strstr(filter, "Decode")) = '\0';
|
|
|
|
- fz_printf(ctx, out, "%s", filter);
|
|
+ fz_write_printf(ctx, out, "%s", filter);
|
|
fz_free(ctx, filter);
|
|
}
|
|
else
|
|
- fz_printf(ctx, out, "Raw");
|
|
+ fz_write_printf(ctx, out, "Raw");
|
|
|
|
if (glo->image[i].u.image.cs)
|
|
{
|
|
@@ -965,7 +965,7 @@ printinfo(fz_context *ctx, globals *glo, char *filenam
|
|
fz_strlcpy(altcs, "Sep", 4);
|
|
}
|
|
|
|
- fz_printf(ctx, out, " ] %dx%d %dbpc %s%s%s (%d %d R)\n",
|
|
+ fz_write_printf(ctx, out, " ] %dx%d %dbpc %s%s%s (%d %d R)\n",
|
|
pdf_to_int(ctx, glo->image[i].u.image.width),
|
|
pdf_to_int(ctx, glo->image[i].u.image.height),
|
|
glo->image[i].u.image.bpc ? pdf_to_int(ctx, glo->image[i].u.image.bpc) : 1,
|
|
@@ -978,12 +978,12 @@ printinfo(fz_context *ctx, globals *glo, char *filenam
|
|
fz_free(ctx, cs);
|
|
fz_free(ctx, altcs);
|
|
}
|
|
- fz_printf(ctx, out, "\n");
|
|
+ fz_write_printf(ctx, out, "\n");
|
|
}
|
|
|
|
if (show & SHADINGS && glo->shadings > 0)
|
|
{
|
|
- fz_printf(ctx, out, "Shading patterns (%d):\n", glo->shadings);
|
|
+ fz_write_printf(ctx, out, "Shading patterns (%d):\n", glo->shadings);
|
|
for (i = 0; i < glo->shadings; i++)
|
|
{
|
|
char *shadingtype[] =
|
|
@@ -998,7 +998,7 @@ printinfo(fz_context *ctx, globals *glo, char *filenam
|
|
"Tensor patch",
|
|
};
|
|
|
|
- fz_printf(ctx, out, PAGE_FMT "%s (%d %d R)\n",
|
|
+ fz_write_printf(ctx, out, PAGE_FMT "%s (%d %d R)\n",
|
|
glo->shading[i].page,
|
|
pdf_to_num(ctx, glo->shading[i].pageref),
|
|
pdf_to_gen(ctx, glo->shading[i].pageref),
|
|
@@ -1006,12 +1006,12 @@ printinfo(fz_context *ctx, globals *glo, char *filenam
|
|
pdf_to_num(ctx, glo->shading[i].u.shading.obj),
|
|
pdf_to_gen(ctx, glo->shading[i].u.shading.obj));
|
|
}
|
|
- fz_printf(ctx, out, "\n");
|
|
+ fz_write_printf(ctx, out, "\n");
|
|
}
|
|
|
|
if (show & PATTERNS && glo->patterns > 0)
|
|
{
|
|
- fz_printf(ctx, out, "Patterns (%d):\n", glo->patterns);
|
|
+ fz_write_printf(ctx, out, "Patterns (%d):\n", glo->patterns);
|
|
for (i = 0; i < glo->patterns; i++)
|
|
{
|
|
if (pdf_to_int(ctx, glo->pattern[i].u.pattern.type) == 1)
|
|
@@ -1030,7 +1030,7 @@ printinfo(fz_context *ctx, globals *glo, char *filenam
|
|
"Constant/fast tiling",
|
|
};
|
|
|
|
- fz_printf(ctx, out, PAGE_FMT "Tiling %s %s (%d %d R)\n",
|
|
+ fz_write_printf(ctx, out, PAGE_FMT "Tiling %s %s (%d %d R)\n",
|
|
glo->pattern[i].page,
|
|
pdf_to_num(ctx, glo->pattern[i].pageref),
|
|
pdf_to_gen(ctx, glo->pattern[i].pageref),
|
|
@@ -1041,7 +1041,7 @@ printinfo(fz_context *ctx, globals *glo, char *filenam
|
|
}
|
|
else
|
|
{
|
|
- fz_printf(ctx, out, PAGE_FMT "Shading %d %d R (%d %d R)\n",
|
|
+ fz_write_printf(ctx, out, PAGE_FMT "Shading %d %d R (%d %d R)\n",
|
|
glo->pattern[i].page,
|
|
pdf_to_num(ctx, glo->pattern[i].pageref),
|
|
pdf_to_gen(ctx, glo->pattern[i].pageref),
|
|
@@ -1051,15 +1051,15 @@ printinfo(fz_context *ctx, globals *glo, char *filenam
|
|
pdf_to_gen(ctx, glo->pattern[i].u.pattern.obj));
|
|
}
|
|
}
|
|
- fz_printf(ctx, out, "\n");
|
|
+ fz_write_printf(ctx, out, "\n");
|
|
}
|
|
|
|
if (show & XOBJS && glo->forms > 0)
|
|
{
|
|
- fz_printf(ctx, out, "Form xobjects (%d):\n", glo->forms);
|
|
+ fz_write_printf(ctx, out, "Form xobjects (%d):\n", glo->forms);
|
|
for (i = 0; i < glo->forms; i++)
|
|
{
|
|
- fz_printf(ctx, out, PAGE_FMT "Form%s%s%s%s (%d %d R)\n",
|
|
+ fz_write_printf(ctx, out, PAGE_FMT "Form%s%s%s%s (%d %d R)\n",
|
|
glo->form[i].page,
|
|
pdf_to_num(ctx, glo->form[i].pageref),
|
|
pdf_to_gen(ctx, glo->form[i].pageref),
|
|
@@ -1070,22 +1070,22 @@ printinfo(fz_context *ctx, globals *glo, char *filenam
|
|
pdf_to_num(ctx, glo->form[i].u.form.obj),
|
|
pdf_to_gen(ctx, glo->form[i].u.form.obj));
|
|
}
|
|
- fz_printf(ctx, out, "\n");
|
|
+ fz_write_printf(ctx, out, "\n");
|
|
}
|
|
|
|
if (show & XOBJS && glo->psobjs > 0)
|
|
{
|
|
- fz_printf(ctx, out, "Postscript xobjects (%d):\n", glo->psobjs);
|
|
+ fz_write_printf(ctx, out, "Postscript xobjects (%d):\n", glo->psobjs);
|
|
for (i = 0; i < glo->psobjs; i++)
|
|
{
|
|
- fz_printf(ctx, out, PAGE_FMT "(%d %d R)\n",
|
|
+ fz_write_printf(ctx, out, PAGE_FMT "(%d %d R)\n",
|
|
glo->psobj[i].page,
|
|
pdf_to_num(ctx, glo->psobj[i].pageref),
|
|
pdf_to_gen(ctx, glo->psobj[i].pageref),
|
|
pdf_to_num(ctx, glo->psobj[i].u.form.obj),
|
|
pdf_to_gen(ctx, glo->psobj[i].u.form.obj));
|
|
}
|
|
- fz_printf(ctx, out, "\n");
|
|
+ fz_write_printf(ctx, out, "\n");
|
|
}
|
|
}
|
|
|
|
@@ -1121,7 +1121,7 @@ static void pdfinfo_info(fz_context *ctx, fz_output *o
|
|
|
|
glo.out = out;
|
|
glo.ctx = ctx;
|
|
- fz_printf(ctx,out,"FILE: %s\n",filename);
|
|
+ fz_write_printf(ctx,out,"FILE: %s\n",filename);
|
|
glo.doc = pdf_open_document(ctx,filename);
|
|
if (pdf_needs_password(ctx,glo.doc))
|
|
if (!pdf_authenticate_password(ctx, glo.doc, password))
|
|
@@ -1129,7 +1129,7 @@ static void pdfinfo_info(fz_context *ctx, fz_output *o
|
|
glo.pagecount=pdf_count_pages(ctx,glo.doc);
|
|
gather_all_info(ctx,&glo,filename,show,pagelist);
|
|
showglobalinfo(ctx,&glo,filename);
|
|
- fz_printf(ctx,glo.out," Page Ref Details\n");
|
|
+ fz_write_printf(ctx,glo.out," Page Ref Details\n");
|
|
printinfo(ctx,&glo,filename,show);
|
|
closexref(ctx,&glo);
|
|
}
|