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

Peter The Batman 1 Reputation point
2022-03-15T23:20:55.49+00:00

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:
183409-image.png

Developer technologies | .NET | Other
Developer technologies | ASP.NET | Other
Developer technologies | C#
Developer technologies | 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.

Locked Question. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

{count} votes

3 answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 82,321 Reputation points Volunteer Moderator
    2022-03-18T16:27:54.763+00:00

    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 91,531 Reputation points
    2022-03-18T19:12:57.617+00:00

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

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more