mupdf
Toggle main menu visibility
Loading...
Searching...
No Matches
clean.h
Go to the documentation of this file.
1
// Copyright (C) 2004-2025 Artifex Software, Inc.
2
//
3
// This file is part of MuPDF.
4
//
5
// MuPDF is free software: you can redistribute it and/or modify it under the
6
// terms of the GNU Affero General Public License as published by the Free
7
// Software Foundation, either version 3 of the License, or (at your option)
8
// any later version.
9
//
10
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
11
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
13
// details.
14
//
15
// You should have received a copy of the GNU Affero General Public License
16
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
17
//
18
// Alternative licensing terms are available from the licensor.
19
// For commercial licensing, see <https://www.artifex.com/> or contact
20
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
21
// CA 94129, USA, for further information.
22
23
#ifndef MUPDF_PDF_CLEAN_H
24
#define MUPDF_PDF_CLEAN_H
25
26
#include "
mupdf/pdf/document.h
"
27
#include "
mupdf/pdf/image-rewriter.h
"
28
39
typedef
enum
{
40
PDF_CLEAN_STRUCTURE_DROP
= 0,
41
PDF_CLEAN_STRUCTURE_KEEP
= 1
42
}
pdf_clean_options_structure
;
43
44
typedef
enum
{
45
PDF_CLEAN_VECTORIZE_NO
= 0,
46
PDF_CLEAN_VECTORIZE_YES
= 1
47
}
pdf_clean_options_vectorize
;
48
49
typedef
struct
50
{
51
pdf_write_options
write
;
52
pdf_image_rewriter_options
image
;
53
54
int
subset_fonts
;
55
56
/* PDF_CLEAN_STRUCTURE_DROP to drop the structure tree (default).
57
* PDF_CLEAN_STRUCTURE_KEEP to keep it unchanged.
58
* Future values reserved.
59
*/
60
pdf_clean_options_structure
structure
;
61
62
/* PDF_CLEAN_VECTORIZE_NO to leave the pages unchanged.
63
* PDF_CLEAN_VECTORIZE_YES to vectorize each page (and flatten any Type 3 fonts).
64
* Future values reserved.
65
*/
66
pdf_clean_options_vectorize
vectorize
;
67
}
pdf_clean_options
;
68
69
/*
70
Read infile, and write selected pages to outfile with the given options.
71
*/
72
void
pdf_clean_file
(
fz_context
*ctx,
char
*infile,
char
*outfile,
char
*password,
pdf_clean_options
*opts,
int
retainlen,
char
*retainlist[]);
73
74
/*
75
Recreate page tree to include only the pages listed in the array, in the order listed.
76
*/
77
void
pdf_rearrange_pages
(
fz_context
*ctx,
pdf_document
*doc,
int
count,
const
int
*pages,
pdf_clean_options_structure
structure);
78
79
/*
80
Recreate given page list (or all pages if count == 0), with text being vectorized.
81
*/
82
void
pdf_vectorize_pages
(
fz_context
*ctx,
pdf_document
*doc,
int
count,
const
int
*new_page_list,
pdf_clean_options_vectorize
vectorize);
83
84
#endif
pdf_clean_options_structure
pdf_clean_options_structure
Definition
clean.h:39
PDF_CLEAN_STRUCTURE_DROP
@ PDF_CLEAN_STRUCTURE_DROP
Definition
clean.h:40
PDF_CLEAN_STRUCTURE_KEEP
@ PDF_CLEAN_STRUCTURE_KEEP
Definition
clean.h:41
pdf_clean_file
void pdf_clean_file(fz_context *ctx, char *infile, char *outfile, char *password, pdf_clean_options *opts, int retainlen, char *retainlist[])
pdf_rearrange_pages
void pdf_rearrange_pages(fz_context *ctx, pdf_document *doc, int count, const int *pages, pdf_clean_options_structure structure)
pdf_clean_options_vectorize
pdf_clean_options_vectorize
Definition
clean.h:44
PDF_CLEAN_VECTORIZE_NO
@ PDF_CLEAN_VECTORIZE_NO
Definition
clean.h:45
PDF_CLEAN_VECTORIZE_YES
@ PDF_CLEAN_VECTORIZE_YES
Definition
clean.h:46
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)
image-rewriter.h
document.h
fz_context
Definition
context.h:886
pdf_clean_options
Definition
clean.h:50
pdf_clean_options::structure
pdf_clean_options_structure structure
Definition
clean.h:60
pdf_clean_options::vectorize
pdf_clean_options_vectorize vectorize
Definition
clean.h:66
pdf_clean_options::write
pdf_write_options write
Definition
clean.h:51
pdf_clean_options::subset_fonts
int subset_fonts
Definition
clean.h:54
pdf_clean_options::image
pdf_image_rewriter_options image
Definition
clean.h:52
pdf_document
Definition
document.h:463
pdf_image_rewriter_options
Definition
image-rewriter.h:51
pdf_write_options
Definition
document.h:768
include
mupdf
pdf
clean.h
Generated by
1.17.0