Recommend a free PDF developer's library for C#

Anonymous
2020-12-25T19:45:22.387+00:00

I'm using VS 2017 CE, C#, and WinForms on a non-commercial application that adds and deletes pages from PDFs. The added pages are created with minimal text and no drawing or graphics.

I've been using iText7, and it's great, but it has far more power than I need, it's larger than I would like, and I find it hard to use.

I know there are other libraries. I just found out about Debenu PDF, which has a free lite version.

I'm looking for basic PDF editing, lightweight footprint, good documentation, and yes, free. What have you used?

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,824 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,218 questions
{count} votes

7 answers

Sort by: Most helpful
  1. YASER SHADMEHR 781 Reputation points
    2020-12-26T05:13:56.447+00:00

    anonymous user Use PDFSharp instead. Here is an example:

    // Register Encoding
    Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
    using (var pdfDocument = PdfReader.Open(@"C:\Test.pdf", PdfDocumentOpenMode.Modify))
    {
        // Remove first page
        pdfDocument.Pages.RemoveAt(0);
    
        // Save to different file
        pdfDocument.Save(@"C:\Test2.pdf");
    }
    
    1 person found this answer helpful.

  2. DotNetDeveloper 6 Reputation points
    2022-03-10T23:17:49.13+00:00

    Hello,

    I would recommend a free PDF developer's library for C# PDFFlow for your needs. You basically create PDF documents from scratch with it. It supports repeating headers, automatic page numeration, multi-page spread tables and many other layouting options.
    It is lightweight and fully documented.
    Also, many samples of business documents built using this library are located in a repo (PDF.Flow.Examples), I haven't seen that much from other PDF generating libraries. There are also how-to-build articles for each sample, which definitely might help you get going.

    Your first PDF you can create with just a few lines of code:

     var section = DocumentBuilder.New().AddSection();
     section
         .AddParagraph("Hello World!").SetFontColor(Color.Red)
     .ToSection()
         .InsertNewPage()
         .AddParagraph("This is another page inserted")
     .ToDocument().Build("Hello World.pdf");
    

    As you can see, there is a method InsertNewPage() which can be called at any moment.
    I hope, this is what you were looking for.

    Also, this library automatically creates new page when current page is finished, so the content is continuing at the next page. This is very comfortable, so developer don't waste time for this.

    1 person found this answer helpful.

  3. Timon Yang-MSFT 9,571 Reputation points
    2020-12-28T02:32:42.023+00:00

    I sometimes use FreeSpire.PDF, it is easy to use and provides a wealth of code examples, but the free version can only be used for pdf files with a small number of pages (less than 10).
    We cannot directly edit the text in the file, but they provide a way to replace:

            static void Main(string[] args)  
            {  
                PdfDocument doc = new PdfDocument(@"D:\test\pdf\1.pdf");  
                Dictionary<string, string> dictionary = new Dictionary<string, string>();  
                dictionary.Add("Left", "Test");  
                FindTextInPDFAndReplaceIt(doc, dictionary);  
                doc.SaveToFile(@"D:\test\pdf\1.pdf", FileFormat.PDF);  
            }  
            public static void FindTextInPDFAndReplaceIt(PdfDocument documents, Dictionary<string, string> dictionary)  
            {  
                PdfTextFind[] result = null;  
                foreach (var word in dictionary)  
                {  
                    foreach (PdfPageBase page in documents.Pages)  
                    {  
                        result = page.FindText(word.Key, TextFindParameter.WholeWord).Finds;  
                        foreach (PdfTextFind find in result)  
                        {  
                            find.ApplyRecoverString(word.Value, System.Drawing.Color.Red, true);  
                        }  
                    }  
                }  
            }  
    

    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  4. Arun 1 Reputation point
    2022-03-10T04:41:43.447+00:00

    You can use Syncfusion PDF Library. Using this library, you can also add text, images, graphics, or shapes to update a PDF. This .NET PDF library is designed to work easily with edit or modify PDF files and integrate seamlessly in your applications.

    https://www.syncfusion.com/pdf-framework/net/pdf-library/edit-pdf.

    The whole suite of controls is available for free (commercial applications also) through the community license program if you qualify. The community license is the full product with no limitations or watermarks.

    https://www.syncfusion.com/products/communitylicense

    Note: I work for Syncfusion.


  5. Russell James 1 Reputation point
    2023-02-15T15:27:44.9366667+00:00

    I need PDF Book for C# programming 2019 modified edtion