Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. {
  2. public void Main(List<string> jobpath)
  3. {
  4.  
  5. string oldpath = @"C:Filessample_new.pdf";
  6. string newpath = @"C:Filessample_new_1.pdf";
  7.  
  8. PdfReader reader = new PdfReader(oldpath);
  9. Rectangle size = reader.GetPageSizeWithRotation(1);
  10. Document doc = new Document(size);
  11.  
  12. FileStream fs = new FileStream(newpath, FileMode.Create, FileAccess.Write);
  13. PdfWriter writer = PdfWriter.GetInstance(doc, fs);
  14. doc.Open();
  15.  
  16.  
  17. foreach (var list in jobpath)
  18. {
  19. cb.BeginText();
  20.  
  21. doc.NewPage();
  22. doc.Open();
  23.  
  24.  
  25.  
  26. PdfPTable table = new PdfPTable(1);
  27. table.HorizontalAlignment = Element.ALIGN_CENTER;
  28. table.TotalWidth = 400f;
  29. float[] widths = new float[] { 2f };
  30. table.SetWidths(widths);
  31. table.SpacingBefore = 40f;
  32. table.SpacingAfter = 30f;
  33. PdfPCell cell = new PdfPCell();
  34. cell.Colspan = 3;
  35. cell.HorizontalAlignment = 1;
  36. table.AddCell(list);
  37. doc.Add(table);
  38. PdfImportedPage page = writer.GetImportedPage(reader, 1);
  39. }
  40. doc.Close();
  41. }
  42.  
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement