views:

502

answers:

4

Hi All

For a client, I need to be able to read and write PDF files. There are two downsides to this:

  1. I don't know how.
  2. I can't use any third-party copmonents/libraries.

Can somebody please point me into the right direction where I might be able to learn how to begin reading and writing PDF files?

I'm not asking for code or anything like that (although..... ;)), I'm just wondering if anybody knows of any good starting points...

Any help is appreciated.

Thank you :)

+3  A: 

The PDF format is actually standardized in the form of ISO 32000-1:2008. You can always purchase it from the website and implement a reader/writer/renderer yourself.

However, I'd strongly recommend against that, as the cost of the document and the cost in time of actually implementing something like this on your own will far outweigh the cost of a third-party component.

There are plenty of third-party components for .NET, some that (with iTextSharp being a very prominent one), some which are royalty-free as well.

I'd suggest convincing whomever set the requirement that you can't use third-party components to sign-off on the expenditure of one of these components (if none of the free ones do what you need).

casperOne
Thank you for this. So, if they are free, or royalty free, that means that we can sell them to our client, and they can be used commercially?
lucifer
@j-t-s: Yes, if something is open-source, then *typically* the only thing you are obligated to do is attribute the source (indicate somewhere in the program that you use the component). **Make sure to read the license to see what the requirements are**. For most commerical options, they usually have a royalty-free condition, meaning you don't owe them anything for using the component in the application. Again, **make sure you look over the license**, but typically, "royalty-free" is what you want to look for.
casperOne
Thank you casperOne. :)
lucifer
@j-t-s: NP, glad to help.
casperOne
@casperOne - Just to clarify "sell them to our client" - basically you sell *your product*, it simply uses open source libraries - you don't in effect "charge" for the library. Oh, BTW, check out ItextSharp. PK :-)
Paul Kohler
@Paul Kohler: Yes, that's how I understood it, I think you meant that comment to j-t-s. The link to iTextSharp is in the response, but I've named it specifically now.
casperOne
A: 

You can have a look at

astander
A: 

As other answers stated writing your own PDF handler will be a pain. You can try using PDFsharp which seems promising and is free. You have to check the license of usage thou.

MadBoy
A: 

Agree with the answers above. Implementing a PDF engine isn't a trivial task. If you need to do the full one reading and modifying PDF, then use third party library like suggested.

I have worked with PDF document creation, management and etc for several years. Often I found that the requirement to handle PDF can be very basic and achieved quite easily but misunderstood. I will just list some options here to consider if one of your requirement fall in to this category:

  • For displaying PDF within you program, you can drop a browser control and setting the Navigate URL to the pdf document will automatically display the inline PDF just like in the IE browser.
  • If you need to produce from an existing document, you can simply use print driver like doPDF, PDFCreator and etc and automate the process of printing to the driver
  • If you are creating the document from Word, you can automated Word2007 and use the SaveAsPDF interface offered
  • If you need to transform it to different format, depending on the target format Ghostscript commands are worth checking out too.
Fadrian Sudaman