/*Exception in thread "main" java.lang.IllegalArgumentException: Invalid ICC Profile Data at java.awt.color.ICC_Profile.getInstance(Unknown Source) at com.lowagie.text.Jpeg.processParameters(Unknown Source) at com.lowagie.text.Jpeg.<init>(Unknown Source) at com.lowagie.text.Image.getInstance(Unknown Source) at com.lowagie.text.Image.getInstance(Unknown Source) at iTextServlet.main(iTextServlet.java:53)*/import java.io.FileOutputStream;import java.io.IOException;import com.lowagie.text.Document;import com.lowagie.text.DocumentException;import com.lowagie.text.Paragraph;import com.lowagie.text.pdf.PdfWriter;import com.lowagie.text.Font;import com.lowagie.text.*;import com.lowagie.text.Image;import com.lowagie.text.pdf.PdfContentByte;import com.lowagie.text.pdf.BaseFont;public class iTextServlet { /** * Generates a PDF file with the text 'Hello World' * * @param args no arguments needed here */ public static void main(String[] args) { String header= "Sitzungsprotokoll"; String content[]= new String[6]; content[0]="hallo1"; content[1]="hallo2"; content[2]="hallo3"; content[3]="hallo4"; content[4]="hallo5"; content[5]="hallo6"; System.out.println("Hello World"); // step 1: creation of a document-object Document document = new Document(); try { // step 2: // we create a writer that listens to the document // and directs a PDF-stream to a file PdfWriter writer= PdfWriter.getInstance(document, new FileOutputStream("HelloWorld.pdf")); // step 3: we open the document document.open(); PdfContentByte cb = writer.getDirectContent(); // step 4: we add a paragraph to the document Image jpg = Image.getInstance("logo.jpg"); document.add(jpg); cb.beginText(); BaseFont bf1 = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.NOT_EMBEDDED); cb.setFontAndSize(bf1, 25); cb.showTextAligned(PdfContentByte.ALIGN_CENTER, header, 300, 730, 0); cb.endText(); cb.beginText(); BaseFont bf3 = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.NOT_EMBEDDED); cb.setFontAndSize(bf3, 14); int j=650; for(int i=0; i<=5; i++){ cb.showTextAligned(PdfContentByte.ALIGN_LEFT, content[i], 50, j=j-20, 0); } cb.endText(); } catch (DocumentException e) { System.err.println(e.getMessage()); } catch (IOException e) { System.err.println(e.getMessage()); } // step 5: we close the document document.close(); }}