List of usage examples for com.itextpdf.text Anchor setName
public void setName(final String name)
Anchor
. From source file:Pdfsave.java
private static void addContent(Document document) throws DocumentException { Anchor anchor = new Anchor("First Chapter", catFont); anchor.setName("First Chapter"); // Second parameter is the number of the chapter Chapter catPart = new Chapter(new Paragraph(anchor), 1); Paragraph subPara = new Paragraph("Subcategory 1", subFont); Section subCatPart = catPart.addSection(subPara); subCatPart.add(new Paragraph("Hello")); subPara = new Paragraph("Subcategory 2", subFont); subCatPart = catPart.addSection(subPara); subCatPart.add(new Paragraph("Paragraph 1")); subCatPart.add(new Paragraph("Paragraph 2")); subCatPart.add(new Paragraph("Paragraph 3")); // add a list createList(subCatPart);//ww w. jav a 2 s . c o m Paragraph paragraph = new Paragraph(); addEmptyLine(paragraph, 5); subCatPart.add(paragraph); // add a table createTable(subCatPart); // now add all this to the document document.add(catPart); // Next section anchor = new Anchor("Second Chapter", catFont); anchor.setName("Second Chapter"); // Second parameter is the number of the chapter catPart = new Chapter(new Paragraph(anchor), 1); subPara = new Paragraph("Subcategory", subFont); subCatPart = catPart.addSection(subPara); subCatPart.add(new Paragraph("This is a very important message")); // now add all this to the document document.add(catPart); }
From source file:pdf_demo2.java
private static void addContent(Document document) throws DocumentException { Anchor anchor = new Anchor("First Chapter", titleFont); anchor.setName("First Chapter"); // Second parameter is the number of the chapter ex: 1. Chapter 1 or 2. Chapter 2 Chapter chapter = new Chapter(new Paragraph(anchor), 2); Paragraph subPara = new Paragraph("Subcategory 1", subFont); Section subSection = chapter.addSection(subPara); subSection.add(new Paragraph("Hello")); subPara = new Paragraph("Subcategory 2", subFont); subSection = chapter.addSection(subPara); subSection.add(new Paragraph("Paragraph 1")); subSection.add(new Paragraph("Paragraph 2")); subSection.add(new Paragraph("Paragraph 3")); // add a list createList(subSection);//from w w w . j ava 2 s .c o m Paragraph paragraph = new Paragraph(); addEmptyLine(paragraph, 5); subSection.add(paragraph); // add a table createTable(subSection); // now add all this to the document document.add(chapter); // Next section anchor = new Anchor("Second Chapter", titleFont); anchor.setName("Second Chapter"); // Second parameter is the number of the chapter chapter = new Chapter(new Paragraph(anchor), 2); subPara = new Paragraph("Subcategory", subFont); subSection = chapter.addSection(subPara); subSection.add(new Paragraph("This is a very important message")); // now add all this to the document document.add(chapter); }
From source file:bl.pdf.PDFFile.java
@SuppressWarnings("unused") private void addContent(Document document) throws DocumentException { Anchor anchor = new Anchor("First Chapter", catFont); anchor.setName("First Chapter"); // Second parameter is the number of the chapter Chapter catPart = new Chapter(new Paragraph(anchor), 1); Paragraph subPara = new Paragraph("Subcategory 1", subFont); Section subCatPart = catPart.addSection(subPara); subCatPart.add(new Paragraph("Hello")); subPara = new Paragraph("Subcategory 2", subFont); subCatPart = catPart.addSection(subPara); subCatPart.add(new Paragraph("Paragraph 1")); subCatPart.add(new Paragraph("Paragraph 2")); subCatPart.add(new Paragraph("Paragraph 3")); // Add a list createList(subCatPart);/*from ww w .ja v a 2s.com*/ Paragraph paragraph = new Paragraph(); addEmptyLine(paragraph, 5); subCatPart.add(paragraph); // Add a table createTable(subCatPart); // Now add all this to the document document.add(catPart); // Next section anchor = new Anchor("Second Chapter", catFont); anchor.setName("Second Chapter"); // Second parameter is the number of the chapter catPart = new Chapter(new Paragraph(anchor), 1); subPara = new Paragraph("Subcategory", subFont); subCatPart = catPart.addSection(subPara); subCatPart.add(new Paragraph("This is a very important message")); // Now add all this to the document document.add(catPart); }
From source file:br.unifor.mia.xmpsemantico.xmp.MetadataXmp.java
License:GNU General Public License
/** * create PDF document/*from w ww . j a v a 2 s . c o m*/ * @param filename of new archive PDF * @throws DocumentException * @throws IOException */ public void createPdf() throws IOException { Document document = new Document(); PdfWriter writer = null; try { writer = PdfWriter.getInstance(document, new FileOutputStream(pathPdf)); ByteArrayOutputStream os = new ByteArrayOutputStream(); XmpWriter xmp = new XmpWriter(os); MiaSchema miaSchema = new MiaSchema(); miaSchema.addDescription(this.descricao); miaSchema.setProperty(MiaSchema.DISCIPLINA, this.disciplina); miaSchema.setProperty(MiaSchema.PROFESSOR, this.professor); miaSchema.setProperty(MiaSchema.CARGA_HORARIA, this.cargaHoraria); miaSchema.setProperty(MiaSchema.CREDITOS, this.creditos); xmp.addRdfDescription(miaSchema); xmp.close(); writer.setXmpMetadata(os.toByteArray()); document.open(); document.addAuthor("docsemantico"); Paragraph paragraph = new Paragraph("Quick brown "); Anchor foxRefence = new Anchor("fox"); foxRefence.setReference("#fox"); paragraph.add(foxRefence); paragraph.add(" jumps over the lazy dog."); document.add(paragraph); document.newPage(); Anchor foxName = new Anchor("This is the FOX"); foxName.setName("fox"); document.add(foxName); document.add(new Paragraph(this.texto)); document.close(); } catch (DocumentException e) { e.printStackTrace(); } //teste commit }
From source file:bsf.conn.DBMS.java
private static void addContent(Document document) throws DocumentException { Anchor anchor = new Anchor("Personal Info", catFont); anchor.setName("Personal Info"); // Second parameter is the number of the chapter Chapter catPart = new Chapter(new Paragraph(anchor), 1); Paragraph subPara = new Paragraph(null, smallBold); Section subCatPart = catPart.addSection(subPara); // add a table subPara.setAlignment(Element.ALIGN_LEFT); createTable(subCatPart, info.personalInfo); // now add all this to the document document.add(catPart);//from ww w . jav a 2s.co m // Next section anchor = new Anchor("Personal Information", catFont); anchor.setName("Personal Information"); // Second parameter is the number of the chapter catPart = new Chapter(new Paragraph(anchor), 1); subPara = new Paragraph("Running Details", smallBold); subPara.setAlignment(Element.ALIGN_LEFT); subCatPart = catPart.addSection(subPara); // add a table addEmptyLine(subPara, 3); createTable(subCatPart, info.runningDetails); // now add all this to the document document.add(catPart); // Next section anchor = new Anchor("Personal Information", catFont); anchor.setName("Personal Information"); // Thrd parameter is the number of the chapter catPart = new Chapter(new Paragraph(anchor), 1); subPara = new Paragraph("Leave Details", smallBold); subCatPart = catPart.addSection(subPara); // add a table addEmptyLine(subPara, 3); subPara.setAlignment(Element.ALIGN_LEFT); createTable(subCatPart, info.leaveDetails); // now add all this to the document document.add(catPart); // Next section anchor = new Anchor("Family Information", catFont); anchor.setName("Family Information"); // Fourth parameter is the number of the chapter catPart = new Chapter(new Paragraph(anchor), 1); subPara = new Paragraph(null, smallBold); subCatPart = catPart.addSection(subPara); // add a table subPara.setAlignment(Element.ALIGN_LEFT); addEmptyLine(subPara, 3); createTable(subCatPart, info.familyInfo); // now add all this to the document document.add(catPart); // Next section anchor = new Anchor("Course Information", catFont); anchor.setName("Course Information"); // Fifth parameter is the number of the chapter catPart = new Chapter(new Paragraph(anchor), 1); subPara = new Paragraph(null, smallBold); subCatPart = catPart.addSection(subPara); // add a table subPara.setAlignment(Element.ALIGN_LEFT); addEmptyLine(subPara, 3); createTable(subCatPart, info.courseDetails); // now add all this to the document document.add(catPart); }
From source file:com.auskeny.ems.print.PdfCreator.java
public static void addContent(Document document) throws DocumentException { Anchor anchor = new Anchor("First Chapter", catFont); anchor.setName("First Chapter"); // Second parameter is the number of the chapter Chapter catPart = new Chapter(new Paragraph(anchor), 1); Paragraph subPara = new Paragraph("Subcategory 1", subFont); Section subCatPart = catPart.addSection(subPara); subCatPart.add(new Paragraph("Hello")); subPara = new Paragraph("Subcategory 2", subFont); subCatPart = catPart.addSection(subPara); subCatPart.add(new Paragraph("Paragraph 1")); subCatPart.add(new Paragraph("Paragraph 2")); subCatPart.add(new Paragraph("Paragraph 3")); // add a list createList(subCatPart);/* w ww. j a v a 2 s. c om*/ Paragraph paragraph = new Paragraph(); addEmptyLine(paragraph, 5); subCatPart.add(paragraph); // add a table createTable(subCatPart); // now add all this to the document document.add(catPart); // Next section anchor = new Anchor("Second Chapter", catFont); anchor.setName("Second Chapter"); // Second parameter is the number of the chapter catPart = new Chapter(new Paragraph(anchor), 1); subPara = new Paragraph("Subcategory", subFont); subCatPart = catPart.addSection(subPara); subCatPart.add(new Paragraph("This is a very important message")); // now add all this to the document document.add(catPart); }
From source file:com.bazzar.base.service.impl.CreateInvoicePDF.java
private static void addContent(Document document) throws DocumentException { Anchor anchor = new Anchor("First Chapter", catFont); anchor.setName("First Chapter"); // Second parameter is the number of the chapter Chapter catPart = new Chapter(new Paragraph(anchor), 1); Paragraph subPara = new Paragraph("Subcategory 1", subFont); Section subCatPart = catPart.addSection(subPara); subCatPart.add(new Paragraph("Hello")); subPara = new Paragraph("Subcategory 2", subFont); subCatPart = catPart.addSection(subPara); subCatPart.add(new Paragraph("Paragraph 1")); subCatPart.add(new Paragraph("Paragraph 2")); subCatPart.add(new Paragraph("Paragraph 3")); // Add a list createList(subCatPart);//from w ww . j a v a2 s. c o m Paragraph paragraph = new Paragraph(); addEmptyLine(paragraph, 5); subCatPart.add(paragraph); // Add a table createTable(subCatPart); // Now add all this to the document document.add(catPart); // Next section anchor = new Anchor("Second Chapter", catFont); anchor.setName("Second Chapter"); // Second parameter is the number of the chapter catPart = new Chapter(new Paragraph(anchor), 1); subPara = new Paragraph("Subcategory", subFont); subCatPart = catPart.addSection(subPara); subCatPart.add(new Paragraph("This is a very important message")); // Now add all this to the document document.add(catPart); }
From source file:com.debashubham.dumpy.ChainageCalcActivity.java
private void addContent(Document document) throws DocumentException { Anchor anchor = new Anchor("Survey Report", catFont); anchor.setName("SurveyReport"); // Second parameter is the number of the chapter Chapter catPart = new Chapter(new Paragraph(anchor), 1); Paragraph subPara = new Paragraph("Entries:", subFont); Section subCatPart = catPart.addSection(subPara); Paragraph paragraph = new Paragraph(); addEmptyLine(paragraph, 5);/* w w w .j av a 2 s . com*/ subCatPart.add(paragraph); // add a table createTable(subCatPart); // now add all this to the document document.add(catPart); }
From source file:com.equiworx.util.Main.java
private static void addContent(Document document) throws DocumentException { Anchor anchor = new Anchor("ESTIMATING APP", catFont); anchor.setName("ESTIMATING APP"); // Second parameter is the number of the chapter Chapter catPart = new Chapter(new Paragraph(anchor), 1); Paragraph subPara = new Paragraph("Subcategory 1", subFont); Section subCatPart = catPart.addSection(subPara); subCatPart.add(new Paragraph("Hello")); subPara = new Paragraph("Subcategory 2", subFont); subCatPart = catPart.addSection(subPara); subCatPart.add(new Paragraph("Paragraph 1")); subCatPart.add(new Paragraph("Paragraph 2")); subCatPart.add(new Paragraph("Paragraph 3")); // Add a list createList(subCatPart);/*from www .ja v a 2 s . c om*/ Paragraph paragraph = new Paragraph(); addEmptyLine(paragraph, 5); subCatPart.add(paragraph); // Add a table createTable(subCatPart); // Now add all this to the document document.add(catPart); // Next section anchor = new Anchor("Second Chapter", catFont); anchor.setName("Second Chapter"); // Second parameter is the number of the chapter catPart = new Chapter(new Paragraph(anchor), 1); subPara = new Paragraph("Subcategory", subFont); subCatPart = catPart.addSection(subPara); subCatPart.add(new Paragraph("This is a very important message")); // Now add all this to the document document.add(catPart); }
From source file:com.example.drivequickstart.PDFActivity.java
private void addContent(Document document) throws DocumentException { Anchor anchor = new Anchor("ESTIMATING APP", catFont); anchor.setName("ESTIMATING APP"); // Second parameter is the number of the chapter Chapter catPart = new Chapter(new Paragraph(anchor), 1); Paragraph subPara = new Paragraph("Subcategory 1", subFont); Section subCatPart = catPart.addSection(subPara); subCatPart.add(new Paragraph("Hello")); subPara = new Paragraph("Subcategory 2", subFont); subCatPart = catPart.addSection(subPara); subCatPart.add(new Paragraph("Paragraph 1")); subCatPart.add(new Paragraph("Paragraph 2")); subCatPart.add(new Paragraph("Paragraph 3")); try {/* ww w. j a va 2s .com*/ Drawable d = PDFActivity.this.getResources().getDrawable(R.drawable.ic_launcher); Bitmap bitmap = ((BitmapDrawable) d).getBitmap(); ByteArrayOutputStream stream = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream); Image image = Image.getInstance(stream.toByteArray()); subCatPart.add(image); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } // Add a list createList(subCatPart); Paragraph paragraph = new Paragraph(); addEmptyLine(paragraph, 5); subCatPart.add(paragraph); // Add a table createTable(subCatPart); // Now add all this to the document document.add(catPart); // Next section anchor = new Anchor("Second Chapter", catFont); anchor.setName("Second Chapter"); // Second parameter is the number of the chapter catPart = new Chapter(new Paragraph(anchor), 1); subPara = new Paragraph("Subcategory", subFont); subCatPart = catPart.addSection(subPara); subCatPart.add(new Paragraph("This is a very important message")); // Now add all this to the document document.add(catPart); }