@Override public void setAuthor(String author) { this.info.setAuthor(author); }
docInfo.setAuthor(inAuthor);
private void setDidValues(PDDocument doc) { PDDocumentInformation info = new PDDocumentInformation(); info.setCreationDate(Calendar.getInstance()); if (_producer == null) { info.setProducer("openhtmltopdf.com"); } else { info.setProducer(_producer); } for (Metadata metadata : _outputDevice.getMetadata()) { String name = metadata.getName(); if (name.isEmpty()) continue; String content = metadata.getContent(); if( content == null ) continue; if( name.equals("title")) info.setTitle(content); else if( name.equals("author")) info.setAuthor(content); else if(name.equals("subject")) info.setSubject(content); else if(name.equals("keywords")) info.setKeywords(content); else info.setCustomMetadataValue(name,content); } doc.setDocumentInformation(info); }
private void setDidValues(PDDocument doc) { PDDocumentInformation info = new PDDocumentInformation(); info.setCreationDate(Calendar.getInstance()); if (_producer == null) { info.setProducer("openhtmltopdf.com"); } else { info.setProducer(_producer); } for (Metadata metadata : _outputDevice.getMetadata()) { String name = metadata.getName(); if (name.isEmpty()) continue; String content = metadata.getContent(); if( content == null ) continue; if( name.equals("title")) info.setTitle(content); else if( name.equals("author")) info.setAuthor(content); else if(name.equals("subject")) info.setSubject(content); else if(name.equals("keywords")) info.setKeywords(content); else info.setCustomMetadataValue(name,content); } doc.setDocumentInformation(info); }
document.addPage(page); PDDocumentInformation info=document.getDocumentInformation(); info.setAuthor("PdfBox"); info.setCreator("Pdf"); info.setSubject("Stéganographie");
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); } }
pdi.setAuthor(creator); doc.setDocumentInformation(pdi);