Ejemplo n.º 1
0
 /**
  * Opens the copier using the given reader and the given output version.
  *
  * @param reader
  * @param outputStream the output stream to write to.
  * @param version version for the created pdf copy, if null the version number is taken from the
  *     input {@link PdfReader}
  */
 void open(PdfReader reader, OutputStream outputStream, PdfVersion version) throws TaskException {
   try {
     pdfDocument = new Document(reader.getPageSizeWithRotation(1));
     pdfCopy = new PdfSmartCopy(pdfDocument, outputStream);
     if (version == null) {
       pdfCopy.setPdfVersion(reader.getPdfVersion());
     } else {
       pdfCopy.setPdfVersion(version.getVersionAsCharacter());
     }
     pdfDocument.addCreator(Sejda.CREATOR);
     pdfDocument.open();
   } catch (DocumentException e) {
     throw new TaskException("An error occurred opening the PdfSmartCopy.", e);
   }
 }