From e05d90be8cf4b5e2144253ee839832565045abe6 Mon Sep 17 00:00:00 2001 From: David Barksdale Date: Tue, 1 Jan 2019 17:57:24 -0600 Subject: Initial commit before things get crazy This seems to be interpreting everything in some pdf files I have generated from McCAD (via printing to postscript) except for text. The scale also needs to be considered. --- src/main.cc | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 src/main.cc (limited to 'src/main.cc') 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 + * + * 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 . + */ + +#include +#include +#include +#include +#include +#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; +} + -- cgit v1.2.3-18-g5258