List of usage examples for java.lang Exception getMessage
public String getMessage()
From source file:ChunksFontBackgroundPDF.java
public static void main(String[] args) { Document document = new Document(); try {//w w w . j av a2 s . co m PdfWriter.getInstance(document, new FileOutputStream("ChunksFontBackgroundPDF.pdf")); document.open(); Chunk test = new Chunk("some text"); float superscript = 8.0f; test.setTextRise(superscript); test.setBackground(new Color(0xFF, 0xDE, 0xAD)); test.setAnchor("http://www.java2s.com"); test.setAnchor(new URL("http://www.java2s.com")); document.add(test); } catch (Exception e) { System.err.println(e.getMessage()); } document.close(); }
From source file:CirclesPDF.java
public static void main(String[] args) { Document document = new Document(); try {//from w w w . ja va 2 s .c o m PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("CirclesPDF.pdf")); document.open(); PdfContentByte cb = writer.getDirectContent(); cb.circle(250.0f, 500.0f, 200.0f); cb.circle(250.0f, 500.0f, 150.0f); cb.circle(350.0f, 300.0f, 150.0f); cb.stroke(); } catch (Exception e) { System.err.println(e.getMessage()); } document.close(); }
From source file:ChunksTextRiseUnderLinePDF.java
public static void main(String[] args) { Document document = new Document(); try {//from w w w. j a v a2 s. c o m PdfWriter.getInstance(document, new FileOutputStream("ChunksTextRiseUnderLinePDF.pdf")); document.open(); Chunk test = new Chunk("some text"); float subscript = -8.0f; test.setTextRise(subscript); test.setUnderline(new Color(0xFF, 0x00, 0x00), 3.0f, 0.0f, -5.0f + subscript, 0.0f, PdfContentByte.LINE_CAP_ROUND); document.add(test); } catch (Exception e) { System.err.println(e.getMessage()); } document.close(); }
From source file:DrawArcPDF.java
public static void main(String[] args) { Document document = new Document(); try {/* www.ja va2s .c o m*/ PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("DrawArcPDF.pdf")); document.open(); PdfContentByte cb = writer.getDirectContent(); PdfTemplate template = cb.createTemplate(500, 200); template.setLineWidth(2f); template.arc(20f, 20f, 00f, -40f, 90f, 45f); template.stroke(); template.setLineWidth(12f); cb.addTemplate(template, 0, 1, -1, 0, 500, 200); } catch (Exception e) { System.err.println(e.getMessage()); } document.close(); }
From source file:UnderlinedTextPDF.java
public static void main(String[] args) { Document document = new Document(); try {// ww w .j a va2 s . c om PdfWriter.getInstance(document, new FileOutputStream("UnderlinedTextPDF.pdf")); document.open(); Chunk underlined = new Chunk("underlined"); underlined.setUnderline(0.2f, -2f); Paragraph p = new Paragraph("The following chunk is "); p.add(underlined); document.add(p); } catch (Exception ioe) { System.err.println(ioe.getMessage()); } document.close(); }
From source file:StrictImageSequencePDF.java
public static void main(String[] args) { Document document = new Document(); try {// w ww . jav a2 s .co m PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("StrictImageSequencePDF.pdf")); writer.setStrictImageSequence(true); document.open(); Image image = Image.getInstance("logo.png"); for (int i = 0; i < 20; i++) { document.add(image); } } catch (Exception e) { System.err.println(e.getMessage()); } document.close(); }
From source file:NewPageToStartANewPagePDF.java
public static void main(String[] args) { Document document = new Document(); try {/*from w ww .j ava2 s . c o m*/ PdfWriter.getInstance(document, new FileOutputStream("NewPageToStartANewPagePDF.pdf")); document.open(); document.add(new Paragraph("A")); document.newPage(); document.add(new Paragraph("B")); document.newPage(); document.newPage(); document.newPage(); document.add(new Paragraph("C")); } catch (Exception ioe) { System.err.println(ioe.getMessage()); } document.close(); }
From source file:XandYcoordinatesPdfContentByteText.java
public static void main(String[] args) { Document document = new Document(); try {//from ww w . j a v a2s . c o m PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("XandYcoordinatesPdfContentByteText.pdf")); document.open(); PdfContentByte cb = writer.getDirectContent(); BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.NOT_EMBEDDED); cb.beginText(); cb.setFontAndSize(bf, 12); cb.showTextAligned(PdfContentByte.ALIGN_CENTER, "text", 200, 300, 0); cb.endText(); } catch (Exception e) { System.err.println(e.getMessage()); } document.close(); }
From source file:DifferentTextBackgroundSuperscript.java
public static void main(String[] args) { Document document = new Document(); try {/*from w ww .ja v a 2s . c o m*/ PdfWriter.getInstance(document, new FileOutputStream("DifferentTextBackgroundSuperscript.pdf")); document.open(); Chunk c = new Chunk("background"); c.setTextRise(8); c.setBackground(new Color(0xFF, 0x00, 0x00)); Paragraph p = new Paragraph("The following chunk is "); p.add(c); document.add(p); } catch (Exception ioe) { System.err.println(ioe.getMessage()); } document.close(); }
From source file:ShapeDashLinePDF.java
public static void main(String[] args) { Document document = new Document(); try {//from ww w. ja v a2 s. c o m PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("ShapeDashLinePDF.pdf")); document.open(); PdfContentByte cb = writer.getDirectContent(); cb.setLineWidth(10f); cb.setLineDash(3, 3, 0); cb.moveTo(100, 700); cb.lineTo(200, 800); cb.stroke(); } catch (Exception e) { System.err.println(e.getMessage()); } document.close(); }