0

I am creating a project on online movie ticket booking. Now I want to create a pdf file of ticket. How to create or generate a pdf file.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Sonali
  • 339
  • 2
  • 3
  • 14
  • Related, poss duplicate: http://stackoverflow.com/questions/465433/creating-pdf-files-at-runtime-in-c-sharp –  Apr 24 '14 at 13:09

3 Answers3

1

To generate pdf go for below code

        Document document = new Document(iTextSharp.text.PageSize.LETTER, 10, 10, 42, 35);
        PdfWriter writer = PdfWriter.GetInstance(document , new FileStream(@"C:\YourPdf.pdf", FileMode.Create));
        document .Open();
        Paragraph paragraph = new Paragraph("Hi, \n This is my pdf file");
        document .Add(paragraph);
        document .Close();

For more information :-

http://www.codeproject.com/Articles/686994/Create-Read-Advance-PDF-Report-using-iTextSharp-in

http://www.dotnetfox.com/articles/how-to-create-pdf-document-in-Asp-Net-with-C-Sharp-using-itextsharp-1023.aspx

Neel
  • 11,625
  • 3
  • 43
  • 61
  • 1
    You may want to add information about the third party library the OP will need in order to use this code. –  Apr 24 '14 at 13:07
  • 1
    yes @DaveParsons I have added link for more info – Neel Apr 24 '14 at 13:09
-1

I've used PDF4Net in the past, it's very easy to use.

Fix
  • 1
-1

In addition I have used PDFSharp and it's very simple and intuitive! Cheers

MRodriguez08
  • 189
  • 1
  • 7