Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- public void Main(List<string> jobpath)
- {
- string oldpath = @"C:Filessample_new.pdf";
- string newpath = @"C:Filessample_new_1.pdf";
- PdfReader reader = new PdfReader(oldpath);
- Rectangle size = reader.GetPageSizeWithRotation(1);
- Document doc = new Document(size);
- FileStream fs = new FileStream(newpath, FileMode.Create, FileAccess.Write);
- PdfWriter writer = PdfWriter.GetInstance(doc, fs);
- doc.Open();
- foreach (var list in jobpath)
- {
- cb.BeginText();
- doc.NewPage();
- doc.Open();
- PdfPTable table = new PdfPTable(1);
- table.HorizontalAlignment = Element.ALIGN_CENTER;
- table.TotalWidth = 400f;
- float[] widths = new float[] { 2f };
- table.SetWidths(widths);
- table.SpacingBefore = 40f;
- table.SpacingAfter = 30f;
- PdfPCell cell = new PdfPCell();
- cell.Colspan = 3;
- cell.HorizontalAlignment = 1;
- table.AddCell(list);
- doc.Add(table);
- PdfImportedPage page = writer.GetImportedPage(reader, 1);
- }
- doc.Close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement