Reading/Writing PDF Files in Visual C# Windows Forms

10,169

Solution 1

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) 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).

Solution 2

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.

Solution 3

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.
Share:
10,169
Admin
Author by

Admin

Updated on June 05, 2022

Comments

  • Admin
    Admin almost 2 years

    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...