branch develop updated (7fb9863 -> 51fa05f)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository faxtomail. See http://git.codelutin.com/faxtomail.git from 7fb9863 fixes #6802 Les dossiers d'archive sont affichés dans l'arbre quand le droit de lecture leur est directement appliqué fixes #6803 Ne pas permettre d'aller au dossier des éléments archivés depuis la recherche new 51fa05f add fix me and catch exceptions caused by the image render in the pdf generation The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 51fa05fda4e60e7099b8001c6b4c8d073e79178d Author: Kevin Morin <morin@codelutin.com> Date: Mon Mar 16 14:12:34 2015 +0100 add fix me and catch exceptions caused by the image render in the pdf generation Summary of changes: .../services/service/EmailServiceImpl.java | 98 +++++++++++----------- 1 file changed, 51 insertions(+), 47 deletions(-) -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository faxtomail. See http://git.codelutin.com/faxtomail.git commit 51fa05fda4e60e7099b8001c6b4c8d073e79178d Author: Kevin Morin <morin@codelutin.com> Date: Mon Mar 16 14:12:34 2015 +0100 add fix me and catch exceptions caused by the image render in the pdf generation --- .../services/service/EmailServiceImpl.java | 98 +++++++++++----------- 1 file changed, 51 insertions(+), 47 deletions(-) diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailServiceImpl.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailServiceImpl.java index 51e9a8f..ed67b3d 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailServiceImpl.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailServiceImpl.java @@ -2129,66 +2129,70 @@ public class EmailServiceImpl extends FaxToMailServiceSupport implements EmailSe ImageRenderer imageRenderer = html2Image.getImageRenderer().setWidth((int) PageSize.A4.getWidth()); org.w3c.dom.Document doc = html2Image.getParser().getDocument(); - ByteArrayOutputStream ooo = new ByteArrayOutputStream(); - imageRenderer.saveImage(ooo, true); - Image image = Image.getInstance(ooo.toByteArray()); + // FIXME kmorin 20150316 npe on imageRenderer.saveImage(baos, true); on windows + try { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + imageRenderer.saveImage(baos, true); + Image image = Image.getInstance(baos.toByteArray()); - float width = image.getWidth(); - float height = image.getHeight(); + float width = image.getWidth(); + float height = image.getHeight(); - // get the format of the page - Rectangle format = PageSize.A4; - if (width > PageSize.A4.getWidth() && width <= PageSize.A4.getHeight()) { - if (height <= PageSize.A4.getWidth()) { - format = PageSize.A4.rotate(); + // get the format of the page + Rectangle format = PageSize.A4; + if (width > PageSize.A4.getWidth() && width <= PageSize.A4.getHeight()) { + if (height <= PageSize.A4.getWidth()) { + format = PageSize.A4.rotate(); - } else { - format = PageSize.A3; + } else { + format = PageSize.A3; + } } - } - if (width > PageSize.A3.getWidth() && width <= PageSize.A3.getHeight()) { - if (height <= PageSize.A3.getWidth()) { - format = PageSize.A3.rotate(); + if (width > PageSize.A3.getWidth() && width <= PageSize.A3.getHeight()) { + if (height <= PageSize.A3.getWidth()) { + format = PageSize.A3.rotate(); - } else { - format = PageSize.A2; + } else { + format = PageSize.A2; + } } - } - if (width > PageSize.A2.getWidth() && width <= PageSize.A2.getHeight()) { - if (height <= PageSize.A2.getWidth()) { - format = PageSize.A2.rotate(); + if (width > PageSize.A2.getWidth() && width <= PageSize.A2.getHeight()) { + if (height <= PageSize.A2.getWidth()) { + format = PageSize.A2.rotate(); - } else { - format = PageSize.A1; + } else { + format = PageSize.A1; + } } - } - if (width > PageSize.A1.getWidth() && width <= PageSize.A1.getHeight()) { - if (height <= PageSize.A1.getWidth()) { - format = PageSize.A1.rotate(); + if (width > PageSize.A1.getWidth() && width <= PageSize.A1.getHeight()) { + if (height <= PageSize.A1.getWidth()) { + format = PageSize.A1.rotate(); - } else { - format = PageSize.A0; + } else { + format = PageSize.A0; + } + } + if (width > PageSize.A0.getWidth()) { + format = PageSize.A0.rotate(); } - } - if (width > PageSize.A0.getWidth()) { - format = PageSize.A0.rotate(); - } - Node style = doc.createElement("style"); - style.setTextContent("@page { size: " + format.getWidth() + "px " + format.getHeight() + "px; }"); - NodeList heads = doc.getElementsByTagName("head"); - Node head; - if (heads.getLength() > 0) { - head = heads.item(0); + Node style = doc.createElement("style"); + style.setTextContent("@page { size: " + format.getWidth() + "px " + format.getHeight() + "px; }"); + NodeList heads = doc.getElementsByTagName("head"); + Node head; + if (heads.getLength() > 0) { + head = heads.item(0); - } else { - head = doc.createElement("head"); - Node html = doc.getDocumentElement(); - html.appendChild(head); - } - head.appendChild(style); + } else { + head = doc.createElement("head"); + Node html = doc.getDocumentElement(); + html.appendChild(head); + } + head.appendChild(style); -// FileUtils.write(new File("/tmp/test.html"), doc.toString()); + } catch (Exception ex) { + doc = html2Image.getParser().getDocument(); + } // convert to pdf ITextRenderer renderer = new ITextRenderer(); -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm