pdf/src/main/java/se/idsec/signservice/integration/document/pdf/utils/PDDocumentUtils.java
public static byte[] toBytes(final PDDocument document) throws DocumentProcessingException {
    try {
      final ByteArrayOutputStream bos = new ByteArrayOutputStream();
      final BufferedOutputStream os = new BufferedOutputStream(bos);
      document.save(os);
      return bos.toByteArray();
    }
    catch (IOException e) {
      throw new DocumentProcessingException(new ErrorCode.Code("encode"), "Failed to encode PDF document", e);
    }
  }
/**
   * Encodes the supplied PDF document into a byte array.
   * 
   * @param document
   *          the document to encode
   * @return a byte array of the contents
   * @throws DocumentProcessingException
   *           for processing errors
   */
Encodes the supplied PDF document into a byte array.

@param document
the document to encode
@return a byte array of the contents
@throws DocumentProcessingException
for processing errors
Encodes the supplied PDF document into a byte array . @param document the document to encode @return a byte array of the contents @throws DocumentProcessingException for processing errors
public static byte[] toBytes(final PDDocument document) throws DocumentProcessingException {
    try {
      final ByteArrayOutputStream bos = new ByteArrayOutputStream();
      final BufferedOutputStream os = new BufferedOutputStream(bos);
      document.save(os);
      return bos.toByteArray();
    }
    catch (IOException e) {
      throw new DocumentProcessingException(new ErrorCode.Code("encode"), "Failed to encode PDF document", e);
    }
  }
public static byte [ ] toBytes ( final PDDocument document ) throws DocumentProcessingException { try { final ByteArrayOutputStream bos = new ByteArrayOutputStream ( ) ; final BufferedOutputStream os = new BufferedOutputStream ( bos ) ; document . save ( os ) ; return bos . toByteArray ( ) ; } catch ( IOException e ) { throw new DocumentProcessingException ( new ErrorCode . Code ( "encode" ) , "Failed to encode PDF document" , e ) ; } }
Encodes the supplied PDF document into a byte array.
Encodes the supplied PDF document into a byte array .