How to generate PDF with Multilevel list with hierarchical numbering in C# application

Peter The Batman 1 Reputation point

Hi, I am new to C#, I am creating a small application, and I need to generate some PDF reports from C# application programmatically. Most of the reports will be Word-like multilevel lists with hierarchical numbering (these numbers have to be calculated automatically). And I want that the levels have indent from the left. I tried several PDF libraries, but none of them can calculate hierarchical numbering. Maybe someone could tell me some library, or how to do it without a library?

I mean something like this:

Microsoft Technologies based on the .NET software framework.
3,459 questions
A set of technologies in the .NET Framework for building web applications and XML web services.
3,313 questions
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,382 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Bruce ( 57,886 Reputation points

    PDF is graphics language, not reporting language. maybe you want a reports toolkit that supports pdf output.

    to your question. you would write code to handle the indenting and numbering, similar to the logic you would use with Console.Write()

    0 comments No comments

  2. Castorix31 82,116 Reputation points

    or how to do it without a library?

    Just use :

    PrintDocument.PrinterSettings.PrinterName = "Microsoft Print to PDF";
    PrintDocument.PrinterSettings.PrintToFile = true;
    PrintDocument.PrinterSettings.PrintFileName = "your_pdf_filename"";

    and you can draw/write anything in PrintPageEventHandler which will be saved into the .pdf file

    0 comments No comments