diff --git a/source/java/libs/core-3.1.0.3.jar b/source/java/libs/core-3.1.0.3.jar deleted file mode 100644 index 8bf196e..0000000 Binary files a/source/java/libs/core-3.1.0.3.jar and /dev/null differ diff --git a/source/java/src/org/lucee/extension/pdf/PDFDocument.java b/source/java/src/org/lucee/extension/pdf/PDFDocument.java index 06a0abe..a8bc5ae 100644 --- a/source/java/src/org/lucee/extension/pdf/PDFDocument.java +++ b/source/java/src/org/lucee/extension/pdf/PDFDocument.java @@ -33,7 +33,6 @@ import javax.servlet.http.HttpServletRequest; -import org.icepdf.core.exceptions.PDFException; import org.lucee.extension.pdf.pd4ml.PD4MLPDFDocument; import org.lucee.extension.pdf.util.Margin; import org.lucee.extension.pdf.util.XMLUtil; @@ -329,7 +328,7 @@ public final void setProxypassword(String proxypassword) { /** * @param src - * @throws PDFException + * @throws PageException */ public final void setSrc(String src) throws PageException { if (srcfile != null) throw engine.getExceptionUtil().createApplicationException("You cannot specify both the [src] and [srcfile] attributes"); @@ -338,7 +337,7 @@ public final void setSrc(String src) throws PageException { /** * @param srcfile the srcfile to set - * @throws PDFException + * @throws PageException */ public final void setSrcfile(Resource srcfile) throws PageException { if (src != null) throw engine.getExceptionUtil().createApplicationException("You cannot specify both the [src] and [srcfile] attributes"); diff --git a/source/java/src/org/lucee/extension/pdf/img/PDF2ImageICEpdf.java b/source/java/src/org/lucee/extension/pdf/img/PDF2ImageICEpdf.java deleted file mode 100755 index 5a4d7ff..0000000 --- a/source/java/src/org/lucee/extension/pdf/img/PDF2ImageICEpdf.java +++ /dev/null @@ -1,95 +0,0 @@ -/** - * - * Copyright (c) 2014, the Railo Company Ltd. All rights reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - * - **/ -package org.lucee.extension.pdf.img; - -import java.awt.Color; -import java.awt.Graphics; -import java.awt.image.BufferedImage; - -import org.icepdf.core.pobjects.Catalog; -import org.icepdf.core.pobjects.Document; -import org.icepdf.core.pobjects.PDimension; -import org.icepdf.core.pobjects.PRectangle; -import org.icepdf.core.pobjects.Page; -import org.icepdf.core.util.GraphicsRenderingHints; - -import lucee.loader.engine.CFMLEngineFactory; -import lucee.runtime.exp.PageException; - -public class PDF2ImageICEpdf extends PDF2Image { - - public PDF2ImageICEpdf() { - Document.class.getName();// this is needed, that the class throws a error when the PDFRenderer.jar is not in the enviroment - } - - @Override - public BufferedImage toImage(byte[] input, int pageNumber) throws PageException { - return toImage(input, pageNumber, 100, false); - } - - public BufferedImage toImage(byte[] input, int pageNumber, int scale, boolean transparent) throws PageException { - Document document = toDocument(input); - BufferedImage bi = toBufferedImage(document, pageNumber, scale / 100f, transparent); - document.dispose(); - return bi; - } - - private Document toDocument(byte[] input) throws PageException { - Document document = new Document(); - try { - document.setByteArray(input, 0, input.length, null); - } - catch (Throwable t) { - if (t instanceof ThreadDeath) throw (ThreadDeath) t; - throw CFMLEngineFactory.getInstance().getCastUtil().toPageException(t); - } - return document; - } - - private static BufferedImage toBufferedImage(Document document, int pageNumber, float scale, boolean transparent) { - System.getProperties().put("org.icepdf.core.screen.background", "VALUE_DRAW_NO_BACKGROUND"); - - Catalog cat = document.getCatalog(); - Page page = cat.getPageTree().getPage(pageNumber - 1, document); - PDimension sz = page.getSize(Page.BOUNDARY_CROPBOX, 0f, scale); - - int pageWidth = (int) sz.getWidth(); - int pageHeight = (int) sz.getHeight(); - - BufferedImage image = new BufferedImage(pageWidth, pageHeight, transparent ? BufferedImage.TYPE_INT_ARGB : BufferedImage.TYPE_INT_RGB); - Graphics g = image.createGraphics(); - if (!transparent) { - PRectangle pageBoundary = page.getPageBoundary(Page.BOUNDARY_CROPBOX); - float x = 0 - pageBoundary.x; - float y = 0 - (pageBoundary.y - pageBoundary.height); - - g.setColor(Color.WHITE); - g.fillRect((int) (0 - x), (int) (0 - y), (int) pageBoundary.width, (int) pageBoundary.height); - } - - page.paint(g, GraphicsRenderingHints.SCREEN, Page.BOUNDARY_CROPBOX, 0f, scale); - - g.dispose(); - cat.getPageTree().releasePage(page, document); - - return image; - - } - -} \ No newline at end of file diff --git a/source/java/src/org/lucee/extension/pdf/util/PDFUtil.java b/source/java/src/org/lucee/extension/pdf/util/PDFUtil.java index 360d93d..04f009e 100755 --- a/source/java/src/org/lucee/extension/pdf/util/PDFUtil.java +++ b/source/java/src/org/lucee/extension/pdf/util/PDFUtil.java @@ -44,7 +44,6 @@ import org.apache.pdfbox.rendering.PDFRenderer; import org.apache.pdfbox.text.PDFTextStripper; import org.lucee.extension.pdf.PDFStruct; -import org.lucee.extension.pdf.img.PDF2ImageICEpdf; import org.lucee.extension.pdf.tag.PDF; import com.lowagie.text.Document;