| 1 |
/** |
| 2 |
* SPDX-FileCopyrightText: (C) 2010 Pierre Marchand <[email protected]> |
| 3 |
* SPDX-License-Identifier: GPL-2.0-or-later |
| 4 |
*/ |
| 5 |
|
| 6 |
#include <podofo/podofo.h> |
| 7 |
|
| 8 |
#include <string> |
| 9 |
#include <iostream> |
| 10 |
|
| 11 |
#include "boxsetter.h" |
| 12 |
|
| 13 |
using namespace std; |
| 14 |
using namespace PoDoFo; |
| 15 |
|
| 16 |
void print_help() |
| 17 |
{ |
| 18 |
cerr << "Usage: podofobox [inputfile] [outpufile] [box] [left] [bottom] [width] [height]" << endl; |
| 19 |
cerr << "Box is one of media crop bleed trim art." << endl; |
| 20 |
cerr << "Give values * 100 as integers (avoid locale headaches with strtod)" << endl; |
| 21 |
cerr << endl << endl << "PoDoFo Version: " << PODOFO_VERSION_STRING << endl << endl; |
| 22 |
} |
| 23 |
|
| 24 |
void Main(const cspan<string_view>& args) |
| 25 |
{ |
| 26 |
if (args.size() != 8) |
| 27 |
{ |
| 28 |
print_help(); |
| 29 |
exit(-1); |
| 30 |
} |
| 31 |
|
| 32 |
string_view input = args[1]; |
| 33 |
string_view output = args[2]; |
| 34 |
string_view box = args[3]; |
| 35 |
|
| 36 |
double left = double(atol(args[4].data())) / 100.0; |
| 37 |
double bottom = double(atol(args[5].data())) / 100.0; |
| 38 |
double width = double(atol(args[6].data())) / 100.0; |
| 39 |
double height = double(atol(args[7].data())) / 100.0; |
| 40 |
Rect rect(left, bottom, width, height); |
| 41 |
|
| 42 |
BoxSetter bs(input, output, box, rect); |
| 43 |
} |