Read the pdf file and convert it into a .doc file
private void button3_Click(object sender, EventArgs e)
{
//path you want to store PDF
string pdfPath = string.Format(@"E:\{0}.pdf", DateTime.Now.ToString("yyyy-MM-dd hhmmss"));
using (FileStream msReport = new FileStream(pdfPath, FileMode.Create))
{
//step 1
using (Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 140f, 30f))
{
// step 2
PdfWriter pdfWriter = PdfWriter.GetInstance(pdfDoc, msReport);
//open the stream
pdfDoc.Open();
iTextSharp.text.Image jpg = iTextSharp.text.Image.GetInstance("ANIL SCAN.jpg");
jpg.Alignment = iTextSharp.text.Image.ALIGN_LEFT;
jpg.Border = iTextSharp.text.Rectangle.NO_BORDER;
jpg.BorderColor = iTextSharp.text.BaseColor.WHITE;
jpg.ScaleToFit(170f, 100f);
pdfDoc.Add(jpg);
pdfDoc.Close();
}
}
}
{
//path you want to store PDF
string pdfPath = string.Format(@"E:\{0}.pdf", DateTime.Now.ToString("yyyy-MM-dd hhmmss"));
using (FileStream msReport = new FileStream(pdfPath, FileMode.Create))
{
//step 1
using (Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 140f, 30f))
{
// step 2
PdfWriter pdfWriter = PdfWriter.GetInstance(pdfDoc, msReport);
//open the stream
pdfDoc.Open();
iTextSharp.text.Image jpg = iTextSharp.text.Image.GetInstance("ANIL SCAN.jpg");
jpg.Alignment = iTextSharp.text.Image.ALIGN_LEFT;
jpg.Border = iTextSharp.text.Rectangle.NO_BORDER;
jpg.BorderColor = iTextSharp.text.BaseColor.WHITE;
jpg.ScaleToFit(170f, 100f);
pdfDoc.Add(jpg);
pdfDoc.Close();
}
}
}
Comments