Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
1.18/5 (3 votes)
See more:
How to export, textbox values and images to export pdf form...
kindly help plz...can you send some sample code..plz
Posted
Comments
Larminces 10-Aug-15 4:13am    
You can also check out this .net's word processing library, it provides a rather intuitive api for creating pdf files with C#.
Also I believe you'll find the following article interesting as well: How to export pdf file to asp.net's client[^]

To work with PDF, you can use iText, or its .NET port, iTextSharp:
http://en.wikipedia.org/wiki/IText[^],
http://itextpdf.com/[^],
http://sourceforge.net/projects/itextsharp/[^].

In included the reference to Java iText site as well, because most documentation is there. If you understand C#, it would not be difficult to understand Java-bases API documentation.

—SA
 
Share this answer
 
Download the dll of pdfsharp from here http://pdfsharp.codeplex.com/releases/view/37054


try
{
string textBoxText; // your Text Box text
System.IO.TextReader readFile = new StreamReader("Text.txt");
int yPoint = 0;

PdfDocument pdf = new PdfDocument();
pdf.Info.Title = "TXT to PDF";
PdfPage pdfPage = pdf.AddPage();
XGraphics graph = XGraphics.FromPdfPage(pdfPage);
XFont font = new XFont("Verdana", 20, XFontStyle.Regular );

while (true)
{
    if (string.IsNullOrEmpty("textBoxText"))
    {
        graph.DrawString(line, font, XBrushes.Black, new XRect(40, yPoint, pdfPage.Width.Point, pdfPage.Height.Point), XStringFormats.TopLeft);
        yPoint = yPoint + 40;
    }
}

string pdfFileName = "MyPdfFile.pdf";
pdf.Save(pdfFileName);
readFile.Close();
readFile = null; 
Process.Start(pdfFileName);
}
catch(Exception ex)
{
     //Log exception
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900