iTextSharp
pdf 파일에 직접 내용을 만들어 넣기(Paragraph 등으로)
[링크 : http://www.csharpstudy.com/Practical/Prac-pdf.aspx]
[링크 : https://stackoverflow.com/questions/11307749/creating-multiple-page-pdf-using-itextsharp]
[링크 : https://www.nuget.org/packages/iTextSharp/]
iTextSharp에 HTML 내용을 넣기
[링크 : https://jujun.tistory.com/118]
iTextSharp
Docuement.NewPage()
한페이지 추가하기
[링크 : https://stackoverflow.com/questions/4124106/add-a-page-to-pdf-document-using-itextsharp]
private void button2_Click(object sender, EventArgs e)
{
Document doc = new Document(iTextSharp.text.PageSize.A4);
PdfWriter wr = PdfWriter.GetInstance(doc, new FileStream("simple.pdf", FileMode.Create));
doc.Open();
doc.AddTitle("Simple PDF 생성 예제");
doc.AddAuthor("Alex");
doc.AddCreationDate();
// 영문쓰기
doc.Add(new Paragraph("English : How are you?"));
doc.Add(new Paragraph("국문: 어때요?"));
doc.NewPage();
StyleSheet styles = new StyleSheet();
HtmlWorker hw = new HtmlWorker(doc);
String html_data = System.IO.File.ReadAllText(@"d:\test.html");
hw.Parse(new StringReader(html_data));
doc.NewPage();
String html_data2 = System.IO.File.ReadAllText(@"d:\test2.html");
hw.Parse(new StringReader(html_data2));
hw.EndDocument();
hw.Close();
doc.Close();
}
---
using iText.Kernel.Pdf;
using iText.Layout;
using iText.Layout.Element;
using iText.Html2pdf;
using iText.Html2pdf.Attach.Impl;
using iText.Layout.Font;
private void button2_Click(object sender, EventArgs e)
{
String DEST = "hello_world.pdf";
FileInfo file = new FileInfo(DEST);
file.Directory.Create();
PdfWriter writer = new PdfWriter(DEST);
PdfDocument pdf = new PdfDocument(writer);
Document document = new Document(pdf);
document.Add(new Paragraph("Hello World!"));
HtmlConverter.ConvertToPdf(new FileStream(@"d:\test2.html", FileMode.Open), pdf);
document.Close();
}
[링크 : https://kb.itextpdf.com/home/it7kb/examples/pdfhtml-accessible-pdf-creation]
[링크 : https://github.com/itext/itextsharp]
[링크 : https://github.com/itext/itext7-dotnet]
+
document.Add(new AreaBreak());
[링크 : https://stackoverflow.com/questions/17198337/how-can-i-make-a-page-break-using-itext]
[링크 : https://www.tutorialspoint.com/itext/itext_adding_areabreak.htm]
+
ConverToPdf() 메소드는 호출 이후 document를 close() 해버린다고.. -_-
[링크 : https://kb.itextpdf.com/.../itext-7-converting-html-to-pdf-with-pdfhtml/chapter-1-hello-html-to-pdf]