comparison mupdf-source/thirdparty/extract/src/odt.h @ 2:b50eed0cc0ef upstream

ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4. The directory name has changed: no version number in the expanded directory now.
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 15 Sep 2025 11:43:07 +0200
parents
children
comparison
equal deleted inserted replaced
1:1d09e1dec1d9 2:b50eed0cc0ef
1 #ifndef ARTIFEX_EXTRACT_ODT_H
2 #define ARTIFEX_EXTRACT_ODT_H
3
4 /* Only for internal use by extract code. */
5
6 /* Things for creating odt files. */
7
8 typedef struct extract_odt_style_t extract_odt_style_t;
9
10 typedef struct
11 {
12 extract_odt_style_t* styles;
13 int styles_num;
14 } extract_odt_styles_t;
15
16 void extract_odt_styles_free(extract_alloc_t* alloc, extract_odt_styles_t* styles);
17
18 int extract_document_to_odt_content(
19 extract_alloc_t* alloc,
20 document_t* document,
21 int spacing,
22 int rotation,
23 int images,
24 extract_astring_t* o_content,
25 extract_odt_styles_t* o_styles
26 );
27 /* Makes *o_content point to a string containing all paragraphs in *document in
28 odt XML format.
29
30 Also writes style definitions to <o_styles>.
31
32 <o_content> and <o_styles> can be passed to extract_odt_content_item() or
33 extract_odt_write_template() to be inserted into an odt archive. */
34
35
36 int extract_odt_write_template(
37 extract_alloc_t* alloc,
38 extract_astring_t* contentss,
39 int contentss_num,
40 extract_odt_styles_t* styles,
41 images_t* images,
42 const char* path_template,
43 const char* path_out,
44 int preserve_dir
45 );
46 /* Creates a new odt file using a provided template document.
47
48 Uses the 'zip' and 'unzip' commands internally.
49
50 contents
51 contentss_num
52 Content to be inserted into word/document.xml.
53 document
54 .
55 images
56 Information about images.
57 path_template
58 Name of odt file to use as a template.
59 path_out
60 Name of odt file to create. Must not contain single-quote, double quote,
61 space or ".." sequence - these will force EINVAL error because they could
62 make internal shell commands unsafe.
63 preserve_dir
64 If true, we don't delete the temporary directory <path_out>.dir containing
65 unzipped odt content.
66 */
67
68
69 int extract_odt_content_item(
70 extract_alloc_t* alloc,
71 extract_astring_t* contentss,
72 int contentss_num,
73 extract_odt_styles_t* styles,
74 images_t* images,
75 const char* name,
76 const char* text,
77 char** text2
78 );
79 /* Determines content of <name> in odt archive.
80
81 content
82 content_length
83 Text to insert if <name> is word/document.xml.
84 styles
85 Text containing style definitions.
86 images
87 Information about images. If <name> is word/document.xml we insert
88 relationship information mapping from image ids to image names;
89 <text> should already contain reference ids for images. If <name> is
90 [Content_Types].xml we insert information about image types.
91 name
92 Path within the odt zip archive.
93 text
94 Content of <name> in template odt file.
95 text2
96 Out-param. Set to NULL if <text> should be used unchanged. Otherwise set to
97 point to desired text, allocated with malloc() which caller should free.
98 */
99
100 #endif