From 8bf7db5feeba468ae6cbfe642b0aed899b00d535 Mon Sep 17 00:00:00 2001 From: tknall Date: Mon, 10 Dec 2007 08:04:59 +0000 Subject: Absolute filename for image declaration fixed. git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@237 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- .../wag/egov/egiz/pdf/PDFSignatureObjectIText.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFSignatureObjectIText.java b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFSignatureObjectIText.java index 6c609ae..0ad8583 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFSignatureObjectIText.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFSignatureObjectIText.java @@ -293,14 +293,23 @@ public class PDFSignatureObjectIText implements PDFSignatureObject try { String img_ref = (String) abstractCell.getValue(); - String img_location = SettingsReader.relocateFile(img_ref); - File img_file = new File (img_location); + // fixed by tknall start + File img_file = new File(img_ref); + if (!img_file.isAbsolute()) { + logger_.debug("Image file declaration is relative. Prepending path of resources directory."); + img_file = new File(SettingsReader.relocateFile(img_ref)); + } else { + logger_.debug("Image file declaration is absolute. Skipping file relocation."); + } +// String img_location = SettingsReader.relocateFile(img_ref); +// File img_file = new File (img_location); if (!img_file.exists()) { logger_.debug("Image file \"" + img_file.getCanonicalPath() + "\" doesn't exist."); throw new PDFDocumentException(220, "Image file \"" + img_file.getCanonicalPath() + "\" doesn't exist."); } - Image image = Image.getInstance(img_location); + Image image = Image.getInstance(img_file.getCanonicalPath()); + // tknall end pdf_cell = new PdfPCell(image, true); setCellStyle(pdf_cell, cell_style); } -- cgit v1.2.3