Advertisement
Guest User

Untitled

a guest
Dec 11th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
  2.  
  3. Document doc = new Document(iTextSharp.text.PageSize.A4,50,50,120,40);
  4.  
  5.  
  6. PdfWriter writer = PdfWriter.GetInstance(doc, new FileStream(path+"\Invoices\Test.pdf", FileMode.Create));
  7. PdfPTable table = new PdfPTable(2);
  8. table.WidthPercentage = 100;
  9. table.DefaultCell.BorderWidth = 0;
  10. table.DefaultCell.HasBorder(iTextSharp.text.Rectangle.NO_BORDER);
  11. table.AddCell(new PdfPCell() { HorizontalAlignment = PdfPCell.ALIGN_LEFT, Phrase = new Phrase("Text to the left"), BorderColor = BaseColor.WHITE, BorderWidth = 0 });
  12. table.AddCell(new PdfPCell() { HorizontalAlignment = PdfPCell.ALIGN_RIGHT, Phrase = new Phrase("Text to the right"), BorderColor = BaseColor.WHITE, BorderWidth = 0 });
  13.  
  14. // table.AddCell(new PdfPCell("Text to the left", PdfPCell.ALIGN_LEFT));
  15. // table.AddCell(new PdfPCell("Text to the left", PdfPCell.ALIGN_RIGHT));
  16. document.add(table);
  17.  
  18. doc.Open();
  19. Paragraph p = new Paragraph("This is a first text above n n", FontFactory.GetFont("Arial", 8.0f, BaseColor.BLACK));
  20. doc.Add(p);
  21. doc.Add(table);
  22. doc.Close();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement