pdf/src/main/java/se/idsec/signservice/integration/document/pdf/PdfTbsDocumentProcessor.java
@Override
  protected byte[] validateDocumentContent(final TbsDocument document, final IntegrationServiceConfiguration config, final String fieldName)
      throws InputValidationException {

    final byte[] pdfDocumentBytes = super.validateDocumentContent(document, config, fieldName);
    PDDocument pdfDocument = null;
    try {
      pdfDocument = PDDocumentUtils.load(pdfDocumentBytes);
    }
    catch (Exception e) {
      final String msg = String.format("Failed to load content for document '%s' - %s", document.getId(), e.getMessage());
      log.error("{}: {}", CorrelationID.id(), msg, e);
      throw new InputValidationException(fieldName + ".content", msg, e);
    }
    finally {
      PDDocumentUtils.close(pdfDocument);
    }
    return pdfDocumentBytes;
  }
/**
   * Overrides the default implementation and ensures that the bytes that makes up the PDF document really are OK, that
   * is, we ensure that they can be loaded into a {@link PDDocument}.
   */
Overrides the default implementation and ensures that the bytes that makes up the PDF document really are OK, that
is, we ensure that they can be loaded into a  PDDocument.
Overrides the default implementation and ensures that the bytes that makes up the PDF document really are OK that is we ensure that they can be loaded into a PDDocument .
@Override
  protected byte[] validateDocumentContent(final TbsDocument document, final IntegrationServiceConfiguration config, final String fieldName)
      throws InputValidationException {
    final byte[] pdfDocumentBytes = super.validateDocumentContent(document, config, fieldName);
    PDDocument pdfDocument = null;
    try {
      pdfDocument = PDDocumentUtils.load(pdfDocumentBytes);
    }
    catch (Exception e) {
      final String msg = String.format("Failed to load content for document '%s' - %s", document.getId(), e.getMessage());
      log.error("{}: {}", CorrelationID.id(), msg, e);
      throw new InputValidationException(fieldName + ".content", msg, e);
    }
    finally {
      PDDocumentUtils.close(pdfDocument);
    }
    return pdfDocumentBytes;
  }
@ Override protected byte [ ] validateDocumentContent ( final TbsDocument document , final IntegrationServiceConfiguration config , final String fieldName ) throws InputValidationException { final byte [ ] pdfDocumentBytes = super . validateDocumentContent ( document , config , fieldName ) ; PDDocument pdfDocument = null ; try { pdfDocument = PDDocumentUtils . load ( pdfDocumentBytes ) ; } catch ( Exception e ) { final String msg = String . format ( "Failed to load content for document '%s' - %s" , document . getId ( ) , e . getMessage ( ) ) ; log . error ( "{}: {}" , CorrelationID . id ( ) , msg , e ) ; throw new InputValidationException ( fieldName + ".content" , msg , e ) ; } finally { PDDocumentUtils . close ( pdfDocument ) ; } return pdfDocumentBytes ; }
Overrides the default implementation and ensures that the bytes that makes up the PDF document really are OK, that
 is, we ensure that they can be loaded into a {@link PDDocument}.
Overrides the default implementation and ensures that the bytes that makes up the PDF document really are OK that is we ensure that they can be loaded into a { @link PDDocument } .