| 1 |
/** |
| 2 |
* SPDX-FileCopyrightText: (C) 2005 Dominik Seichter <[email protected]> |
| 3 |
* SPDX-License-Identifier: GPL-2.0-or-later |
| 4 |
*/ |
| 5 |
|
| 6 |
#include "ImageExtractor.h" |
| 7 |
|
| 8 |
#include <cstdio> |
| 9 |
#include <cstdlib> |
| 10 |
|
| 11 |
using namespace std; |
| 12 |
using namespace PoDoFo; |
| 13 |
|
| 14 |
void print_help() |
| 15 |
{ |
| 16 |
printf("Usage: podofoimgextract [inputfile] [outputdirectory]\n\n"); |
| 17 |
printf("\nPoDoFo Version: %s\n\n", PODOFO_VERSION_STRING); |
| 18 |
} |
| 19 |
|
| 20 |
void Main(const cspan<string_view>& args) |
| 21 |
{ |
| 22 |
ImageExtractor extractor; |
| 23 |
|
| 24 |
if (args.size() != 3) |
| 25 |
{ |
| 26 |
print_help(); |
| 27 |
exit(-1); |
| 28 |
} |
| 29 |
|
| 30 |
auto input = args[1]; |
| 31 |
auto output = args[2]; |
| 32 |
|
| 33 |
extractor.Init(input, output); |
| 34 |
|
| 35 |
unsigned imageCount = extractor.GetNumImagesExtracted(); |
| 36 |
printf("Extracted %u images successfully from the PDF file.\n", imageCount); |
| 37 |
} |