官网:
http://sourceforge.net/projects/itextsharp/
http://hardrock.cnblogs.com/
http://www.rubypdf.com/
现在的版本是3.18版,记得在引用里导入itextsharp.下面的代码是把图象合并到一个多页pdf的例子.
processus vide privé (fichiers string[], chaîne newpdf)
{
iTextSharp.text.Document document = new iTextSharp.text.Document(iTextSharp.text.PageSize.A4, 25, 25, 25, 25);
essayer
{
iTextSharp.text.pdf.PdfWriter.GetInstance(document, nouveau FileStream(newpdf, FileMode.Create, FileAccess.ReadWrite));
document.Open();
iTextSharp.text.Imageimage ;
pour (int i = 0; i < files.Length; i++)
{
image = iTextSharp.text.Image.GetInstance(files[i]);
si (image.Height > iTextSharp.text.PageSize.A4.Height - 25)
{
image.ScaleToFit(iTextSharp.text.PageSize.A4.Width - 25, iTextSharp.text.PageSize.A4.Height - 25);
}
sinon si (image.Width > iTextSharp.text.PageSize.A4.Width - 25)
{
image.ScaleToFit(iTextSharp.text.PageSize.A4.Width - 25, iTextSharp.text.PageSize.A4.Height - 25);
}
image.Alignment = iTextSharp.text.Image.ALIGN_MIDDLE;
//image.SetDpi(72, 72);
document.NewPage();
document.Add(image);
//Phrase phrase3 = nouvelle Phrase(" [email protected] ", FontFactory.GetFont(FontFactory.TIMES, 9, iTextSharp.text.Font.NORMAL, new iTextSharp.text.Color(192, 192, 192)) );
//document.Add(phrase3);
}
}
attraper (Exception ioe)
{
MessageBox.Show(ioe.Message);
}
document.Close();
}