ABCpdf - Dynamic PDF Creation for ASP.Net


Note -If you are new in AbcPdf Click here for More Detail

Craete Demo.aspx page in your visual studio project

Demo.aspx

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
          <asp:button runat="server" text="Create PDF" ID="btn_createpdf"  Width="202px" OnClick="btn_createpdf_Click" />
    </div>
    </form>
</body>
</html>


Demo.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WebSupergoo.ABCpdf10;

namespace ABCPDF_Demo
{
    public partial class CreatePdf : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btn_createpdf_Click(object sender, EventArgs e)
        {
            Doc theDoc = new Doc();
            theDoc.Rect.Inset(25, 20);
            int theID;
                    
            string htmlstr = "<div style='height:auto; position:relative; margin-top:10px;'>";

            htmlstr += "<div style='background-color:white; margin-left:100px; border-bottom-style:solid; border-bottom-width:2px; border-bottom-color:#F0F0F0; width:90%; padding-bottom:50px;'>";           
            htmlstr += " <table align='center' cellspacing='0' style='width:100%;'>";
            htmlstr += "<tr>";
            htmlstr += "<td>";
            htmlstr += "<div style='padding-top:5px;'>";
            htmlstr += "<span style='color:#5C5574; font-family:Arial; font-size:18px; font-weight:bold;'>Loan Application </span>";
            htmlstr += "<span style='color:#5C5574; font-family:Arial; font-size:16px;'>";
            htmlstr += "<img src='Image / Capture123.PNG' style='width:19px;'/>|</span>";  
            htmlstr += "<span style='color:#5C5574; font-family:Arial; font-size:18px; font-weight:bold;'>Jack and Jill Anderson </span>";
            htmlstr += "</div>";
            htmlstr += "</div>";
            htmlstr += "</td>";

            htmlstr += "<td style='text-align:right;'><div style='background-color:white; margin-left:100px;'>";           
            htmlstr += "<span style='color:#f44336; font-family:Arial; font-size:36px; font-weight:bold;'>X</span>";
            htmlstr += "<span style='color:#4CAF50; font-family:Arial; font-size:36px; font-weight:bold; margin-left:-5px;'>Y</span>";
            htmlstr += "<span style='color: #433a98; font-family: Arial; font-size: 36px;'>Mortgages</span>";
            htmlstr += "</div>";
            htmlstr += "</td>";
            htmlstr += "</tr>";
            htmlstr += "</table>";
            htmlstr += " </div>";      
          
            htmlstr += "<div style='background-color:white; margin-left:100px;'>";
            htmlstr += "<span style='color: #84738C; font-family: Arial; font-size: 36px; font-weight: bold;'>Checklist</span></div>";
            htmlstr += "<div style='margin-left:100px; padding-top:20px;'>";
            htmlstr += "<span style='color: #84738C; font-family: Arial; font-size: 16px; font-weight: bold;'>The following items are included with this application</span></div>";
            htmlstr += "<div style='width:90 %; margin-top:40px; padding:10px; margin-left:100px; border-radius:0px; '>";
            htmlstr += "<table align='center' cellspacing='0' style='width:100%; border: 1px solid #F0F0F0;'><tr>";
            htmlstr += "<td style='height:45px; background-color:#f5f4f4; width:40%; padding-left:20px;'>";
            htmlstr += "<span style='color:#84738C; font-family:Arial; font-size:16px; font-weight:bold;'>Items</span></td>";

            htmlstr += "<td style='background-color:#f5f4f4;'>";
            htmlstr += "<span style='color:#84738C; font-family: Arial; font-size:16px; font-weight:bold;'>Notes</span>";
            htmlstr += "</td>";
            htmlstr += "</tr>";
            htmlstr += "<tr>";      

            htmlstr += "<td style='height:142px; padding-left:20px; vertical-align:top; '>";
            htmlstr += "<table cellspacing='0' style='width:100 %; '><tr>";
            htmlstr += "<td style='width: 10 %;'>";
            htmlstr += "<img style='width:30px; height:30px; ' src='Image / checkimage.PNG' /></td>";
            htmlstr += " <td><span style='color:#84738C; font-family:Arial; font-size:14px; font-weight:bold;'>Payslip</span></td>";
            htmlstr += " </tr><tr><td>";
            htmlstr += "<img  style='width:30px; height:30px; ' src='Image / checkimage.PNG' /></td>";
            htmlstr += "<td><span style='color: #84738C; font-family:Arial; font-size:14px; font-weight:bold;'>Signed Declaration</span></td>";
            htmlstr += "</tr><tr><td><img  style='width:30px; height:30px; ' src='Image / checkimage.PNG' /></td>";
            htmlstr += "<td><span style='color: #84738C; font-family: Arial; font-size: 14px; font-weight: bold;'>Sales and Purchase</span></td>";

            htmlstr += "</tr>";
            htmlstr += "<tr>";
            htmlstr += "<td>";
            htmlstr += "<img  style='width: 30px; height: 30px; ' src='Image / checkimage.PNG' /></td>";
            htmlstr += "<td><span style='color: #84738C; font-family: Arial; font-size: 14px; font-weight: bold;'>Agreement</span></td>";
            htmlstr += "</tr>";

            htmlstr += "</table></td><td style='vertical - align: top;'><table style='width: 100 %; height: 127px;'><tr>";
            htmlstr += "<td style='width: 10 %;'><span style='color: #84738C; font-family: Arial; font-size: 14px; font-weight: bold;'>Only for three months</span></td>";
            htmlstr += "</tr><tr><td>&nbsp;</td></tr><tr><td>&nbsp;</td></tr><tr><td>&nbsp;</td></tr></table></td></tr></table></div>";
            htmlstr += "<div style='margin-left:100px; padding-top:20px;'>";
            htmlstr += " <span style='color: #84738C; font-family: Arial; font-size: 16px; font-weight: bold;'>The following items will be forthcoming</span>";
            htmlstr += "</div>";
            htmlstr += "<div style='width:90 %; margin-top:40px; padding:10px; margin-left: 100px; border-radius:0px;'>";
            htmlstr += " <table align='center' cellspacing='0' style='width:100%; border: 1px solid #F0F0F0;'>";
            htmlstr += " <tr><td style='height:45px; background-color:#f5f4f4; width:40%; padding-left:20px;'><span style='color:#84738C; font-family: Arial; font-size:16px; font-weight:bold;'>Items</span></td>";

            htmlstr += "<td style='background-color:#f5f4f4;'>";
            htmlstr += "<span style='color: #84738C; font-family: Arial; font-size: 16px; font-weight: bold;'>Notes</span> ";
            htmlstr += "</td> ";
            htmlstr += "</tr> ";
            htmlstr += "<tr>";
            htmlstr += "<td style='height: 142px; padding - left: 20px; vertical - align: top; '> ";
            htmlstr += "<table cellspacing='0' style='width: 100 %; '> ";
            htmlstr += "<tr>";
            htmlstr += "<td style='width: 10 %;'> ";
            htmlstr += "<img style='width: 30px; height: 30px;' src='Image / checkimage2.PNG' /></td>";
            htmlstr += "<td><span style='color: #84738C; font-family: Arial; font-size: 14px; font-weight: bold;'>Payslip</span></td> ";
            htmlstr += "</tr> ";
            htmlstr += "<tr> ";
            htmlstr += "<td> ";
            htmlstr += "<img  style='width: 30px; height: 30px; ' src='Image / checkimage2.PNG' /></td> ";
            htmlstr += "<td><span style='color: #84738C; font-family: Arial; font-size: 14px; font-weight: bold;'>Signed Declaration</span></td>";
            htmlstr += "</tr>";
            htmlstr += "<tr> ";
            htmlstr += "<td>&nbsp;</td>";
            htmlstr += "<td>&nbsp;</td> ";
            htmlstr += "</tr>";
            htmlstr += "<tr>";
            htmlstr += "<td>&nbsp;</td>";
            htmlstr += "<td>&nbsp;</td> ";
            htmlstr += "</tr>";
            htmlstr += "</table>";
            htmlstr += "</td>";
            htmlstr += "<td style='vertical - align: top; '>";
            htmlstr += "<table cellspacing='0' style='width: 100 %; '>";
            htmlstr += "<tr>";
            htmlstr += "<td style='height: 30px; '><span style='color: #84738C; font-family: Arial; font-size: 14px; font-weight: bold;'>Payslip</span></td>";
            htmlstr += "</tr>";
            htmlstr += "<tr>";
            htmlstr += "<td style='height: 30px;'><span style='color: #84738C; font-family: Arial; font-size: 14px; font-weight: bold;'>Signed Declaration</span></td>";
            htmlstr += "</tr>";
            htmlstr += "<tr>";
            htmlstr += "<td style='height: 30px; '>&nbsp;</td>";
            htmlstr += "</tr>";
            htmlstr += "<tr>";
            htmlstr += "<td style='height: 30px;'>&nbsp;</td>";
            htmlstr += "</tr>";
            htmlstr += " </table>";
            htmlstr += "</td>";
            htmlstr += "</tr>";
            htmlstr += "</table>";
            htmlstr += "</div>";
            htmlstr += "</div>";
            htmlstr += " <div style='page-break-before:always'>pagebreak</div>";        


            theID = theDoc.AddImageHtml(htmlstr);
            while (true)
            {
                theDoc.FrameRect();
                if (!theDoc.Chainable(theID))
                    break;
                theDoc.Page = theDoc.AddPage();
                theID = theDoc.AddImageToChain(theID);
            }
            for (int i = 1; i <= theDoc.PageCount; i++)
            {
                theDoc.PageNumber = i;
                theDoc.Flatten();
            }

            theDoc.Save(@"D:pdf\pdf.pdf");
            theDoc.Clear();
        }
    }
}









Share this

Previous
Next Post »

7 comments

comments
September 7, 2018 at 7:27 AM delete

hi when i am trying to add image its not able to display on pdf after converting in pdf....html able to show image... any sugesstion

Reply
avatar
Anonymous
March 27, 2022 at 1:40 AM delete

Abcpdf - Dynamic Pdf Creation For Asp.Net - Complete .Net Tutorial >>>>> Download Now

>>>>> Download Full

Abcpdf - Dynamic Pdf Creation For Asp.Net - Complete .Net Tutorial >>>>> Download LINK

>>>>> Download Now

Abcpdf - Dynamic Pdf Creation For Asp.Net - Complete .Net Tutorial >>>>> Download Full

>>>>> Download LINK

Reply
avatar
vr
June 5, 2026 at 8:57 AM delete

Informative post! Online MongoDB training offers a flexible way to learn NoSQL database concepts, CRUD operations, indexing, aggregation, and database administration. Hands-on exercises and real-world projects help learners develop practical, career-focused skills from anywhere.mongodb training online

Reply
avatar
vr
June 5, 2026 at 9:47 AM delete

Great post! MuleSoft developer training offers hands-on learning in API development, Anypoint Platform, integration flows, and data transformation. With real-world projects and practical labs, learners can build strong enterprise integration skills and advance their careers in API development and system connectivity.mulesoft developer training

Reply
avatar
vr
June 5, 2026 at 9:48 AM delete

Informative post! A MuleSoft developer online course offers flexible, hands-on training in API development, Anypoint Platform, integration design, and data transformation. With real-world projects and practical labs, learners can build strong integration skills and advance their careers in enterprise API development.Mulesoft developer course online

Reply
avatar
June 9, 2026 at 2:25 AM delete

Thanks for sharing this information. The microsoft excel training program looks very comprehensive.

Reply
avatar
June 13, 2026 at 8:34 AM delete

A dell boomi course helps learners understand cloud integration and enterprise application connectivity using Dell Boomi technologies. This dell boomi course covers process design, APIs, connectors, and deployment concepts. Students gain practical experience through real-time projects and hands-on exercises. The course prepares learners for professional integration development careers.

Reply
avatar