I create a pdf file using c# windows form application.
source code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using iTextSharp.text;
using iTextSharp.text.pdf;
using System.IO;
namespace PDFCreater
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
for (int i = 0; i < 3; i++)
{
//Document document = new Document(PageSize.A4.Rotate(), 0, 0, 5, 0);
Document document = new Document(PageSize.A4.Rotate());
PdfWriter.GetInstance(document, new FileStream("E:/a" + i + ".pdf", FileMode.Create));
document.Open();
Paragraph p = new Paragraph("Test:: " + i);
document.Add(p);
document.Close();
}
MessageBox.Show("complete");
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using iTextSharp.text;
using iTextSharp.text.pdf;
using System.IO;
namespace PDFCreater
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
for (int i = 0; i < 3; i++)
{
//Document document = new Document(PageSize.A4.Rotate(), 0, 0, 5, 0);
Document document = new Document(PageSize.A4.Rotate());
PdfWriter.GetInstance(document, new FileStream("E:/a" + i + ".pdf", FileMode.Create));
document.Open();
Paragraph p = new Paragraph("Test:: " + i);
document.Add(p);
document.Close();
}
MessageBox.Show("complete");
}
}
}
I want to insert image as logo in this pdf file in left side of this pdf page.
please help.

Rahul PrasadRank #2,557 · 546 reputationPosted Oct 14, 2018, 5:04 PM EDT
Raheel Ahmad143 reputationPosted Dec 11, 2018, 9:02 PM EST
Marvin ReidRank #1,963 · 746 reputationPosted Mar 30, 2022, 4:27 PM EDT
Abhishek SainiRank #202 · 11.9K reputationPosted Mar 31, 2022, 1:21 AM EDT
using System.IO; using iTextSharp.text; using iTextSharp.text.pdf; class Program { static void Main(string[] args) { using (Stream inputPdfStream = new FileStream("input.pdf", FileMode.Open, FileAccess.Read, FileShare.Read)) using (Stream inputImageStream = new FileStream("some_image.jpg", FileMode.Open, FileAccess.Read, FileShare.Read)) using (Stream outputPdfStream = new FileStream("result.pdf", FileMode.Create, FileAccess.Write, FileShare.None)) { var reader = new PdfReader(inputPdfStream); var stamper = new PdfStamper(reader, outputPdfStream); var pdfContentByte = stamper.GetOverContent(1); Image image = Image.GetInstance(inputImageStream); image.SetAbsolutePosition(100, 100); pdfContentByte.AddImage(image); stamper.Close(); } } }You can get the answer from this link
https://stackoverflow.com/questions/583629/how-can-i-insert-an-image-with-itextsharp-in-an-existing-pdf