List of usage examples for java.awt Color Color
public Color(ColorSpace cspace, float[] components, float alpha)
From source file:MultipleLinedTextPDF.java
public static void main(String[] args) { Document document = new Document(); try {/*from ww w .ja v a2 s . co m*/ PdfWriter.getInstance(document, new FileOutputStream("MultipleLinedTextPDF.pdf")); document.open(); Chunk chunk; chunk = new Chunk("Multiple lines"); chunk.setUnderline(new Color(0xFF, 0x00, 0x00), 0.0f, 0.3f, 0.0f, 0.4f, PdfContentByte.LINE_CAP_ROUND); chunk.setUnderline(new Color(0x00, 0xFF, 0x00), 3.0f, 0.0f, 0.0f, -0.5f, PdfContentByte.LINE_CAP_PROJECTING_SQUARE); chunk.setUnderline(new Color(0x00, 0x00, 0xFF), 0.0f, 0.2f, 15.0f, 0.0f, PdfContentByte.LINE_CAP_BUTT); document.add(chunk); } catch (Exception ioe) { System.err.println(ioe.getMessage()); } document.close(); }
From source file:DifferentTextBackgroundSuperscript.java
public static void main(String[] args) { Document document = new Document(); try {//www.j av a 2 s . co 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:ChunksFontBackgroundPDF.java
public static void main(String[] args) { Document document = new Document(); try {/*from w w w . ja va2 s . c o 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:MainClass.java
public static void main(String[] args) throws Exception { Document document = new Document(); PdfWriter.getInstance(document, new FileOutputStream("2.pdf")); document.open();//from ww w .j av a 2 s. c o m float textrise = 6.0f; Chunk c; for (String s : "this is a test".split(" ")) { c = new Chunk(s); c.setTextRise(textrise); c.setUnderline(new Color(0xC0, 0xC0, 0xC0), 0.2f, 0.0f, 0.0f, 0.0f, PdfContentByte.LINE_CAP_BUTT); document.add(c); textrise -= 2.0f; } document.close(); }
From source file:ChunksTextRiseUnderLinePDF.java
public static void main(String[] args) { Document document = new Document(); try {//from w w w.j av a 2 s . co 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:TextBackgroundPDF.java
public static void main(String[] args) { Document document = new Document(); try {//from ww w .j a v a 2 s .co m PdfWriter.getInstance(document, new FileOutputStream("TextBackgroundPDF.pdf")); document.open(); Chunk high = new Chunk("highlighted"); high.setBackground(new Color(0xFF, 0x00, 0x00)); Paragraph p = new Paragraph("The following chunk is "); p.add(high); document.add(p); } catch (Exception ioe) { System.err.println(ioe.getMessage()); } document.close(); }
From source file:SettingBackgroundSizePDF.java
public static void main(String[] args) { Document document = new Document(); try {//w ww . j a va2 s . c om PdfWriter.getInstance(document, new FileOutputStream("SettingBackgroundSizePDF.pdf")); document.open(); Chunk c = new Chunk("background chunk"); c.setBackground(new Color(0xFF, 0x00, 0x00), 5f, 30f, -10f, 0f); 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:TableCellColorPDF.java
public static void main(String[] args) { Document document = new Document(); try {//w w w. j a va2 s. com PdfWriter.getInstance(document, new FileOutputStream("TableCellColorPDF.pdf")); document.open(); PdfPTable table = new PdfPTable(1); PdfPCell cell = new PdfPCell(new Paragraph("cell test1")); cell.setBorderColor(new Color(255, 0, 0)); table.addCell(cell); cell = new PdfPCell(new Paragraph("cell test2")); table.addCell(cell); document.add(table); } catch (Exception e) { System.err.println(e.getMessage()); } document.close(); }
From source file:MainClass.java
public static void main(String[] args) throws Exception { Document document = new Document(); PdfWriter.getInstance(document, new FileOutputStream("2.pdf")); document.open();/*from w ww . j av a2 s . com*/ Font font = new Font(Font.COURIER, 20); Chunk chunk = new Chunk("this is a test.", font); chunk.setTextRenderMode(PdfContentByte.TEXT_RENDER_MODE_FILL, 0f, new Color(0xFF, 0x00, 0x00)); document.add(new Paragraph(chunk)); document.close(); }
From source file:MainClass.java
public static void main(String[] args) throws Exception { Document document = new Document(); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("2.pdf")); document.open();/*w w w. j a v a 2 s . com*/ PdfContentByte cb = writer.getDirectContent(); PdfPatternPainter ellipse = cb.createPattern(15, 10, 20, 25); ellipse.setColorFill(new Color(0xFF, 0xFF, 0x00)); ellipse.setColorStroke(new Color(0xFF, 0x00, 0x00)); ellipse.ellipse(2f, 2f, 13f, 8f); ellipse.fillStroke(); PatternColor ellipses = new PatternColor(ellipse); cb.setColorFill(ellipses); cb.rectangle(144, 716, 72, 72); cb.fillStroke(); document.close(); }