fz_archive * fz_open_archive(fz_context *ctx, const char *filename) { fz_stream *file; fz_archive *arch = NULL; file = fz_open_file(ctx, filename); fz_try(ctx) arch = fz_open_archive_with_stream(ctx, file); fz_always(ctx) fz_drop_stream(ctx, file); fz_catch(ctx) fz_rethrow(ctx); return arch; }
xps_document * xps_open_document_with_stream(fz_context *ctx, fz_stream *file) { xps_document *doc; doc = fz_malloc_struct(ctx, xps_document); xps_init_document(ctx, doc); fz_try(ctx) { doc->zip = fz_open_archive_with_stream(ctx, file); xps_read_page_list(ctx, doc); } fz_catch(ctx) { xps_close_document(ctx, doc); fz_rethrow(ctx); } return doc; }
static cbz_document * cbz_open_document_with_stream(fz_context *ctx, fz_stream *file) { cbz_document *doc = fz_new_document(ctx, sizeof *doc); doc->super.close = (fz_document_close_fn *)cbz_close_document; doc->super.count_pages = (fz_document_count_pages_fn *)cbz_count_pages; doc->super.load_page = (fz_document_load_page_fn *)cbz_load_page; doc->super.lookup_metadata = (fz_document_lookup_metadata_fn *)cbz_lookup_metadata; fz_try(ctx) { doc->zip = fz_open_archive_with_stream(ctx, file); cbz_create_page_list(ctx, doc); } fz_catch(ctx) { cbz_close_document(ctx, doc); fz_rethrow(ctx); } return doc; }
static fz_document * cbz_open_document_with_stream(fz_context *ctx, fz_stream *file) { cbz_document *doc; doc = fz_new_derived_document(ctx, cbz_document); doc->super.drop_document = cbz_drop_document; doc->super.count_pages = cbz_count_pages; doc->super.load_page = cbz_load_page; doc->super.lookup_metadata = cbz_lookup_metadata; fz_try(ctx) { doc->arch = fz_open_archive_with_stream(ctx, file); cbz_create_page_list(ctx, doc); } fz_catch(ctx) { fz_drop_document(ctx, (fz_document*)doc); fz_rethrow(ctx); } return (fz_document*)doc; }
cbz_document * cbz_open_document_with_stream(fz_context *ctx, fz_stream *file) { cbz_document *doc; doc = fz_malloc_struct(ctx, cbz_document); cbz_init_document(doc); doc->ctx = ctx; doc->page_count = 0; doc->page = NULL; fz_try(ctx) { doc->zip = fz_open_archive_with_stream(ctx, file); cbz_create_page_list(doc); } fz_catch(ctx) { cbz_close_document(doc); fz_rethrow(ctx); } return doc; }
static fz_document * epub_open_document_with_stream(fz_context *ctx, fz_stream *file) { return epub_init(ctx, fz_open_archive_with_stream(ctx, file)); }