This article explains how to design a runtime generated PDF via HTML code.
ContentI will explain how to design a runtime generated PDF via HTML code functionality using Visual Studio Ultimate 2015 Preview.Sometimes, when you write code to generate a runtime PDF, you need a complex structure to be added to the PDF and you might think "Can't I just use the HTML code in it to create the tables or add some text or do some formatting?" Yes, you can, using the HtmlWorker class.Note: CSS aka style will not work.In brief, I will generate the runtime PDF using ITextSharp.Note: I will use the "iTextSharp.dll" as a PDF generator library. You can download it from:Links: Sourceforge and NuGet.You can find it on the attached file in the "bin" folder of this article but the best way is to add the ItextSharp as in Step B.Step 1
Create a new website named "Website1".Step 2
Add the ItextSharp library from the NuGet package using the following sub steps:
Then a popup window will open like:Type the "ItextSharp" into the Search TextBox. Then you will get the "ItextSharp" library in the left pane. To add it to the website just click on the Install button of the right pane.After the installation, you see the "Right" sign in the left pane that indicates that the library has been installed.You can also check it from the Solution Explorer.Step 3
Step 4
As in the following image:Note: You can provide any name of the generated file. For example here I provided "test.pdf".Step 5
Grid structure in css