I wonder if there is a way to turn multiple images into a single PDF file. In my application I'm already pulling their address.
I wonder if there is a way to turn multiple images into a single PDF file. In my application I'm already pulling their address.
Using iTextSharp 4 , can be done as follows:
iTextSharp.text.Document Doc = new iTextSharp.text.Document(PageSize.LETTER, 20, 20, 20, 20);
string PDFOutput = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Output.pdf");
PdfWriter writer = PdfWriter.GetInstance(Doc, new FileStream(PDFOutput, FileMode.Create, FileAccess.Write, FileShare.Read));
Doc.Open();
string Folder = "C:\Diretorio\das\Imagens";
foreach (string F in System.IO.Directory.GetFiles(Folder, "*.jpg"))
{
Doc.NewPage();
Doc.Add(new iTextSharp.text.Jpeg(new Uri(new FileInfo(F).FullName)));
}
Doc.Close();