int main(int argc, char **argv) { char *password = ""; int c, o; while ((c = fz_getopt(argc, argv, "d:")) != -1) { switch (c) { case 'd': password = fz_optarg; break; default: showusage(); break; } } if (fz_optind == argc) showusage(); openxref(argv[fz_optind++], password, 0); if (fz_optind == argc) for (o = 0; o < xref->len; o++) showobject(o, 0); else while (fz_optind < argc) { showobject(atoi(argv[fz_optind]), 0); fz_optind++; } closexref(); }
int main(int argc, char **argv) { fz_error error; char *password = ""; int c; enum { NO_FILE_OPENED, NO_PAGES_DRAWN, DREW_PAGES } state; while ((c = fz_getopt(argc, argv, "b:d:o:r:txm")) != -1) { switch (c) { case 'b': drawbands = atoi(fz_optarg); break; case 'd': password = fz_optarg; break; case 'o': drawpattern = fz_optarg; break; case 'r': drawzoom = atof(fz_optarg) / 72.0; break; case 't': drawmode = DRAWTXT; break; case 'x': drawmode = DRAWXML; break; case 'm': benchmark = 1; break; default: drawusage(); break; } } if (fz_optind == argc) drawusage(); setcleanup(local_cleanup); state = NO_FILE_OPENED; while (fz_optind < argc) { if (strstr(argv[fz_optind], ".pdf") || strstr(argv[fz_optind], ".PDF")) { if (state == NO_PAGES_DRAWN) drawpages("1-"); closexref(); error = fz_newrenderer(&drawgc, pdf_devicergb, 0, 1024 * 512); if (error) die(error); openxref(argv[fz_optind], password, 0); state = NO_PAGES_DRAWN; } else { drawpages(argv[fz_optind]); state = DREW_PAGES; } fz_optind++; } if (state == NO_PAGES_DRAWN) drawpages("1-"); closexref(); }
void benchfile(char *pdffilename, int loadonly, int pageNo) { pdf_document *xref = NULL; mstimer timer; int page_count; int curpage; fz_context *ctx = fz_new_context(NULL, NULL, FZ_STORE_DEFAULT); if (!ctx) { logbench("Error: fz_new_context() failed\n"); return; } logbench("Starting: %s\n", pdffilename); timerstart(&timer); fz_var(xref); fz_try(ctx) { xref = openxref(ctx, pdffilename); } fz_catch(ctx) { goto Exit; } timerstop(&timer); logbench("load: %.2f ms\n", timeinms(&timer)); page_count = pdf_count_pages(xref); logbench("page count: %d\n", page_count); if (loadonly) goto Exit; for (curpage = 1; curpage <= page_count; curpage++) { pdf_page *page; if ((-1 != pageNo) && (pageNo != curpage)) continue; page = benchloadpage(ctx, xref, curpage); if (page) { benchrenderpage(ctx, xref, page, curpage); pdf_free_page(xref, page); } } Exit: logbench("Finished: %s\n", pdffilename); pdf_close_document(xref); fz_free_context(ctx); }
int main(int argc, char **argv) { char *password = ""; int c; while ((c = fz_getopt(argc, argv, "d:bx")) != -1) { switch (c) { case 'd': password = fz_optarg; break; case 'b': showbinary ++; break; case 'x': showdecode ++; break; default: showusage(); break; } } if (fz_optind == argc) showusage(); openxref(argv[fz_optind++], password, 0); if (fz_optind == argc) showtrailer(); while (fz_optind < argc) { if (!strcmp(argv[fz_optind], "trailer")) showtrailer(); else if (!strcmp(argv[fz_optind], "xref")) showxref(); else showobject(atoi(argv[fz_optind]), 0); fz_optind++; } closexref(); }
/*================================= * init_lifelines_postdb -- * Initialize stuff maintained in-memory * which requires the database to already be opened *===============================*/ BOOLEAN init_lifelines_postdb (void) { STRING emsg; TABLE dbopts = create_table_str(); tagtable = create_table_str(); /* values are same as keys */ placabbvs = create_table_str(); init_valtab_from_rec("VPLAC", placabbvs, ':', &emsg); init_valtab_from_rec("VUOPT", dbopts, '=', &emsg); set_db_options(dbopts); release_table(dbopts); init_caches(); init_browse_lists(); if (!openxref(readonly)) return FALSE; transl_load_xlats(); return TRUE; }
int main(int argc, char **argv) { enum { NO_FILE_OPENED, NO_INFO_GATHERED, INFO_SHOWN } state; char *filename = ""; char *password = ""; int show = ALL; int c; while ((c = fz_getopt(argc, argv, "mfispxd:")) != -1) { switch (c) { case 'm': if (show == ALL) show = DIMENSIONS; else show |= DIMENSIONS; break; case 'f': if (show == ALL) show = FONTS; else show |= FONTS; break; case 'i': if (show == ALL) show = IMAGES; else show |= IMAGES; break; case 's': if (show == ALL) show = SHADINGS; else show |= SHADINGS; break; case 'p': if (show == ALL) show = PATTERNS; else show |= PATTERNS; break; case 'x': if (show == ALL) show = XOBJS; else show |= XOBJS; break; case 'd': password = fz_optarg; break; default: infousage(); break; } } if (fz_optind == argc) infousage(); setcleanup(local_cleanup); state = NO_FILE_OPENED; while (fz_optind < argc) { if (strstr(argv[fz_optind], ".pdf") || strstr(argv[fz_optind], ".PDF")) { if (state == NO_INFO_GATHERED) { printglobalinfo(); showinfo(filename, show, "1-"); closexref(); } closexref(); filename = argv[fz_optind]; printf("%s:\n", filename); openxref(filename, password, 0); gatherglobalinfo(); state = NO_INFO_GATHERED; } else { if (state == NO_INFO_GATHERED) printglobalinfo(); showinfo(filename, show, argv[fz_optind]); state = INFO_SHOWN; } fz_optind++; } if (state == NO_INFO_GATHERED) { printglobalinfo(); showinfo(filename, show, "1-"); } closexref(); }