aboutsummaryrefslogtreecommitdiffstats
path: root/include/qpdf/qpdfjob-c.h
blob: fdc3511cc9b4d1dbe768ae9fa7d8d70f272a9f15 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/* Copyright (c) 2005-2022 Jay Berkenbilt
 *
 * This file is part of qpdf.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * Versions of qpdf prior to version 7 were released under the terms
 * of version 2.0 of the Artistic License. At your option, you may
 * continue to consider qpdf to be licensed under those terms. Please
 * see the manual for additional information.
 */

#ifndef QPDFJOB_C_H
#define QPDFJOB_C_H

/*
 * This file defines a basic "C" API for QPDFJob. See also qpdf-c.h,
 * which defines an API that exposes more of the library's API. This
 * API is primarily intended to make it simpler for programs in
 * languages other than C++ to incorporate functionality that could be
 * run directly from the command-line.
 */

#include <qpdf/DLL.h>
#include <string.h>
#ifndef QPDF_NO_WCHAR_T
# include <wchar.h>
#endif

/*
 * This file provides a minimal wrapper around QPDFJob. See
 * examples/qpdfjob-c.c for an example of its use.
 */

#ifdef __cplusplus
extern "C" {
#endif
    /* This function does the equivalent of running the qpdf
     * command-line with the given arguments and returns the exit code
     * that qpdf would use. argv must be a null-terminated array of
     * null-terminated UTF8-encoded strings. If calling this from
     * wmain on Windows, use qpdfjob_run_from_wide_argv instead.
     */
    QPDF_DLL
    int qpdfjob_run_from_argv(char const* const argv[]);

#ifndef QPDF_NO_WCHAR_T
    /* This function is the same as qpdfjob_run_from_argv except argv
     * is encoded with wide characters. This would be suitable for
     * calling from a Windows wmain function.
     */
    QPDF_DLL
    int qpdfjob_run_from_wide_argv(wchar_t const* const argv[]);
#endif /* QPDF_NO_WCHAR_T */

    /* This function runs QPDFJob from a job JSON file. See the "QPDF
     * Job" section of the manual for details. The JSON string must be
     * UTF8-encoded. It returns the error code that qpdf would return
     * with the equivalent command-line invocation.
     */
    QPDF_DLL
    int qpdfjob_run_from_json(char const* json);

#ifdef __cplusplus
}
#endif


#endif /* QPDFJOB_C_H */