//This is the program explain to us that how to create a pdf file form a tiff image
using iTextSharp.text;
using iTextSharp.text.pdf;
private void ImageToPdfConverter(string ImageP, string pdfP)
{
//FileStream fs = File.Open(@"D:\Tiff.pdf", FileMode.Create, FileAccess.Write);
string ImagePath = ImageP;// Server.MapPath("image/");
string PdfPath = pdfP;// Server.MapPath("pdf");
//PdfPath = "D:/";
//ImagePath = @"D:\Crop\01\163011410.tif";
Document doc = new Document();
PdfWriter.GetInstance(doc, new FileStream(PdfPath, FileMode.Create));
doc.Open();
// doc.Add(new Paragraph("TIF Scaled to 300dpi"));
iTextSharp.text.Image tif = iTextSharp.text.Image.GetInstance(ImagePath );
tif.ScalePercent(24f);
tif.ScaleToFit(doc.PageSize.Width - 50, doc.PageSize.Height - 50);
doc.Add(tif);
doc.Close();
}
Man that's mean that the pdf will be created with a 300dpi resolution?
ReplyDeleteDear @Anonymous
ReplyDeleteMan that's mean that the pdf will be created with a 300dpi resolution?
// doc.Add(new Paragraph("TIF Scaled to 300dpi"));
This line indicated that you can add the scale in doc what ever you want.
thank you for the quick answer Praveen, I have other doubt,Do you have a example to read the pdf properties? Do you know How can I know if the pdf created has a resolution of 300 dpi? I'm trying using the PDFReader class but I can't get that property
ReplyDeleteBest Regards
Hey, How can I show tiff with two frames in it.
ReplyDelete