Convert pictures to pdf and make book in C#
Download from this link https://github.com/hamza3344/picturetopdf/blob/main/makebook.zip My fiverr link: https://www.fiverr.com/hamzakhalid178 My Upwork Pro...

IT Core Soft
240 views β’ Jul 18, 2022

About this video
Download from this link https://github.com/hamza3344/picturetopdf/blob/main/makebook.zip
My fiverr link: https://www.fiverr.com/hamzakhalid178
My Upwork Profile: https://www.upwork.com/freelancers/~01cad71ccde3a7df56
Whatsapp Number: +923338672398
if you have any problem comment below. please like, share and subscribe the channel. Contact me on hamzahumzahamzah@gmail.com if you need any custom software, website and mobile Application.
code
using iText.IO.Image;
using iText.Kernel.Geom;
using iText.Kernel.Pdf;
using iText.Layout;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
List string files = new List string();
bool start = false;
DialogResult dr = openFileDialog1.ShowDialog();
if(dr==DialogResult.OK)
{
foreach(string file in openFileDialog1.FileNames)
{
files.Add(file);
start = true;
}
}
if(start)
{
files.Sort();
PdfWriter writer = new PdfWriter(files[0].Substring(0, files[0].LastIndexOf(@"\")) + @"\"+textBox1.Text+".pdf");
PdfDocument pdf = new PdfDocument(writer);
Document document = new Document(pdf, PageSize.A4);
foreach(string s in files)
{
iText.Layout.Element.Image img = new iText.Layout.Element.Image(ImageDataFactory.Create(s))
.SetHorizontalAlignment(iText.Layout.Properties.HorizontalAlignment.CENTER);
float width = PageSize.A4.GetWidth() - img.GetImageWidth();
document.SetTopMargin(width / 2);
document.SetBottomMargin(width / 2);
document.Add(img);
pdf.AddNewPage();
}
document.Close();
MessageBox.Show("See this location"+ files[0].Substring(0, files[0].LastIndexOf(@"\")) + @"\" + textBox1.Text + ".pdf");
}
}
private void Form1_Load(object sender, EventArgs e)
{
Initialize();
}
private void Initialize()
{
this.openFileDialog1.Filter = "Images (*.BMP;*.JPG;*.GIF;*.PNG)|*.BMP;*.JPG;*.GIF;*.PNG|"
+ "All files(*.*)|*.*";
openFileDialog1.Multiselect = true;
openFileDialog1.Title = "My Book Image";
}
My fiverr link: https://www.fiverr.com/hamzakhalid178
My Upwork Profile: https://www.upwork.com/freelancers/~01cad71ccde3a7df56
Whatsapp Number: +923338672398
if you have any problem comment below. please like, share and subscribe the channel. Contact me on hamzahumzahamzah@gmail.com if you need any custom software, website and mobile Application.
code
using iText.IO.Image;
using iText.Kernel.Geom;
using iText.Kernel.Pdf;
using iText.Layout;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
List string files = new List string();
bool start = false;
DialogResult dr = openFileDialog1.ShowDialog();
if(dr==DialogResult.OK)
{
foreach(string file in openFileDialog1.FileNames)
{
files.Add(file);
start = true;
}
}
if(start)
{
files.Sort();
PdfWriter writer = new PdfWriter(files[0].Substring(0, files[0].LastIndexOf(@"\")) + @"\"+textBox1.Text+".pdf");
PdfDocument pdf = new PdfDocument(writer);
Document document = new Document(pdf, PageSize.A4);
foreach(string s in files)
{
iText.Layout.Element.Image img = new iText.Layout.Element.Image(ImageDataFactory.Create(s))
.SetHorizontalAlignment(iText.Layout.Properties.HorizontalAlignment.CENTER);
float width = PageSize.A4.GetWidth() - img.GetImageWidth();
document.SetTopMargin(width / 2);
document.SetBottomMargin(width / 2);
document.Add(img);
pdf.AddNewPage();
}
document.Close();
MessageBox.Show("See this location"+ files[0].Substring(0, files[0].LastIndexOf(@"\")) + @"\" + textBox1.Text + ".pdf");
}
}
private void Form1_Load(object sender, EventArgs e)
{
Initialize();
}
private void Initialize()
{
this.openFileDialog1.Filter = "Images (*.BMP;*.JPG;*.GIF;*.PNG)|*.BMP;*.JPG;*.GIF;*.PNG|"
+ "All files(*.*)|*.*";
openFileDialog1.Multiselect = true;
openFileDialog1.Title = "My Book Image";
}
Tags and Topics
Browse our collection to discover more content in these categories.
Video Information
Views
240
Likes
7
Duration
9:45
Published
Jul 18, 2022
Related Trending Topics
LIVE TRENDSRelated trending topics. Click any trend to explore more videos.
Trending Now