MuPDF X.Y.Z

pdf/clean.h

Index

struct

enum

function

Clean

enum pdf_clean_options_structure

enum pdf_clean_options_structure
{
        PDF_CLEAN_STRUCTURE_DROP = 0,
        PDF_CLEAN_STRUCTURE_KEEP = 1
}

Specifies whether the PDF’s structure tree should be dropped or kept when rearranging or subsetting its pages.

PDF_CLEAN_STRUCTURE_DROP: Remove the structure tree entirely.

PDF_CLEAN_STRUCTURE_KEEP: Preserve the structure tree. When redacting a document, preserving the structure tree might leak information.

enum pdf_clean_options_vectorize

enum pdf_clean_options_vectorize
{
        PDF_CLEAN_VECTORIZE_NO = 0,
        PDF_CLEAN_VECTORIZE_YES = 1
}

struct pdf_clean_options

struct pdf_clean_options
{
        pdf_write_options write;
        pdf_image_rewriter_options image;

        int subset_fonts;

        /* PDF_CLEAN_STRUCTURE_DROP to drop the structure tree (default).
         * PDF_CLEAN_STRUCTURE_KEEP to keep it unchanged.
         * Future values reserved.
         */
        pdf_clean_options_structure structure;

        /* PDF_CLEAN_VECTORIZE_NO to leave the pages unchanged.
         * PDF_CLEAN_VECTORIZE_YES to vectorize each page (and flatten any Type 3 fonts).
         * Future values reserved.
         */
        pdf_clean_options_vectorize vectorize;

        /* If non NULL, external streams and the file itself will be loaded from this
        * archive. */
        fz_archive *dir;
}

function pdf_clean_file

void
pdf_clean_file (
        fz_context *ctx,
        char *infile,
        char *outfile,
        char *password,
        pdf_clean_options *opts,
        int retainlen,
        char *retainlist[]
)

Read infile, and write selected pages to outfile with the given options.

function pdf_rearrange_pages

void
pdf_rearrange_pages (
        fz_context *ctx,
        pdf_document *doc,
        int count,
        const int *pages,
        pdf_clean_options_structure structure
)

Recreate page tree to include only the pages listed in the array, in the order listed.

function pdf_vectorize_pages

void
pdf_vectorize_pages (
        fz_context *ctx,
        pdf_document *doc,
        int count,
        const int *new_page_list,
        pdf_clean_options_vectorize vectorize
)

Recreate given page list (or all pages if count == 0), with text being vectorized.