private PDDocumentInformation createPDFDocumentInfo(String title, String creator, String subject) { LOG.info("Setting document info (title, author, subject) for merged PDF"); PDDocumentInformation documentInformation = new PDDocumentInformation(); documentInformation.setTitle(title); documentInformation.setCreator(creator); documentInformation.setSubject(subject); return documentInformation; }
@Override public void setCreator(String creator) { this.info.setCreator(creator); }
private PDDocumentInformation createPDFDocumentInfo(String title, String creator, String subject) { LOG.info("Setting document info (title, author, subject) for merged PDF"); PDDocumentInformation documentInformation = new PDDocumentInformation(); documentInformation.setTitle(title); documentInformation.setCreator(creator); documentInformation.setSubject(subject); return documentInformation; }
PDDocumentInformation info=document.getDocumentInformation(); info.setAuthor("PdfBox"); info.setCreator("Pdf"); info.setSubject("Stéganographie"); info.setTitle("Stéganographie dans les documents PDF");
public File createPDFReportFile(final File outputDirectory, final ReportData report) throws RiskReportException { final IntegrationEscapeUtil escapeUtil = new IntegrationEscapeUtil(); final String escapedProjectName = escapeUtil.escapeForUri(report.getProjectName()); final String escapedProjectVersionName = escapeUtil.escapeForUri(report.getProjectVersion()); final File pdfFile = new File(outputDirectory, escapedProjectName + "_" + escapedProjectVersionName + "_BlackDuck_RiskReport.pdf"); if (pdfFile.exists()) { pdfFile.delete(); } final PDDocument document = new PDDocument(); document.getDocumentInformation().setAuthor("Black Duck Software"); document.getDocumentInformation().setCreator("Integrations"); document.getDocumentInformation().setSubject("Hub Risk Report"); try (PDFBoxManager pdfManager = new PDFBoxManager(pdfFile, document)) { this.pdfManager = pdfManager; final PDRectangle pageBox = pdfManager.currentPage.getMediaBox(); final float pageWidth = pageBox.getWidth(); final float pageHeight = pageBox.getHeight(); final PDRectangle headerRectangle = writeHeader(pageWidth, pageHeight); final PDRectangle bottomOfProjectInfoRectangle = writeProjectInformation(pageWidth, headerRectangle.getLowerLeftY(), report); final PDRectangle bottomOfSummaryTableRectangle = writeSummaryTables(pageWidth, bottomOfProjectInfoRectangle.getLowerLeftY(), report); final PDRectangle bottomOfComponentTableRectangle = writeComponentTable(pageWidth, bottomOfSummaryTableRectangle.getLowerLeftY(), report); return pdfFile; } catch (final IOException | URISyntaxException e) { final String errorString = "Couldn't create the report: "; logger.trace(errorString + e.getMessage(), e); throw new RiskReportException(errorString + e.getMessage(), e); } }