we are using Aspose PDF version 23.9 and facing below issue
class com.aspose.pdf.internal.ms.System.l8l: Cannot access a disposed object.
Object name: ‘Document’.
com.aspose.pdf.ADocument.l0y(Unknown Source)
com.aspose.pdf.ADocument.getPages(Unknown Source)
com.aspose.pdf.Document.getPages(Unknown Source)
com.esrx.services.printserver.pdf.service.utils.ApologyPDFLetter.apologyPDFLetterForNas(ApologyPDFLetter.java:52)
com.esrx.services.printserver.pdf.service.utils.PrintServerBoImplUtils.pdfConversion(PrintServerBoImplUtils.java:451)
com.esrx.services.printserver.pdf.service.component.PrintServerBoImpl.getPdfByLetterId(PrintServerBoImpl.java:150)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
code snippet:
apologyPDF = new com.aspose.pdf.Document(apologyPdfPath + apologyEndswithPdf);
if(input != null) {
inputStream = new ByteArrayInputStream(input);
LOGGER.info("Input not null: "+ input);
}
mainPDF = new com.aspose.pdf.Document(inputStream);
apologyPDF.getPages().add(mainPDF.getPages());
LOGGER.info("Total pages main pdf and apology: "+ apologyPDF.getPages().size());
byteArrayOutputStream = new ByteArrayOutputStream();
apologyPDF.save(byteArrayOutputStream);
response.setFinalPdf(byteArrayOutputStream.toByteArray());
response.setDocumentPageCount(apologyPDF.getPages().size());
in the above lines of code the last line has been throwing this error