• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1265
  • Last Modified:

check if a PDF file is corrupt in C#

I need to validate that a PDF is not corrupt.  Any ideas?
0
dlsimic
Asked:
dlsimic
  • 4
  • 3
1 Solution
 
ste5anSenior DeveloperCommented:
Take a look at iTextSharp.. Load it. When corrupted, then it should throw an appropriate exception.
0
 
dlsimicAuthor Commented:
Can you think of anything without commercial licensing?
0
 
ste5anSenior DeveloperCommented:
What commercial licensing? It's AGPL.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
dlsimicAuthor Commented:
Maybe I am reading the licensing wrong.  But it appears that if I were to distribute code with this dll in it then I need to have a commercial license.

This statement is taken from their website:
"Buying a commercial license is mandatory as soon as you begin activities including distribution of iText software inside your product or deploying it on a network without disclosing the source code of your own applications under the AGPL license."
0
 
ste5anSenior DeveloperCommented:
Please post a link...
0
 
dlsimicAuthor Commented:
0
 
frankhelkCommented:
Hmmm - the Adobe Acrobat Reader comes with some kind of ActiveX control you could bind into a VS application as PDF viewer (that way you could i.e. view some kind of help PDF within your application). I think it's a s free as the reader itself.

Just add the appropriate reference in Visual Studio to access it.

Try to load the file in this and it should throw an exception if the file is too corrupted to load. Anyhow I would expect possible that a file is corrupted in a way that allows it to load but displays garbage anyhow. In that case you'd have to implement a full blown PDF syntax parser to detect flaws ;-)
0
 
ste5anSenior DeveloperCommented:
Yup, read it again. It's free as long as you respect AGPL:

While the AGPL license has no direct financial cost, there are clear requirements for AGPL use. Buying a commercial license is mandatory as soon as you develop activities involving the iText software without disclosing the source code of your own applications.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now