mupdf
Loading...
Searching...
No Matches
writer.h File Reference
Include dependency graph for writer.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  fz_document_writer

Macros

#define fz_new_derived_document_writer(CTX, TYPE, BEGIN_PAGE, END_PAGE, CLOSE, DROP)

Typedefs

typedef struct fz_document_writer fz_document_writer
typedef fz_devicefz_document_writer_begin_page_fn(fz_context *ctx, fz_document_writer *wri, fz_rect mediabox)
typedef void fz_document_writer_end_page_fn(fz_context *ctx, fz_document_writer *wri, fz_device *dev)
typedef void fz_document_writer_close_writer_fn(fz_context *ctx, fz_document_writer *wri)
typedef void fz_document_writer_drop_writer_fn(fz_context *ctx, fz_document_writer *wri)
typedef int fz_pdfocr_progress_fn(fz_context *ctx, void *progress_arg, int page, int percent)

Functions

fz_document_writerfz_new_document_writer (fz_context *ctx, const char *path, const char *format, const char *options)
fz_document_writerfz_new_document_writer_with_output (fz_context *ctx, fz_output *out, const char *format, const char *options)
fz_document_writerfz_new_document_writer_with_buffer (fz_context *ctx, fz_buffer *buf, const char *format, const char *options)
fz_document_writerfz_new_pdf_writer (fz_context *ctx, const char *path, const char *options)
fz_document_writerfz_new_pdf_writer_with_output (fz_context *ctx, fz_output *out, const char *options)
fz_document_writerfz_new_svg_writer (fz_context *ctx, const char *path, const char *options)
fz_document_writerfz_new_svg_writer_with_output (fz_context *ctx, fz_output *out, const char *options)
fz_document_writerfz_new_text_writer (fz_context *ctx, const char *format, const char *path, const char *options)
fz_document_writerfz_new_text_writer_with_output (fz_context *ctx, const char *format, fz_output *out, const char *options)
fz_document_writerfz_new_odt_writer (fz_context *ctx, const char *path, const char *options)
fz_document_writerfz_new_odt_writer_with_output (fz_context *ctx, fz_output *out, const char *options)
fz_document_writerfz_new_docx_writer (fz_context *ctx, const char *path, const char *options)
fz_document_writerfz_new_docx_writer_with_output (fz_context *ctx, fz_output *out, const char *options)
fz_document_writerfz_new_ps_writer (fz_context *ctx, const char *path, const char *options)
fz_document_writerfz_new_ps_writer_with_output (fz_context *ctx, fz_output *out, const char *options)
fz_document_writerfz_new_pcl_writer (fz_context *ctx, const char *path, const char *options)
fz_document_writerfz_new_pcl_writer_with_output (fz_context *ctx, fz_output *out, const char *options)
fz_document_writerfz_new_pclm_writer (fz_context *ctx, const char *path, const char *options)
fz_document_writerfz_new_pclm_writer_with_output (fz_context *ctx, fz_output *out, const char *options)
fz_document_writerfz_new_pwg_writer (fz_context *ctx, const char *path, const char *options)
fz_document_writerfz_new_pwg_writer_with_output (fz_context *ctx, fz_output *out, const char *options)
fz_document_writerfz_new_cbz_writer (fz_context *ctx, const char *path, const char *options)
fz_document_writerfz_new_cbz_writer_with_output (fz_context *ctx, fz_output *out, const char *options)
fz_document_writerfz_new_csv_writer (fz_context *ctx, const char *path, const char *options)
fz_document_writerfz_new_csv_writer_with_output (fz_context *ctx, fz_output *out, const char *options)
fz_document_writerfz_new_pdfocr_writer (fz_context *ctx, const char *path, const char *options)
fz_document_writerfz_new_pdfocr_writer_with_output (fz_context *ctx, fz_output *out, const char *options)
void fz_pdfocr_writer_set_progress (fz_context *ctx, fz_document_writer *writer, fz_pdfocr_progress_fn *progress, void *)
fz_document_writerfz_new_jpeg_pixmap_writer (fz_context *ctx, const char *path, const char *options)
fz_document_writerfz_new_png_pixmap_writer (fz_context *ctx, const char *path, const char *options)
fz_document_writerfz_new_pam_pixmap_writer (fz_context *ctx, const char *path, const char *options)
fz_document_writerfz_new_pnm_pixmap_writer (fz_context *ctx, const char *path, const char *options)
fz_document_writerfz_new_pgm_pixmap_writer (fz_context *ctx, const char *path, const char *options)
fz_document_writerfz_new_ppm_pixmap_writer (fz_context *ctx, const char *path, const char *options)
fz_document_writerfz_new_pbm_pixmap_writer (fz_context *ctx, const char *path, const char *options)
fz_document_writerfz_new_pkm_pixmap_writer (fz_context *ctx, const char *path, const char *options)
fz_devicefz_begin_page (fz_context *ctx, fz_document_writer *wri, fz_rect mediabox)
void fz_end_page (fz_context *ctx, fz_document_writer *wri)
void fz_write_document (fz_context *ctx, fz_document_writer *wri, fz_document *doc)
void fz_close_document_writer (fz_context *ctx, fz_document_writer *wri)
void fz_drop_document_writer (fz_context *ctx, fz_document_writer *wri)
fz_document_writerfz_new_pixmap_writer (fz_context *ctx, const char *path, const char *options, const char *default_path, int n, void(*save)(fz_context *ctx, fz_pixmap *pix, const char *filename))
fz_document_writerfz_new_pixmap_writer_with_output (fz_context *ctx, fz_output *out, const char *options, int n, void(*write)(fz_context *ctx, fz_output *out, fz_pixmap *pix))
fz_document_writerfz_new_document_writer_of_size (fz_context *ctx, size_t size, fz_document_writer_begin_page_fn *begin_page, fz_document_writer_end_page_fn *end_page, fz_document_writer_close_writer_fn *close, fz_document_writer_drop_writer_fn *drop)

Variables

FZ_DATA const char * fz_pdf_write_options_usage
FZ_DATA const char * fz_svg_write_options_usage
FZ_DATA const char * fz_pcl_write_options_usage
FZ_DATA const char * fz_pclm_write_options_usage
FZ_DATA const char * fz_pwg_write_options_usage
FZ_DATA const char * fz_pdfocr_write_options_usage

Macro Definition Documentation

◆ fz_new_derived_document_writer

#define fz_new_derived_document_writer ( CTX,
TYPE,
BEGIN_PAGE,
END_PAGE,
CLOSE,
DROP )
Value:
((TYPE *)Memento_label(fz_new_document_writer_of_size(CTX,sizeof(TYPE),BEGIN_PAGE,END_PAGE,CLOSE,DROP),#TYPE))
#define Memento_label(A, B)
Definition memento.h:388
fz_document_writer * fz_new_document_writer_of_size(fz_context *ctx, size_t size, fz_document_writer_begin_page_fn *begin_page, fz_document_writer_end_page_fn *end_page, fz_document_writer_close_writer_fn *close, fz_document_writer_drop_writer_fn *drop)

Typedef Documentation

◆ fz_document_writer

typedef struct fz_document_writer fz_document_writer

◆ fz_document_writer_begin_page_fn

typedef fz_device * fz_document_writer_begin_page_fn(fz_context *ctx, fz_document_writer *wri, fz_rect mediabox)

Function type to start the process of writing a page to a document.

mediabox: page size rectangle in points.

Returns a fz_device to write page contents to.

◆ fz_document_writer_close_writer_fn

typedef void fz_document_writer_close_writer_fn(fz_context *ctx, fz_document_writer *wri)

Function type to end the process of writing pages to a document.

This writes any file level trailers required. After this completes successfully the file is up to date and complete.

◆ fz_document_writer_drop_writer_fn

typedef void fz_document_writer_drop_writer_fn(fz_context *ctx, fz_document_writer *wri)

Function type to discard an fz_document_writer. This may be called at any time during the process to release all the resources owned by the writer.

Calling drop without having previously called close may leave the file in an inconsistent state and the user of the fz_document_writer would need to do any cleanup required.

◆ fz_document_writer_end_page_fn

typedef void fz_document_writer_end_page_fn(fz_context *ctx, fz_document_writer *wri, fz_device *dev)

Function type to end the process of writing a page to a document.

dev: The device created by the begin_page function.

◆ fz_pdfocr_progress_fn

typedef int fz_pdfocr_progress_fn(fz_context *ctx, void *progress_arg, int page, int percent)

Used to report progress of the OCR operation.

page: Current page being processed.

percent: Progress of the OCR operation for the current page in percent. Whether it reaches 100 once a page is finished, depends on the OCR engine.

Return 0 to continue progress, return 1 to cancel the operation.

Function Documentation

◆ fz_begin_page()

fz_device * fz_begin_page ( fz_context * ctx,
fz_document_writer * wri,
fz_rect mediabox )

Called to start the process of writing a page to a document.

mediabox: page size rectangle in points.

Returns a borrowed fz_device to write page contents to. This should be kept if required, and only dropped if it was kept.

◆ fz_close_document_writer()

void fz_close_document_writer ( fz_context * ctx,
fz_document_writer * wri )

Called to end the process of writing pages to a document.

This writes any file level trailers required. After this completes successfully the file is up to date and complete.

◆ fz_drop_document_writer()

void fz_drop_document_writer ( fz_context * ctx,
fz_document_writer * wri )

Called to discard a fz_document_writer. This may be called at any time during the process to release all the resources owned by the writer.

Calling drop without having previously called close may leave the file in an inconsistent state.

◆ fz_end_page()

void fz_end_page ( fz_context * ctx,
fz_document_writer * wri )

Called to end the process of writing a page to a document.

◆ fz_new_cbz_writer()

fz_document_writer * fz_new_cbz_writer ( fz_context * ctx,
const char * path,
const char * options )

◆ fz_new_cbz_writer_with_output()

fz_document_writer * fz_new_cbz_writer_with_output ( fz_context * ctx,
fz_output * out,
const char * options )

◆ fz_new_csv_writer()

fz_document_writer * fz_new_csv_writer ( fz_context * ctx,
const char * path,
const char * options )

◆ fz_new_csv_writer_with_output()

fz_document_writer * fz_new_csv_writer_with_output ( fz_context * ctx,
fz_output * out,
const char * options )

◆ fz_new_document_writer()

fz_document_writer * fz_new_document_writer ( fz_context * ctx,
const char * path,
const char * format,
const char * options )

Create a new fz_document_writer, for a file of the given type.

path: The document name to write (or NULL for default)

format: Which format to write (currently cbz, html, pdf, pam, pbm, pgm, pkm, png, ppm, pnm, svg, text, xhtml, docx, odt)

options: NULL, or pointer to comma separated string to control file generation.

◆ fz_new_document_writer_of_size()

fz_document_writer * fz_new_document_writer_of_size ( fz_context * ctx,
size_t size,
fz_document_writer_begin_page_fn * begin_page,
fz_document_writer_end_page_fn * end_page,
fz_document_writer_close_writer_fn * close,
fz_document_writer_drop_writer_fn * drop )

Internal function to allocate a block for a derived document_writer structure, with the base structure's function pointers populated correctly, and the extra space zero initialised.

◆ fz_new_document_writer_with_buffer()

fz_document_writer * fz_new_document_writer_with_buffer ( fz_context * ctx,
fz_buffer * buf,
const char * format,
const char * options )

◆ fz_new_document_writer_with_output()

fz_document_writer * fz_new_document_writer_with_output ( fz_context * ctx,
fz_output * out,
const char * format,
const char * options )

Like fz_new_document_writer but takes a fz_output for writing the result. Only works for multi-page formats.

◆ fz_new_docx_writer()

fz_document_writer * fz_new_docx_writer ( fz_context * ctx,
const char * path,
const char * options )

◆ fz_new_docx_writer_with_output()

fz_document_writer * fz_new_docx_writer_with_output ( fz_context * ctx,
fz_output * out,
const char * options )

◆ fz_new_jpeg_pixmap_writer()

fz_document_writer * fz_new_jpeg_pixmap_writer ( fz_context * ctx,
const char * path,
const char * options )

◆ fz_new_odt_writer()

fz_document_writer * fz_new_odt_writer ( fz_context * ctx,
const char * path,
const char * options )

◆ fz_new_odt_writer_with_output()

fz_document_writer * fz_new_odt_writer_with_output ( fz_context * ctx,
fz_output * out,
const char * options )

◆ fz_new_pam_pixmap_writer()

fz_document_writer * fz_new_pam_pixmap_writer ( fz_context * ctx,
const char * path,
const char * options )

◆ fz_new_pbm_pixmap_writer()

fz_document_writer * fz_new_pbm_pixmap_writer ( fz_context * ctx,
const char * path,
const char * options )

◆ fz_new_pcl_writer()

fz_document_writer * fz_new_pcl_writer ( fz_context * ctx,
const char * path,
const char * options )

◆ fz_new_pcl_writer_with_output()

fz_document_writer * fz_new_pcl_writer_with_output ( fz_context * ctx,
fz_output * out,
const char * options )

◆ fz_new_pclm_writer()

fz_document_writer * fz_new_pclm_writer ( fz_context * ctx,
const char * path,
const char * options )

◆ fz_new_pclm_writer_with_output()

fz_document_writer * fz_new_pclm_writer_with_output ( fz_context * ctx,
fz_output * out,
const char * options )

◆ fz_new_pdf_writer()

fz_document_writer * fz_new_pdf_writer ( fz_context * ctx,
const char * path,
const char * options )

Document writers for various possible output formats.

All of the "_with_output" variants pass the ownership of out in immediately upon calling. The writers are responsible for dropping the fz_output when they are finished with it (even if they throw an exception during creation).

◆ fz_new_pdf_writer_with_output()

fz_document_writer * fz_new_pdf_writer_with_output ( fz_context * ctx,
fz_output * out,
const char * options )

◆ fz_new_pdfocr_writer()

fz_document_writer * fz_new_pdfocr_writer ( fz_context * ctx,
const char * path,
const char * options )

◆ fz_new_pdfocr_writer_with_output()

fz_document_writer * fz_new_pdfocr_writer_with_output ( fz_context * ctx,
fz_output * out,
const char * options )

◆ fz_new_pgm_pixmap_writer()

fz_document_writer * fz_new_pgm_pixmap_writer ( fz_context * ctx,
const char * path,
const char * options )

◆ fz_new_pixmap_writer()

fz_document_writer * fz_new_pixmap_writer ( fz_context * ctx,
const char * path,
const char * options,
const char * default_path,
int n,
void(* save )(fz_context *ctx, fz_pixmap *pix, const char *filename) )

◆ fz_new_pixmap_writer_with_output()

fz_document_writer * fz_new_pixmap_writer_with_output ( fz_context * ctx,
fz_output * out,
const char * options,
int n,
void(* write )(fz_context *ctx, fz_output *out, fz_pixmap *pix) )

◆ fz_new_pkm_pixmap_writer()

fz_document_writer * fz_new_pkm_pixmap_writer ( fz_context * ctx,
const char * path,
const char * options )

◆ fz_new_png_pixmap_writer()

fz_document_writer * fz_new_png_pixmap_writer ( fz_context * ctx,
const char * path,
const char * options )

◆ fz_new_pnm_pixmap_writer()

fz_document_writer * fz_new_pnm_pixmap_writer ( fz_context * ctx,
const char * path,
const char * options )

◆ fz_new_ppm_pixmap_writer()

fz_document_writer * fz_new_ppm_pixmap_writer ( fz_context * ctx,
const char * path,
const char * options )

◆ fz_new_ps_writer()

fz_document_writer * fz_new_ps_writer ( fz_context * ctx,
const char * path,
const char * options )

◆ fz_new_ps_writer_with_output()

fz_document_writer * fz_new_ps_writer_with_output ( fz_context * ctx,
fz_output * out,
const char * options )

◆ fz_new_pwg_writer()

fz_document_writer * fz_new_pwg_writer ( fz_context * ctx,
const char * path,
const char * options )

◆ fz_new_pwg_writer_with_output()

fz_document_writer * fz_new_pwg_writer_with_output ( fz_context * ctx,
fz_output * out,
const char * options )

◆ fz_new_svg_writer()

fz_document_writer * fz_new_svg_writer ( fz_context * ctx,
const char * path,
const char * options )

◆ fz_new_svg_writer_with_output()

fz_document_writer * fz_new_svg_writer_with_output ( fz_context * ctx,
fz_output * out,
const char * options )

◆ fz_new_text_writer()

fz_document_writer * fz_new_text_writer ( fz_context * ctx,
const char * format,
const char * path,
const char * options )

◆ fz_new_text_writer_with_output()

fz_document_writer * fz_new_text_writer_with_output ( fz_context * ctx,
const char * format,
fz_output * out,
const char * options )

◆ fz_pdfocr_writer_set_progress()

void fz_pdfocr_writer_set_progress ( fz_context * ctx,
fz_document_writer * writer,
fz_pdfocr_progress_fn * progress,
void *  )

◆ fz_write_document()

void fz_write_document ( fz_context * ctx,
fz_document_writer * wri,
fz_document * doc )

Convenience function to feed all the pages of a document to fz_begin_page/fz_run_page/fz_end_page.

Variable Documentation

◆ fz_pcl_write_options_usage

FZ_DATA const char* fz_pcl_write_options_usage
extern

◆ fz_pclm_write_options_usage

FZ_DATA const char* fz_pclm_write_options_usage
extern

◆ fz_pdf_write_options_usage

FZ_DATA const char* fz_pdf_write_options_usage
extern

◆ fz_pdfocr_write_options_usage

FZ_DATA const char* fz_pdfocr_write_options_usage
extern

◆ fz_pwg_write_options_usage

FZ_DATA const char* fz_pwg_write_options_usage
extern

◆ fz_svg_write_options_usage

FZ_DATA const char* fz_svg_write_options_usage
extern