List of usage examples for java.awt Color Color
public Color(ColorSpace cspace, float[] components, float alpha)
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 a v a 2s . c o m Font font = new Font(Font.COURIER, 20); Chunk chunk = new Chunk("this is a test.", font); chunk.setTextRenderMode(PdfContentByte.TEXT_RENDER_MODE_INVISIBLE, 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.getInstance(document, new FileOutputStream("2.pdf")); document.open();/*w w w.j av a 2 s .c om*/ Font font = new Font(Font.COURIER, 20); Chunk chunk = new Chunk("this is a test.", font); chunk.setTextRenderMode(PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE, 0f, new Color(0xFF, 0x00, 0x00)); document.add(new Paragraph(chunk)); document.close(); }
From source file:SpotColorsspc_rgbPDF.java
public static void main(String[] args) { Document document = new Document(); try {/* w ww .j a v a 2 s . c o m*/ PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("SpotColorsspc_rgbPDF.pdf")); document.open(); PdfContentByte cb = writer.getDirectContent(); PdfSpotColor spc_rgb = new PdfSpotColor("PANTONE 147", 0.9f, new Color(114, 94, 38)); cb.setColorStroke(spc_rgb, .5f); cb.setLineWidth(10f); cb.rectangle(100, 700, 100, 100); cb.stroke(); } catch (Exception de) { de.printStackTrace(); } 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 va 2 s . c om*/ PdfContentByte cb = writer.getDirectContent(); PdfShading radial = PdfShading.simpleRadial(writer, 200, 500, 50, 300, 500, 100, new Color(255, 247, 148), new Color(247, 138, 107), false, false); cb.paintShading(radial); 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();/* w ww . jav a 2 s .com*/ Paragraph p1 = new Paragraph("this is a test"); p1.add(new Chunk(" another test ", FontFactory.getFont(FontFactory.HELVETICA, 12, Font.NORMAL, new Color(0, 0, 255))) .setLocalGoto("jump")); p1.add("the lazy dog."); Paragraph p2 = new Paragraph("test"); Paragraph p3 = new Paragraph("test 2"); p3.add(new Chunk(" has jumped ", FontFactory.getFont(FontFactory.HELVETICA, 12, Font.NORMAL, new Color(0, 255, 0))) .setLocalDestination(" cat ")); p3.add(" dog."); document.add(p1); document.add(p2); document.add(p2); document.add(p2); document.add(p2); document.add(p2); document.add(p2); document.add(p2); document.add(p3); document.close(); }
From source file:MainClass.java
public static void main(String[] args) throws Exception { Document document = new Document(); PdfWriter writerA = PdfWriter.getInstance(document, new FileOutputStream("2.pdf")); PdfWriter writerB = PdfWriter.getInstance(document, new FileOutputStream("3.pdf")); document.open();/*from w w w.ja v a 2s . c o m*/ Font font = FontFactory.getFont(FontFactory.HELVETICA, 12, Font.UNDERLINE, new Color(0, 0, 255)); Paragraph p1 = new Paragraph("1"); Chunk chunk = new Chunk(" 2", font); chunk.setRemoteGoto("dog.pdf", "2"); p1.add(chunk); Paragraph p2 = new Paragraph("test"); writerB.pause(); document.add(p1); writerB.resume(); document.add(p2); writerA.resume(); writerB.pause(); document.newPage(); document.add(new Paragraph("page 2")); document.newPage(); document.add(new Paragraph("page 3")); writerB.resume(); document.close(); }
From source file:MainClass.java
public static void main(String[] args) throws Exception { Document document = new Document(); PdfWriter writerA = PdfWriter.getInstance(document, new FileOutputStream("2.pdf")); PdfWriter writerB = PdfWriter.getInstance(document, new FileOutputStream("3.pdf")); document.open();/*from www . ja v a 2s . co m*/ Font font = FontFactory.getFont(FontFactory.HELVETICA, 12, Font.UNDERLINE, new Color(0, 0, 255)); Paragraph p1 = new Paragraph("1"); Chunk chunk = new Chunk(" 2", font); chunk.setRemoteGoto("dog.pdf", "2"); p1.add(chunk); Paragraph p3 = new Paragraph("test"); p3.add(new Chunk("test.", font).setLocalDestination("2")); writerB.pause(); document.add(p1); writerB.resume(); writerA.pause(); document.add(p3); writerB.pause(); document.newPage(); document.add(new Paragraph("page 2")); document.newPage(); document.add(new Paragraph("page 3")); writerB.resume(); document.close(); }
From source file:MainClass.java
public static void main(String[] args) throws Exception { Document document = new Document(); PdfWriter writerA = PdfWriter.getInstance(document, new FileOutputStream("2.pdf")); PdfWriter writerB = PdfWriter.getInstance(document, new FileOutputStream("3.pdf")); document.open();//from w w w . j a v a2 s. co m Font font = FontFactory.getFont(FontFactory.HELVETICA, 12, Font.UNDERLINE, new Color(0, 0, 255)); Paragraph p1 = new Paragraph("1"); Chunk chunk = new Chunk(" 2", font); chunk.setRemoteGoto("dog.pdf", "2"); p1.add(chunk); Paragraph p4 = new Paragraph("jump to a "); p4.add(new Chunk("specific page on another document", font).setRemoteGoto("3.pdf", 3)); writerB.pause(); document.add(p1); writerB.resume(); writerA.pause(); document.add(p4); writerB.pause(); document.newPage(); document.add(new Paragraph("page 2")); document.newPage(); document.add(new Paragraph("page 3")); writerB.resume(); document.close(); }
From source file:AddingMorethanOneChunkPDF.java
public static void main(String[] args) { Document document = new Document(); try {//w ww . j a v a2s. c o m PdfWriter.getInstance(document, new FileOutputStream("AddingMorethanOneChunkPDF.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); Chunk test1 = new Chunk("another text"); document.add(test1); } catch (Exception e) { System.err.println(e.getMessage()); } document.close(); }
From source file:AddingAWTImageColorPDF.java
public static void main(String[] args) { Document document = new Document(); try {//from w w w . java 2 s. co m PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("AddingAWTImageColorPDF.pdf")); document.open(); PdfContentByte cb = writer.getDirectContent(); java.awt.Image awtImage = Toolkit.getDefaultToolkit().createImage("logo.png"); Image image = Image.getInstance(awtImage, new Color(0x00, 0x00, 0xFF), true); image.setAbsolutePosition(100, 500); cb.addImage(image); } catch (Exception e) { System.err.println(e.getMessage()); } document.close(); }