티스토리 뷰
iTextSharp 컴포넌트를 이용한 샘플코드이다.
가장 기본적인 예제로 Hello World 파일을 만드는 예제이다.
using System;
using System.IO;
using iTextSharp.text;
using iTextSharp.text.pdf;
namespace iTextSharpSample
{
class Program
{
static void Main(string[] args)
{
// step 1:
// Create an instance of the iTextSharp.text.Document object
Document document = new Document();
// step 2:
// Create a Writer that listens to this document and writes the document to the Stream
PdfWriter.GetInstance(document, new FileStream("sample.pdf", FileMode.Create));
// step 3:
// Open the document
document.Open();
// step 4:
// Adds content to the document
document.Add(new Paragraph("Hello World"));
// step 5:
// Closes the document
document.Close();
}
}
}
가장 기본적인 예제로 Hello World 파일을 만드는 예제이다.
using System;
using System.IO;
using iTextSharp.text;
using iTextSharp.text.pdf;
namespace iTextSharpSample
{
class Program
{
static void Main(string[] args)
{
// step 1:
// Create an instance of the iTextSharp.text.Document object
Document document = new Document();
// step 2:
// Create a Writer that listens to this document and writes the document to the Stream
PdfWriter.GetInstance(document, new FileStream("sample.pdf", FileMode.Create));
// step 3:
// Open the document
document.Open();
// step 4:
// Adds content to the document
document.Add(new Paragraph("Hello World"));
// step 5:
// Closes the document
document.Close();
}
}
}
'Code > C#' 카테고리의 다른 글
| WebBrowser.ReadyState 샘플코드 (0) | 2008.04.11 |
|---|---|
| RichTextBox AutoResize 샘플코드 (0) | 2008.04.08 |
| [C#] Object Initializer 사용법 샘플 코드 (0) | 2008.02.11 |
| [C#] 간단한 Object Initializer 샘플 코드 (0) | 2008.02.11 |
| [C#] 간단한 Lambda Expression 샘플 코드 (0) | 2008.02.11 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- DotNetMagic
- READYSTATE_COMPLETE
- AxWebBrowser
- iTextSharp
- Sample Code
- 애드센스숨기기
- autohotkey
- Microsoft
- 애드센스감추기
- Automation
- c#
- Phalanger
- AdSense감추기
- Regular Expressions
- windows
- jre
- iText
- .net framework
- 유틸리티
- 스크린캡쳐
- download.com
- registry
- ScreenHunter
- Rollback Rx
- java
- Service pack
- tagREADYSTATE
- AdSense숨기기
- WinAutomation
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | |||
| 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| 12 | 13 | 14 | 15 | 16 | 17 | 18 |
| 19 | 20 | 21 | 22 | 23 | 24 | 25 |
| 26 | 27 | 28 | 29 | 30 | 31 |
글 보관함