日期:2014-05-17 浏览次数:21228 次
Document document = null;
PdfWriter writer = null;
string fileSavePath = "d:\\";
System.Drawing.Image sourceImg = null;
iTextSharp.text.Image pdfImage = null;
try
{
// filePath = fileSavePath + "\temp" + ".pdf";
filePath = @"d:\temp.pdf";
iTextSharp.text.Rectangle rectPageSize = new iTextSharp.text.Rectangle(PageSize.A4);
// rectPageSize = rectPageSize.Rotate();
document = new Document(rectPageSize, 0, 0, 0, 0);
writer = PdfWriter.GetInstance(document, new FileStream(filePath, FileMode.Create));
document.Open();
// sourceImg = System.Drawing.Image.FromFile(fileSavePath + "\\" + fileInputName);
sourceImg =System.Drawing.Image.FromFile( fileInputName);
pdfImage = iTextSharp.text.Image.GetInstance(sourceImg, GetImageFormat(GetFileExtendName(fileInputName)));