improved image handling

This commit is contained in:
jomu
2016-06-14 22:45:06 +00:00
parent d33ff848cf
commit dddb41c130
2 changed files with 71 additions and 9 deletions

View File

@ -3,10 +3,12 @@ package de.muehlencord.shared.pdf;
import freemarker.template.Configuration;
import freemarker.template.Template;
import freemarker.template.TemplateExceptionHandler;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Date;
import javax.imageio.ImageIO;
import org.apache.commons.io.FileUtils;
import org.junit.FixMethodOrder;
import org.junit.Test;
@ -32,9 +34,12 @@ public class PDFDocumentTest {
.addLine("Musterstraße 123")
.addLine("12345 Musterhausen");
doc.addContent(addressContent);
ImageContent logoContent = new ImageContent (doc, 400F,700F, 0.6F);
doc.addContent (logoContent);
String fileName = "c:/temp/logo-verkehrsverein-hoevelh.jpg";
BufferedImage image = ImageIO.read(new File(fileName));
ImageContent logoContent = new ImageContent(doc, 400F, 700F, 0.6F, image);
doc.addContent(logoContent);
TextContent informationContent = new TextContent(doc, 400F, 662F);
informationContent.addLine("Anzeigenabrechnung", "bold");