Exemplo n.º 1
0
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;
}
Exemplo n.º 2
0
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;
}