1 | /* |
2 | SPDX-FileCopyrightText: 2019 Friedrich W. H. Kossebau <kossebau@kde.org> |
3 | |
4 | SPDX-License-Identifier: MIT |
5 | */ |
6 | |
7 | #include "codepdfprinter.h" |
8 | |
9 | #include <QApplication> |
10 | #include <QCommandLineParser> |
11 | |
12 | int main(int argc, char **argv) |
13 | { |
14 | QApplication app(argc, argv); |
15 | |
16 | QCommandLineParser parser; |
17 | parser.addHelpOption(); |
18 | parser.addPositionalArgument(QStringLiteral("source" ), QStringLiteral("The source file to print." )); |
19 | parser.addPositionalArgument(QStringLiteral("pdf" ), QStringLiteral("The PDF file to print to." )); |
20 | parser.process(app); |
21 | |
22 | if (parser.positionalArguments().size() < 2) { |
23 | parser.showHelp(); |
24 | } |
25 | |
26 | CodePdfPrinter printer; |
27 | if (printer.openSourceFile(fileName: parser.positionalArguments().at(i: 0))) { |
28 | printer.printPdfFile(fileName: parser.positionalArguments().at(i: 1)); |
29 | } |
30 | |
31 | return 0; |
32 | } |
33 | |