DevPinoy.org
A Filipino Developers Community
   
Create PDF in C# 2008 [Express]- A PDF Sample App For Grade 1 Pupils

A pdf application. Convert the content of the richTextBox control into a pdf doc. That's it. I'm trying to get around C#. This little app is based on popular tutorials you can find everywhere on www. Well, this might be a good way to jumpstart C# programming.

I am still waiting for Keith's ADO.Net Step-by-Step... 

 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using iTextSharp.text.pdf;
using iTextSharp.text.rtf;
using iTextSharp.text;
using iTextSharp;
using System.IO;


namespace MarlonRibunal.iCreatePDFSharp
{
public partial class frm_iCreatePDF_main : Form
{
public frm_iCreatePDF_main()
{
InitializeComponent();
messageiCreatePDF();
richTextBox1.Text = "iCreatePDF Test - A C# Application By Marlon Ribunal";
}

private void button1_Click(object sender, EventArgs e)
{
string iCreatePDFdir = "C:\\iCreatePDF\\PDFTest";
string iCreatePDFTest = iCreatePDFdir + "\\PDFTest.pdf";

Directory.CreateDirectory(iCreatePDFdir);

Document pdfDocCreatePDF = new Document();

PdfWriter.GetInstance(pdfDocCreatePDF, new FileStream(iCreatePDFTest, FileMode.Create));

pdfDocCreatePDF.Open();
pdfDocCreatePDF.Add(new Paragraph (richTextBox1.Text));
pdfDocCreatePDF.Close();
}

private void messageiCreatePDF()
{
MessageBox.Show("iCreatePDF is a PDF Creator Coded in C# By Marlon Ribunal. CLICK OK TO PROCEED");
}


}
}
 

Posted 02-14-2008 1:04 AM by marl

Comments

romcab wrote re: Create PDF in C# 2008 [Express]- A PDF Sample App For Grade 1 Pupils
on 02-14-2008 10:09 PM

Hi. tnx for this one. I try it, but i have encountered error.Do I need to add/download this dll?

marl wrote re: Create PDF in C# 2008 [Express]- A PDF Sample App For Grade 1 Pupils
on 02-20-2008 7:28 PM

@romcab

Yes, you need to add reference to iTextSharp library which you can download from this link: sourceforge.net/.../showfiles.php

-Marlon Ribunal

TrackBack wrote http://google.com.eg/search?hl=en&client=firefox-a&channel=s&rls=org.mozilla:en-us:official&hs=ceo&q=pdfcreator+c%23&btng=search&meta=
on 02-20-2008 11:47 PM
TrackBack wrote http://google.lv/search?hl=ru&q=pdf++c%23&btng=поиск&meta=
on 02-20-2008 11:47 PM
TrackBack wrote http://google.com/search?hl=en&safe=off&q=c%23+save+pdf+"sql+server+2005"
on 02-20-2008 11:47 PM
Keith Rull wrote What's keeping Keith busy?
on 02-22-2008 10:05 AM

I know. I know. I know. I wasn't able to post anything this past few weeks. It's been really

pikapika2501 wrote re: Create PDF in C# 2008 [Express]- A PDF Sample App For Grade 1 Pupils
on 02-25-2008 8:26 AM

wow, pagkaganda naman ganire. hehehe. thanks for sharing.

Copyright DevPinoy 2005-2008