private void addEmptyLine(Document doc, int number) throws DocumentException { for (int i = 0; i < number; i++) { doc.add(new Paragraph(" ")); } }
public void flushPendingChapter() { if (pendingChapter != null) { try { getDocument().add(pendingChapter); } catch (DocumentException e) { log.warn("Fail to add pending chapter {}", pendingChapter, e); } } pendingChapter = null; }
@Override public boolean add( Element element ) throws DocumentException { if ( !isOpen() ) { open(); } return super.add( element ); }
/** * Adds the author to a Document. * * @param author * the name of the author * @return <CODE>true</CODE> if successful, <CODE>false</CODE> otherwise */ public boolean addAuthor(String author) { try { return add(new Meta(Element.AUTHOR, author)); } catch (DocumentException de) { throw new ExceptionConverter(de); } }
/** * Adds a language to th document. Required for PDF/UA compatible documents. * @param language * @return <code>true</code> if successfull, <code>false</code> otherwise */ public boolean addLanguage(String language) { try { return add(new Meta(Element.LANGUAGE, language)); } catch (DocumentException de) { throw new ExceptionConverter(de); } }
/** * Adds the keywords to a Document. * * @param keywords * adds the keywords to the document * @return <CODE>true</CODE> if successful, <CODE>false</CODE> otherwise */ public boolean addKeywords(String keywords) { try { return add(new Meta(Element.KEYWORDS, keywords)); } catch (DocumentException de) { throw new ExceptionConverter(de); } }
/** * Adds the subject to a Document. * * @param subject * the subject * @return <CODE>true</CODE> if successful, <CODE>false</CODE> otherwise */ public boolean addSubject(String subject) { try { return add(new Meta(Element.SUBJECT, subject)); } catch (DocumentException de) { throw new ExceptionConverter(de); } }
/** * Adds the creator to a Document. * * @param creator * the name of the creator * @return <CODE>true</CODE> if successful, <CODE>false</CODE> otherwise */ public boolean addCreator(String creator) { try { return add(new Meta(Element.CREATOR, creator)); } catch (DocumentException de) { throw new ExceptionConverter(de); } }
/** * Adds a language to th document. Required for PDF/UA compatible documents. * @param language * @return <code>true</code> if successfull, <code>false</code> otherwise */ public boolean addLanguage(String language) { try { return add(new Meta(Element.LANGUAGE, language)); } catch (DocumentException de) { throw new ExceptionConverter(de); } }
public byte[] exportProcess(Process process, File outputFile) throws Exception { new ActivityNodeSequencer(process).assignNodeSequenceIds(); Document document = new Document(); DocWriter writer = PdfWriter.getInstance(document, new FileOutputStream(outputFile)); document.open(); document.setPageSize(PageSize.LETTER); Rectangle pageSize = document.getPageSize(); Chapter chapter = printProcessPdf(writer, 1, process, pageSize); document.add(chapter); document.close(); return Files.readAllBytes(Paths.get(outputFile.getPath())); }
/** * Adds the producer to a Document. * * @return <CODE>true</CODE> if successful, <CODE>false</CODE> otherwise */ public boolean addProducer() { try { return add(new Meta(Element.PRODUCER, Version.getInstance().getVersion())); } catch (DocumentException de) { throw new ExceptionConverter(de); } }
public static void createPDFfromRTM(File pdfFile, ReportTableModel rtm) throws FileNotFoundException, DocumentException { Document document=new Document(); PdfWriter.getInstance(document,new FileOutputStream(pdfFile)); document.open(); PdfPTable pdftable = RTMUtil.createPDFTable(rtm); document.add(pdftable); document.close(); }
/** * Adds the producer to a Document. * * @return <CODE>true</CODE> if successful, <CODE>false</CODE> otherwise */ public boolean addProducer() { try { return add(new Meta(Element.PRODUCER, Version.getInstance().getVersion())); } catch (DocumentException de) { throw new ExceptionConverter(de); } }
private void addTitle(Document document) throws DocumentException { Paragraph title = new Paragraph(exportConf.getFileName()); title.add(new Paragraph(" ")); // empty line title.setAlignment(Element.ALIGN_CENTER); document.add(title); }
private void addTitle(Document document) throws DocumentException { Paragraph title = new Paragraph(exportConf.getFileName()); title.add(new Paragraph(" ")); // empty line title.setAlignment(Element.ALIGN_CENTER); document.add(title); }
public void doExport(OutputStream out) throws DocumentException { Document document = new Document(); PdfWriter.getInstance(document, out); document.open(); PdfPTable pdf = new PdfPTable(table.getHeaders().size()); pdf.setWidthPercentage(100); title(pdf); header(pdf); body(pdf); document.add(pdf); document.close(); }
/** * Writes the table caption according to a set style. * @param model The table model containing the caption. * @throws DocumentException If an error occurrs while decorating the caption. */ private void decorateCaption(TableModel model) throws DocumentException { Paragraph caption = new Paragraph(new Chunk(model.getCaption(), this.getCaptionFont())); caption.setAlignment(this.getCaptionHorizontalAlignment()); this.document.add(caption); }
private static void createPDF(String path) throws Exception { Document pdfDoc = new Document(PageSize.A4); PdfWriter.getInstance(pdfDoc, new FileOutputStream(path)).setPdfVersion(PdfWriter.VERSION_1_7); pdfDoc.open(); Font myfont = new Font(); myfont.setStyle(Font.NORMAL); myfont.setSize(11); Paragraph para = new Paragraph("test", myfont); para.setAlignment(Element.ALIGN_JUSTIFIED); pdfDoc.add(para); pdfDoc.close(); }