Java Code Examples for com.itextpdf.text.Document#addAuthor()
The following examples show how to use
com.itextpdf.text.Document#addAuthor() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PDFExport.java From MtgDesktopCompanion with GNU General Public License v3.0 | 8 votes |
@Override public void exportDeck(MagicDeck deck, File f) throws IOException { PdfPTable table = new PdfPTable(3); table.setHorizontalAlignment(Element.ALIGN_CENTER); try { document = new Document(PageSize.A4, 5, 5, 10, 5); document.addAuthor(getString("AUTHOR")); document.addCreationDate(); document.addCreator(MTGConstants.MTG_APP_NAME); document.addTitle(deck.getName()); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(f)); document.open(); document.add(new Chunk("")); for (MagicCard card : deck.getMainAsList()) { table.addCell(getCells(card)); notify(card); } document.add(table); document.close(); writer.close(); } catch (Exception e) { logger.error("Error in pdf creation " + f, e); } }
Example 2
Source File: JustCopy.java From testarea-itext5 with GNU Affero General Public License v3.0 | 6 votes |
/** * <a href="https://stackoverflow.com/questions/48586750/itext-messes-up-pdf-while-joining-multiple-pdfs"> * iText messes up PDF while joining multiple PDFs * </a> * <br/> * <a href="https://drive.google.com/open?id=1nH_21_f1bmnxeOn5ul8db3eC2CggZiRN"> * page_444.pdf * </a> * <p> * I cannot reproduce the issue. * </p> */ @Test public void testPage444() throws IOException, DocumentException { Rectangle pageSize = PageSize.A4; File outPut = new File(RESULT_FOLDER, "page_444-copied.pdf"); final Document document = new Document(pageSize ); final FileOutputStream fos = FileUtils.openOutputStream(outPut); final PdfWriter pdfWriter = new PdfSmartCopy(document, fos); pdfWriter.setViewerPreferences(PdfWriter.PageLayoutTwoColumnRight); pdfWriter.setFullCompression(); pdfWriter.setPdfVersion(PdfWriter.VERSION_1_6); // pdfWriter.setXmpMetadata(getPdfMetaData()); document.open(); document.addAuthor("Author"); final PdfReader reader = new PdfReader(getClass().getResourceAsStream("page_444.pdf")); PdfSmartCopy pdfSmartCopy = (PdfSmartCopy) pdfWriter; pdfSmartCopy.addPage(pdfSmartCopy.getImportedPage(reader, 1)); pdfSmartCopy.freeReader(reader); // After all files are merged document.close(); }
Example 3
Source File: PDFMigrationReportWriter.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private void addMetaData(Document document) { document.addTitle(report.getName()); document.addSubject("Migration status report"); document.addKeywords("BPMN, Migration, BonitaSoft, Process"); document.addAuthor("Bonita Studio"); document.addCreator("Bonita Studio"); }