capureddocid = invc.id();
for (FileBean attachment : getItems()) {
if (attachment != null) {
if (attachment.getSize() > 0) {
InvoicePage page = invc.createPage(getSession(), attachment.getInputStream(), ++capturedCount, attachment.getFileName());
if (capturedCount==1) {
capuredpage1 = page.id();
}
attachment.delete();
} else {
ValidationError error = new SimpleError(attachment.getFileName()+ " is not a valid file." );
getContext().getValidationErrors().add("items" , error);