/** {@inheritDoc} Implemented by Apache PDFBox library. */
 @Override
 public void saveDocumentIncremental(MetadataFixerResultImpl result, OutputStream output) {
   try {
     PDMetadata meta = this.document.getDocumentCatalog().getMetadata();
     boolean isMetaPresent = meta != null && this.isNeedToBeUpdated();
     boolean isMetaAdd = meta == null && this.metadata != null;
     if (isMetaPresent || isMetaAdd) {
       this.metadata.updateMetadataStream();
       if (isMetaAdd) {
         this.document.getDocumentCatalog().getCOSObject().setNeedToBeUpdated(true);
       }
       this.document.saveIncremental(output);
       output.close();
       result.setRepairStatus(this.getStatus(result));
     } else {
       result.setRepairStatus(NO_ACTION);
       result.addAppliedFix("No action performed.");
     }
   } catch (Exception e) {
     LOGGER.info(e);
     result.setRepairStatus(FIX_ERROR);
     result.addAppliedFix("Problems with document save. " + e.getMessage());
   }
 }
 private MetadataFixerResultImpl.RepairStatus getStatus(MetadataFixerResultImpl result) {
   return result.getRepairStatus() != WONT_FIX ? SUCCESS : WONT_FIX;
 }