Imports iTextSharp
Imports iTextSharp.text
Imports iTextSharp.text.pdf
Imports iTextSharp.text.xml
Imports System.Text
Imports System.IO
'download and add as reference iTextSharp DLL
'//Create Document class obejct and set its size to letter and give space left, right, Top, Bottom Margin
'Document doc = new Document(iTextSharp.text.PageSize.LETTER, 10, 10, 42, 35);
' Try
'{
'PdfWriter wri = PdfWriter.GetInstance(doc, new FileStream("c:\\Test11.pdf", FileMode.Create));
'//Open Document to write
'doc.Open;
'//Write some content
'Paragraph paragraph = new Paragraph("This is my first line using Paragraph.");
'Phrase pharse = new Phrase("This is my second line using Pharse.");
'Chunk chunk = new Chunk(" This is my third line using Chunk.");
'// Now add the above created text using different class object to our pdf document
'doc.Add(paragraph);
'doc.Add(pharse);
'doc.Add(chunk);
'}
'catch (DocumentException dex)
'{
'//Handle document exception
'}
'catch (IOException ioex)
'{
'//Handle IO exception
'}
'catch (Exception ex)
'{
'//Handle Other Exception
'}
' Finally
'{
'doc.Close(); //Close document
'}
No comments:
Post a Comment