comparison mupdf-source/thirdparty/extract/src/docx.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_DOCX_H
2 #define ARTIFEX_EXTRACT_DOCX_H
3
4 /* Only for internal use by extract code. */
5
6 /* Things for creating docx files. */
7
8 /*
9 Make *o_content point to a string containing all paragraphs, images and
10 tables (tables as of 2021-07-22) in *document in docx XML format.
11
12 This string can be passed to extract_docx_content_item() or
13 extract_docx_write_template() to be inserted into a docx archive's
14 word/document.xml.
15 */
16 int extract_document_to_docx_content(
17 extract_alloc_t *alloc,
18 document_t *document,
19 int spacing,
20 int rotation,
21 int images,
22 extract_astring_t *content);
23
24
25 /*
26 Creates a new docx file using a provided template document.
27
28 Uses the 'zip' and 'unzip' commands internally.
29
30 contentss
31 contentss_num
32 Content to be inserted into word/document.xml.
33 document
34 .
35 images
36 Information about images.
37 path_template
38 Name of docx file to use as a template.
39 path_out
40 Name of docx file to create. Must not contain single-quote, double quote,
41 space or ".." sequence - these will force EINVAL error because they could
42 make internal shell commands unsafe.
43 preserve_dir
44 If true, we don't delete the temporary directory <path_out>.dir containing
45 unzipped docx content.
46 */
47 int extract_docx_write_template(
48 extract_alloc_t *alloc,
49 extract_astring_t *contentss,
50 int contentss_num,
51 images_t *images,
52 const char *path_template,
53 const char *path_out,
54 int preserve_dir);
55
56
57 /*
58 Determine content of <name> in docx archive.
59
60 content
61 content_length
62 Text to insert if <name> is word/document.xml.
63 images
64 Information about images. If <name> is word/document.xml we insert
65 relationship information mapping from image ids to image names;
66 <text> should already contain reference ids for images. If <name> is
67 [Content_Types].xml we insert information about image types.
68 name
69 Path within the docx zip archive.
70 text
71 Content of <name> in template docx file.
72 text2
73 Out-param. Set to NULL if <text> should be used unchanged. Otherwise set
74 to point to desired text, allocated with malloc() which caller should free.
75 */
76 int extract_docx_content_item(
77 extract_alloc_t *alloc,
78 extract_astring_t *contentss,
79 int contentss_num,
80 images_t *images,
81 const char *name,
82 const char *text,
83 char **text2);
84
85 #endif