List of usage examples for com.itextpdf.text.pdf PdfWriter setXmpMetadata
public void setXmpMetadata(final byte[] xmpMetadata)
From source file:br.unifor.mia.xmpsemantico.xmp.MetadataXmp.java
License:GNU General Public License
/** * create PDF document//from ww w . jav a 2s .co 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 }