List of usage examples for com.itextpdf.text Document addSubject
public boolean addSubject(String subject)
From source file:ECS.create.java
create() { //geting the file path from Page. String dpath = Page.dpath;/*from ww w.ja v a 2 s .co m*/ try { //define program "information" as data information data = new information(); //crate a PDF File Document cs = new Document(); //locate where the PDF save. FileOutputStream local = new FileOutputStream(dpath); //New PDF location PdfWriter writer = PdfWriter.getInstance(cs, local); //Edit Propety of the PDF cs.addTitle("Title@CoverSheet"); cs.addAuthor("Author@rensanning"); cs.addSubject("Subject@iText sample"); cs.addKeywords("Keywords@iText"); cs.addCreator("Creator@iText"); //Seting the Font of the text in the PDF Font title = new Font(Font.FontFamily.HELVETICA, 25, Font.BOLD); //Font stitle = new Font(Font.FontFamily.COURIER, 18,Font.ITALIC | Font.UNDERLINE); Font stitle = new Font(Font.FontFamily.TIMES_ROMAN, 18, Font.BOLD); Font usual = new Font(Font.FontFamily.TIMES_ROMAN, 18); // open the PDF File cs.open(); PdfContentByte canvas = writer.getDirectContent(); // insert the information in the PDF //group the information into paragrph Paragraph sinfo = new Paragraph(); //using the data form the database which geting by program "information" sinfo.add(new Chunk("Name: " + data.fn + " " + data.ln, title)); //cs.add(Chunk.NEWLINE); sinfo.add(new Chunk(" ")); sinfo.add(new Chunk("SID: " + data.sid, title)); sinfo.setLeading(40); //sinfo.add(Chunk.NEWLINE); cs.add(sinfo); Paragraph cinfo = new Paragraph(); cinfo.add(new Chunk("Course: " + data.cid + " " + data.cn, stitle)); cinfo.setLeading(30); cinfo.add(Chunk.NEWLINE); cs.add(cinfo); Paragraph minfo = new Paragraph(); minfo.add(new Chunk("Module: ", stitle)); minfo.add(new Chunk(data.mid + " " + data.mn, usual)); minfo.setLeading(30); minfo.add(Chunk.NEWLINE); cs.add(minfo); // insert the information in the PDF Paragraph cwinfo = new Paragraph(); cwinfo.add(new Chunk("Coursework ID: ", stitle)); cwinfo.add(new Chunk(data.cwid, usual)); cwinfo.add(Chunk.NEWLINE); cwinfo.add(new Chunk("Coursework Tile: ", stitle)); cwinfo.add(new Chunk(data.cwt, usual)); cwinfo.add(Chunk.NEWLINE); cwinfo.add(new Chunk("Coursework Deadline is on ", stitle)); cwinfo.add(new Chunk(data.cwed, usual)); cwinfo.setLeading(30); cs.add(cwinfo); cs.add(new Paragraph("Rule: \n" + " I am the Boss", usual)); //Phrase phrase1= new Phrase("This is sentence 1. ", title); //ColumnText.showTextAligned(canvas, Element.ALIGN_CENTER, phrase1, 30, 600, 0); //cs.add(new Paragraph("Name: " + data.fn + " " + data.ln, title)); //cs.add(new Chunk("SID: " + data.sid)); //Close the PDF file cs.close(); } catch (DocumentException | FileNotFoundException ex) { System.out.println(ex); } }
From source file:edu.avans.ivh5.shared.util.generateInvoicePDF.java
private static void addMetaData(Document document) { document.addTitle("My first PDF"); document.addSubject("Using iText"); document.addKeywords("Java, PDF, iText"); document.addAuthor("Oguzhan Babaarslan"); document.addCreator("Oguzhan Babaarslan"); }
From source file:edu.bedelias.utils.ReportsService.java
/** * Adds metadata info to the generated file. This info can be viewed in under File -> Properties * //from w w w . j a va2 s . co m * @param title * file title * @param author * name of the author * @param subject * { metadata } * @param keywords * { metadata, comma-separated values } * @param creator * { metadata, file creator } * @param document * file to be modified */ private static void addMetaData(String title, String author, String subject, String keywords, String creator, Document document) { if (title == null || title.isEmpty()) { document.addTitle(PDF_TITLE); } if (subject == null || subject.isEmpty()) { document.addSubject(PDF_SUBJECT); } if (keywords == null || keywords.isEmpty()) { document.addKeywords(PDF_KEYWORDS); } if (author == null || author.isEmpty()) { document.addAuthor(PDF_AUTHOR); } if (creator == null || creator.isEmpty()) document.addCreator(PDF_AUTHOR); }
From source file:edu.cornell.mannlib.vitro.webapp.visualization.visutils.PDFDocument.java
License:Open Source License
public PDFDocument(String authorName, Map<String, Integer> yearToPublicationCount, Document document, PdfWriter pdfWriter) {/*from ww w. j a v a2 s . c o m*/ // setPreferredSize(new Dimension(600,400)); try { document.addTitle("PDF Pipeline iText Prototype"); document.addAuthor(authorName); document.addSubject("This example tests text, color, image, transparency & table functionality."); document.addKeywords("text, color, image, transparency, table"); document.addCreator("Standalone PDF Renderer using iText"); Paragraph header = new Paragraph(); Font pageHeaderStyle = FontFactory.getFont(FontFactory.TIMES_ROMAN, 15, Font.BOLDITALIC | Font.UNDERLINE); Font featureHeaderStyle = FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, new BaseColor(Color.red)); header.add(new Chunk("PDF Pipeline Prototype v2 using iText\n", pageHeaderStyle)); header.setSpacingAfter(15f); document.add(header); Paragraph content = new Paragraph(); content.add(new Chunk("Publication Count - Author Name - " + authorName, featureHeaderStyle)); content.setSpacingAfter(15f); document.add(content); // step4 PdfPTable publicationCount = createTable(yearToPublicationCount); document.add(publicationCount); content = new Paragraph(); content.add(new Chunk("Transparency of Shapes", featureHeaderStyle)); content.setSpacingAfter(15f); document.add(content); createTransparencyShapes(document, pdfWriter); createImage(document, pdfWriter, featureHeaderStyle); } catch (DocumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:edu.esprit.pi.gui.internalframes.PDFwithItextInternalFrame.java
public void addMetaData(Document document) { document.addTitle(titrePDFjTextField.getText()); document.addSubject(subjectjTextField.getText()); document.addKeywords(keywordjTextField.getText()); document.addAuthor(autheurjTextField.getText()); document.addCreator(creatorjTextField.getText()); }
From source file:edu.ucue.jparking.srv.ExportOrdenPagoService.java
private void addMetaData(Document document) { document.addTitle("Orden de pago"); document.addSubject("Using iText"); document.addKeywords("Java, PDF, iText"); document.addAuthor("Lara-Santos"); document.addCreator("Lara-Santos"); }
From source file:Ekon.zamestnanecToPDF.java
/** * pridani metadat pro prohlizac//w w w . j a v a 2 s . c o m * * @param dokument */ private static void addMetaData(Document dokument) { dokument.addTitle("Vpis zamtnance"); dokument.addSubject("Vpis,zamstnanec"); dokument.addKeywords("Zamstnanec,Vpis"); dokument.addCreator("Ekon"); }
From source file:engine.Pdf.java
public static void addMetaData(Document document) { document.addTitle("My first PDF"); document.addSubject("Using iText"); document.addKeywords("Java, PDF, iText"); document.addAuthor("Fusion Works"); document.addCreator("Fusion Works"); }
From source file:es.clinica.veterinaria.facturas.FacturaPdf.java
private void addMetaData(Document document) { document.addTitle("Factura N: " + factura.getNumero()); document.addSubject("Fecha:" + new SimpleDateFormat("yyyy").format(factura.getFecha())); document.addKeywords("Facturas PDF"); document.addAuthor("agustin.alvarez.garcia@gmail.com"); document.addCreator("agustin.alvarez.garcia@gmail.com"); }
From source file:es.tlc.pdf.writer.PDFWriter.java
private static void addMetaData(Document document) { document.addTitle("mesvida"); document.addSubject("Ficha"); document.addKeywords("Java, PDF, iText"); document.addAuthor("mesvida"); document.addCreator("mesvida"); }