Tuesday, July 29, 2008

PDF generate with help of ABC pdf dll

ABCpdf.DLL ABCpdf_DotNET_v6.107 /////itextsharp.dll pdf convertion mate

========================
http://itextsharp.sourceforge.net/tutorial/index.html
========================
how to use this software to generate PDF in ASP.NET 2.0

just install this software on the host server and you will find ABCpdf.DLL in the below path

"C:\Program Files\WebSupergoo\ABCpdf .NET 6.1"

in the APPLICATION just add the dll in your bin folder of your project.

Then just run application first time. but it will be Trial version.
so you just need to enter this serial key to make it Full version.

Standard License : 393-927-439 or Use 341-639-358 for a Standard License or
719-253-057 for a Professional License
-------------------------------------------

aspx.cs file

---------------
Doc theDoc = new Doc();
theDoc.Rect.Inset(20, 20);
theDoc.Page = theDoc.AddPage();
int theID;
//theID = theDoc.AddImageUrl("http://www.nortelbureaureports.com/PDF_Preview_Campaign_Results_Detail_Page.aspx?Cid=" + Request.QueryString["Cid"].ToString());
theID = theDoc.AddImageUrl(System.Configuration.ConfigurationManager.AppSettings["AddImageUrl"].ToString() + "PDF_Preview_Campaign_Results_Detail_Page.aspx?Cid=" + Request.QueryString["Cid"].ToString());
while (true)
{
theDoc.FrameRect(); // add a black border
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();
}

Randomid = RandomNumber(99999);
string filename = string.Concat("PDFReport" + Randomid + ".pdf");
string targetFolder = Server.MapPath("~\\PDFWrite\\");
FinalFilePath = targetFolder + filename;
//theDoc.Save(Server.MapPath("pagedhtml.pdf"));
theDoc.Save(FinalFilePath);
theDoc.Clear();
Response.Clear();
Response.ClearHeaders();
Response.ContentType = "application/pdf";
Response.AddHeader("Content-Disposition", "attachment;filename=PDFReport.pdf");
//Response.AddHeader("Content-Type", "application/pdf");
Response.WriteFile(FinalFilePath);
Response.Flush();
Response.End();
System.IO.File.Delete(FinalFilePath);

========================
-------------------------------------------
using WebSupergoo.ABCpdf6;
using WebSupergoo.ABCpdf6.Objects;
using WebSupergoo.ABCpdf6.Atoms;
using WebSupergoo.ABCpdf6.Operations;

No comments: