diff options
Diffstat (limited to 'src/main.cc')
-rw-r--r-- | src/main.cc | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/main.cc b/src/main.cc new file mode 100644 index 0000000..ecb986b --- /dev/null +++ b/src/main.cc @@ -0,0 +1,57 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */ +/* + * main.cc + * Copyright (C) 2018 David Barksdale <amatus@amat.us> + * + * pdf2gerber is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * pdf2gerber is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <iostream> +#include <GlobalParams.h> +#include <PDFDocFactory.h> +#include <PDFDoc.h> +#include <goo/GooString.h> +#include "gerber-output-dev.h" + +int main() +{ + int ret = 0; + PDFDocFactory factory; + PDFDoc *doc = factory.createPDFDoc(GooString("fd://0")); + GerberOutputDev *gerber_out; + + if (!doc->isOk()) { + std::cerr << "Unable to read document (" << doc->getErrorCode() << ")" + << std::endl; + ret = -1; + goto free_doc; + } + std::cerr << "Read document with " << doc->getNumPages() << " page(s)" + << std::endl; + globalParams = new GlobalParams(); + gerber_out = new GerberOutputDev(); + doc->displayPage(gerber_out, // out + 1, // page + 72.0, // hDPI + 72.0, // vDPI + 0, // rotate + false, // useMediaBox + false, // crop + false); // printing + delete gerber_out; +free_doc: + delete doc; + return ret; +} + |