PDF generated from Puppeteer gives "class com.aspose.pdf.exceptions.InvalidPdfFileFormatException: Incorect file format"

I am using Puppeteer to create PDF from HTML. When I try to open the file using Aspose I am getting error. I have attached the PDF.1line.pdf (46.8 KB). I am using Aspose PDF for Java version 18.3 with

com.aspose.pdf.Document originalDocument = new Document(new ByteArrayInputStream(masterFileByteArray));

class com.aspose.pdf.exceptions.InvalidPdfFileFormatException: Incorect file format
com.aspose.pdf.internal.l23l.I07.lif(Unknown Source)
com.aspose.pdf.internal.l144.I4l$I7.deserialize(Unknown Source)
com.aspose.pdf.internal.l237.I0I.deserialize(Unknown Source)
com.aspose.pdf.internal.l214.I2l.<init>(Unknown Source)
com.aspose.pdf.internal.l214.I2l.<init>(Unknown Source)
com.aspose.pdf.internal.l151.Il.lif(Unknown Source)
com.aspose.pdf.internal.l214.I27.<init>(Unknown Source)
com.aspose.pdf.internal.l151.Il.lIF(Unknown Source)
com.aspose.pdf.internal.l3l.I1I.ll(Unknown Source)
com.aspose.pdf.internal.l3l.I1I.<init>(Unknown Source)
com.aspose.pdf.ADocument.lif(Unknown Source)
com.aspose.pdf.ADocument.<init>(Unknown Source)
com.aspose.pdf.ADocument.<init>(Unknown Source)
com.aspose.pdf.Document.<init>(Unknown Source)

@vineet.vineetb

Thanks for contacting support.

We have tested the scenario in our environment by loading PDF document from file path as well as using FileInputStream and were unable to notice exception which you have mentioned. It seems like the masterFileByteArray contains corrupted/incorrect data for a valid PDF document.

Would you please make sure that masterFileByteArray in your code snippet, contains the correct data for a PDF document. In case the issue still persists, please share complete sample code snippet where masterFileByteArray is defined, along with the JDK version you are using. We will test the scenario in our environment and address it accordingly.

Thanks @asad.ali the test code was re-reading the same InputStream.