destination.setDocumentInformation(destinationDocumentInformation);
/** * Create a new document to write the split contents to. * * @return the newly created PDDocument. * @throws IOException If there is an problem creating the new document. */ protected PDDocument createNewDocument() throws IOException { PDDocument document = memoryUsageSetting == null ? new PDDocument() : new PDDocument(memoryUsageSetting); document.getDocument().setVersion(getSourceDocument().getVersion()); document.setDocumentInformation(getSourceDocument().getDocumentInformation()); document.getDocumentCatalog().setViewerPreferences( getSourceDocument().getDocumentCatalog().getViewerPreferences()); return document; }
extractedDocument.setDocumentInformation(sourceDocument.getDocumentInformation()); extractedDocument.getDocumentCatalog().setViewerPreferences( sourceDocument.getDocumentCatalog().getViewerPreferences());
docInfo.setAuthor(inAuthor); inPdfDoc.setDocumentInformation(docInfo);
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); }
outputDocument.setDocumentInformation(documentoPdf.getDocumentInformation()); outputDocument.getDocumentCatalog().setViewerPreferences( documentoPdf.getDocumentCatalog().getViewerPreferences());
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); }
destination.setDocumentInformation(destinationDocumentInformation);
destination.setDocumentInformation(destinationDocumentInformation);
/** * Create a new document to write the split contents to. * * @return the newly created PDDocument. * @throws IOException If there is an problem creating the new document. */ protected PDDocument createNewDocument() throws IOException { PDDocument document = memoryUsageSetting == null ? new PDDocument() : new PDDocument(memoryUsageSetting); document.getDocument().setVersion(getSourceDocument().getVersion()); document.setDocumentInformation(getSourceDocument().getDocumentInformation()); document.getDocumentCatalog().setViewerPreferences( getSourceDocument().getDocumentCatalog().getViewerPreferences()); return document; }
/** * Create a new document to write the split contents to. * * @return the newly created PDDocument. * @throws IOException If there is an problem creating the new document. */ protected PDDocument createNewDocument() throws IOException { PDDocument document = memoryUsageSetting == null ? new PDDocument() : new PDDocument(memoryUsageSetting); document.getDocument().setVersion(getSourceDocument().getVersion()); document.setDocumentInformation(getSourceDocument().getDocumentInformation()); document.getDocumentCatalog().setViewerPreferences( getSourceDocument().getDocumentCatalog().getViewerPreferences()); return document; }
pdi.setProducer(fullProducer); pdi.setAuthor(creator); doc.setDocumentInformation(pdi);
extractedDocument.setDocumentInformation(sourceDocument.getDocumentInformation()); extractedDocument.getDocumentCatalog().setViewerPreferences( sourceDocument.getDocumentCatalog().getViewerPreferences());
extractedDocument.setDocumentInformation(sourceDocument.getDocumentInformation()); extractedDocument.getDocumentCatalog().setViewerPreferences( sourceDocument.getDocumentCatalog().getViewerPreferences());
/** * Output a PDF with as many pages as there are interesting areas in the * input document */ @Override public PDDocument extract() throws IOException { PDDocument extractedDocument = new PDDocument(); extractedDocument.setDocumentInformation(sourceDocument.getDocumentInformation()); extractedDocument.getDocumentCatalog().setViewerPreferences( sourceDocument.getDocumentCatalog().getViewerPreferences()); @SuppressWarnings("unchecked") List<PDPage> pages = sourceDocument.getDocumentCatalog().getAllPages(); int pageCounter = 1; for (PDPage page : pages) { if (pageCounter >= startPage && pageCounter <= endPage) { List<PDRectangle> zoomedFragments = getFragments(page); for (PDRectangle fragment : zoomedFragments) { PDPage outputPage = extractedDocument.importPage(page); outputPage.setCropBox(fragment); outputPage.setMediaBox(page.getMediaBox()); outputPage.setResources(page.findResources()); outputPage.setRotation(page.findRotation()); // TODO: rotate the page in landscape mode is width > height } } pageCounter++; } return extractedDocument; }