Chunk imgChunk = new Chunk( img, 0, 0 ); imgChunk.setGenericTag("imgTag");
/** * Create an index entry. * * @param text The text. * @param in1 The first level. * @param in2 The second level. * @param in3 The third level. */ public void create(final Chunk text, final String in1, final String in2, final String in3) { String tag = "idx_" + indexcounter++; text.setGenericTag(tag); text.setLocalDestination(tag); Entry entry = new Entry(in1, in2, in3, tag); indexentry.add(entry); }
/** * Create an index entry. * * @param text The text. * @param in1 The first level. * @param in2 The second level. * @param in3 The third level. */ public void create(final Chunk text, final String in1, final String in2, final String in3) { String tag = "idx_" + indexcounter++; text.setGenericTag(tag); text.setLocalDestination(tag); Entry entry = new Entry(in1, in2, in3, tag); indexentry.add(entry); }
/** * Create an index entry. * * @param text The text for the Chunk. * @param in1 The first level. * @param in2 The second level. * @param in3 The third level. * @return Returns the Chunk. */ public Chunk create(final String text, final String in1, final String in2, final String in3) { Chunk chunk = new Chunk(text); String tag = "idx_" + indexcounter++; chunk.setGenericTag(tag); chunk.setLocalDestination(tag); Entry entry = new Entry(in1, in2, in3, tag); indexentry.add(entry); return chunk; }
/** * Create an index entry. * * @param text The text for the Chunk. * @param in1 The first level. * @param in2 The second level. * @param in3 The third level. * @return Returns the Chunk. */ public Chunk create(final String text, final String in1, final String in2, final String in3) { Chunk chunk = new Chunk(text); String tag = "idx_" + indexcounter++; chunk.setGenericTag(tag); chunk.setLocalDestination(tag); Entry entry = new Entry(in1, in2, in3, tag); indexentry.add(entry); return chunk; }
@Override public void process(int level, Node node, InvocationContext context) { CodeNode cNode = (CodeNode) node; Font font = styles.getFont(Styles.INLINE_CODE_FONT).or(inlineCodeFont(styles)); List<Element> elements = context.iTextContext().emitButCollectElements(new RichText(cNode.getText(), font)); for (Element element : elements) { if (element instanceof Chunk) { Chunk chunk = (Chunk) element; chunk.setBackground(styles.getColor(Styles.INLINE_CODE_BACKGROUND).or(BaseColor.GRAY)); chunk.setGenericTag("code"); } context.append(element); } }
public void manipulatePdf(String src, String dest) throws IOException, DocumentException { PdfReader reader = new PdfReader(src); PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(dest)); AffineTransform transform = AffineTransform.getRotateInstance(Math.PI / 6); stamper.getWriter().setPageEvent(new AddAnnotation(stamper, transform)); PdfContentByte canvas = stamper.getOverContent(1); Font bold = new Font(FontFamily.HELVETICA, 12, Font.BOLD); Chunk chunk = new Chunk("The Best iText Questions on StackOverflow", bold); chunk.setGenericTag("http://pages.itextpdf.com/ebook-stackoverflow-questions.html"); Phrase p = new Phrase("Download "); p.add(chunk); p.add(" and discover more than 200 questions and answers."); canvas.saveState(); canvas.concatCTM(transform); ColumnText ct = new ColumnText(canvas); ct.setSimpleColumn(300, 0, 800, 400); ct.addText(p); ct.go(); canvas.restoreState(); stamper.close(); reader.close(); }
public void manipulatePdf(String src, String dest) throws IOException, DocumentException { PdfReader reader = new PdfReader(src); PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(dest)); AffineTransform transform = AffineTransform.getRotateInstance(Math.PI / 2); stamper.getWriter().setPageEvent(new AddAnnotation(stamper, transform)); PdfContentByte canvas = stamper.getOverContent(1); Font bold = new Font(FontFamily.HELVETICA, 12, Font.BOLD); Chunk chunk = new Chunk("The Best iText Questions on StackOverflow", bold); chunk.setGenericTag("http://pages.itextpdf.com/ebook-stackoverflow-questions.html"); Phrase p = new Phrase("Download "); p.add(chunk); p.add(" and discover more than 200 questions and answers."); canvas.saveState(); canvas.concatCTM(transform); ColumnText ct = new ColumnText(canvas); ct.setSimpleColumn(36, -559, 806, -36); ct.addText(p); ct.go(); canvas.restoreState(); stamper.close(); reader.close(); }