using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections;
using System.Text;
using System.IO;
using System.Collections.Generic;
using iTextSharp.text;
using iTextSharp.text.pdf;
public partial class IssuePage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
for (int i = 1; i < 3; i++)
{
Document document = new Document(PageSize.A4, 10f, 10f, 30f, 0f);
document.Open();
PdfPTable table = new PdfPTable(2);
String pathin = @"D:\Employee.pdf";
String pathout = @"D:\Employee" + i + ".pdf";
PdfReader reader = new PdfReader(pathin);
PdfStamper stamper = new PdfStamper(reader, new FileStream(pathout, FileMode.Create));
string text = "
C32H16CuN8
";StringReader stringReader = new StringReader(text);
ColumnText ct = new ColumnText(stamper.GetOverContent(1));
TextReader tr = stringReader;
// List
System.Collections.Generics.List
for (int k = 0; k < htmlarraylist.Count; k++)
{
ct.AddElement(htmlarraylist[k]);
}
Rectangle rect = new Rectangle(46, 190, 530, 36);
ct.SetSimpleColumn(36, 36, PageSize.A4.Width - 36, PageSize.A4.Height - 175);
ct.Go();
stamper.Close();
document.Add(table);
document.Close();
}
}
}
But i keep gettinf this error
as ahown in the snapshot below.
i.is.cc/1pF4R9rK.png
How do i fix this error
Satya KarkiPosted Jun 29, 2021, 6:27 PM
Ben ThompsonPosted Jun 30, 2021, 3:25 PM
Leon DPosted Jun 30, 2021, 1:11 AM
Hi,
You can probably try Spire.PDF, it supports lots of PDF manipulations.
https://www.e-iceblue.com/Tutorials/Spire.PDF/Spire.PDF-Program-Guide/PDF-Conversion/Convert-HTML-String-to-PDF-in-C.html