0

How do I make a PDF with C# application?

I would like to make an application which creates a PDF document, but it could be Excel too.

I wish to make a file which contains tables and header.

Community
  • 1
  • 1
  • Just search some solutions and try out something that suits you. Most probably you have to use thirdParty software – SSD Mar 19 '18 at 17:36
  • You could also check out [GemBox.Spreadsheet](https://www.gemboxsoftware.com/spreadsheet), you can create both Excel and PDF files with it so no need for multiple libraries. – NixonUposseen Mar 20 '18 at 08:04
  • If you need to create or edit both pdf and excel files, I suggest you check Spire.Office, it also has a free version named Free Spire.Office: https://www.nuget.org/packages/FreeSpire.Office/ – Dheeraj Malik Mar 22 '18 at 02:53

2 Answers2

0

You could use ITextSharp to create your PDF file. And this post to help you with Excel.

Vikto
  • 512
  • 1
  • 7
  • 19
  • I saw solution with ITextSharp, but can I design that document? – Aleksa Djuric Mar 19 '18 at 18:01
  • Yes. I have already used this library to create and edit a pdf file. – Vikto Mar 19 '18 at 19:31
  • Look at this tutorial(https://www.mikesdotnetting.com/article/80/create-pdfs-in-asp-net-getting-started-with-itextsharp) I got from this post[https://stackoverflow.com/questions/9229548/a-good-guide-book-or-api-doc-for-itextsharp] on SO – Vikto Mar 19 '18 at 19:43
0

Take a look at PDFFlow library for generation of PDF in C#. It has features that you need: tables, multi-page spread tables, repeating areas (headers, footers, left, right), table repeating headers... and even more unique features (like automatic page creation, multi-level list, word-like tabulation, barcodes/QR codes, etc...) and easy fluent syntax:

var DocumentBuilder.New() 
    .AddSection() 
        .AddParagraph("Hello World!").SetFontColor(Color.Red) 
    .ToSection() 
    .AddImageToSection("Smile.png") 
        .AddTable() 
            .AddColumnToTable("Column1").AddColumnToTable("Column2") 
            .AddRow().AddCellToRow("Row1, Cell1").AddCell("Row1, Cell 2") 
        .ToTable() 
            .AddRow().AddCellToRow("Row2, Cell1").AddCell("Row2, Cell 2") 
.ToDocument() 
    .Build("Result.pdf"); 

This is first pages of my business document with multi-page spread table and repeating headers, which I created using this library: enter image description here

There are examples with source code and explanation, I found them very useful: examples.

Hope, this will help.