We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Unable load pdf document

Getting Error "Aspose.Pdf.InvalidPdfFileFormatException : Incorrect file header "
when loading attacehd PDF document
using following code
byte[] bytes = File.ReadAllBytes(filePath);
fileContent = new MemoryStream(bytes);

Document pdfDocument = new Document(fileContent );

@svemuri2020

Can you please share the source PDF file so that we may try to reproduce the same on our end.

[https://forum.aspose.com/letter_avatar_proxy/v4/letter/m/b487fb/45.png]
mudassir.fayyazhttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fforum.aspose.com%2Fu%2Fmudassir.fayyaz&data=04|01|shyam.vemuri%40cudirect.com|f92526227d8448cbeedd08d9268349da|d9b63273fc654fec8893b00bb60d7f80|0|0|637583167601860193|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D|1000&sdata=iYPrxKk6yEJLZlvHMAeIGPQLQEKigQSKOxLRava0Hik%3D&reserved=0
June 3

@svemuri2020https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fforum.aspose.com%2Fu%2Fsvemuri2020&data=04|01|shyam.vemuri%40cudirect.com|f92526227d8448cbeedd08d9268349da|d9b63273fc654fec8893b00bb60d7f80|0|0|637583167601870172|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D|1000&sdata=iGZ2BMjS8TrJo8K5TDi6KGfamO9fHrNY7yiJ1GZ3wn4%3D&reserved=0

Can you please share the source PDF file so that we may try to reproduce the same on our end.

mergeFail.pdf (11.3 MB)

mergeFail-Edited.pdf (11.2 MB)

@svemuri2020

I can not reproduce the issue with your code and files. I request you to upgrade to latest version and share your feedback.

I am using Latest version (21.5.0) . Can you share your code , how you are loading the document?

there was an issue with my Unit test code . This issue is resolved