/* -*- 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; }