Mar 24, 2012

How to Convert Multipage TIFF image to PDF with C#?

39 comments
Some times we need to convert the tiff image to PDF file as requirement demands. There are a few for .NET including iTextSharp, PDFsharp and PDF Clown. Here we will use iTextSharp sample that was showing how to create a PDF file from a multipage TIFF image

// creation of the document with a certain size and certain margins
iTextSharp.text.Document document = new iTextSharp.text.Document(iTextSharp.text.PageSize.A4, 0, 0, 0, 0);


// Creation of the different writers
iTextSharp.text.pdf.PdfWriter writer = iTextSharp.text.pdf.PdfWriter.GetInstance(document, new System.IO.FileStream(Server.MapPath("~/PDF/Output.pdf"), System.IO.FileMode.Create));

// Load the tiff image and count the total number of pages
System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(Server.MapPath("~/FolderLocation/file.tif"));

int total = bmp.GetFrameCount(System.Drawing.Imaging.FrameDimension.Page);

document.Open();
iTextSharp.text.pdf.PdfContentByte cb = writer.DirectContent;
for (int k = 0; k < total; ++k)
{
        bmp.SelectActiveFrame(System.Drawing.Imaging.FrameDimension.Page, k);
        iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance(bm, System.Drawing.Imaging.ImageFormat.Bmp);


       // Scale the image to fit in the page
       img.ScalePercent(72f / img.DpiX * 100);
       img.SetAbsolutePosition(0, 0);
       cb.AddImage(img);
       document.NewPage();
}

document.Close();

39 comments :

  1. You can achieve this with Aspose.Imaging for .NET Library also and this library offers many other features which .net developers can use in their API.

    ReplyDelete
    Replies
    1. Questions on c# abby fine reader pdf to word converter is expected to relate to programming within the rasteredge page. Consider editing the question or leaving comments for improvement if you believe the question can be answered on page http://www.rasteredge.com/how-to/csharp-imaging/pdf-html5-feature-convert-pdf/

      Delete
  2. Anonymous2/27/2014

    Do you know how convert a searchable Tiff to a searchable PDF?

    ReplyDelete
    Replies
    1. Hi,
      Any solution? Even i am struck with the same issue.

      Delete
  3. Thanks a lot for making this available. I really appreciate that.
    ExtraTorrent UK proxy

    ReplyDelete
  4. thank you this helps a lot! Are there any examples how to exact a particular page of a multipage tiff?

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
    2. Questions on c# abby fine reader pdf to word converter is expected to relate to programming within the rasteredge page. Consider editing the question or leaving comments for improvement if you believe the question can be answered on page http://www.rasteredge.com/how-to/csharp-imaging/pdf-html5-feature-convert-pdf/

      Delete
  5. Very impressive !! I also got a solution from Spire.PDF ,here is an example which demonstrates the whole process ,check - Convert multipage image to PDF in C#..hope this can be helpful either..

    ReplyDelete
    Replies
    1. online best pdf to tiff converter c# for you can be download and pdf to tiff converter c# for your product, try this online best pdf to tiff converter c# for free on http://www.tagpdf.com/online/convert-pdf-to-tiff/.

      Delete
  6. Anonymous4/03/2015

    friends... this code create a pdf file from a specified image "file.tiff", can anyone tell me how to convert unlimited number of images to pdf, for example if i have a folder that contain 5 images convert to a 5 page pdf every image in a page of pdf?

    ReplyDelete
    Replies
    1. You can try http://www.rasteredge.com/online/pdf/convert-pdf-to-tiff/ for high quality create tiff from pdf. Even there is 10% discount on the first order.

      Delete
  7. You can try this free online pdf to image converter to convert pdf to multipage tiff online.

    ReplyDelete
  8. Replies
    1. Try the multi page tiff to pdf conversion directly and easily with high quality on rasteredge.com page http://www.rasteredge.com/online/pdf/convert-pdf-to-tiff/..

      Delete
  9. For management and troubleshooting of enormous databases, corporations square measure searching for qualified and licensed dispersions Hadoop experts for the duty. Hadoop Training in Chennai | Hadoop Training Chennai

    ReplyDelete
    Replies
    1. Questions on best multipage pdf to multipage tiff online single click tagpdf.com. can leaving comments for multipage pdf to multipage tiff online and be answered on tagpdf.com http://www.tagpdf.com/online/convert-pdf-to-tiff/.

      Delete
  10. c# add and delete pages in pdf online on page http://www.rasteredge.com/how-to/csharp-imaging/pdf-delete/

    ReplyDelete
  11. c# add and remove pages from pdf file online
    http://www.rasteredge.com/how-to/csharp-imaging/pdf-extract-pages/

    ReplyDelete

  12. You can download and try this interesting high quality page for c# how to remove watermark from pdf image on http://www.rasteredge.com/how-to/csharp-imaging/pdf-image-remove/

    ReplyDelete
  13. The first and easiest way to c# .net convert tiff to pdf is to use the rasteredage page http://www.rasteredge.com/how-to/csharp-imaging/pdf-convert-tiff/. The c# batch convert tiff to pdf function is not static, so you'll need to create an instance of the class.

    ReplyDelete
  14. Here is the link for you to vb.net .net convert tiff to pdf. Hope this gives you a start on rasteredge page http://www.rasteredge.com/how-to/vb-net-imaging/pdf-convert-tiff-to-pdf/

    ReplyDelete
  15. The first and easiest way to vb.net .txt to .pdf converter online is to use the rasteredage page http://www.rasteredge.com/how-to/vb-net-imaging/pdf-convert-text-to-pdf/. The

    vb.net .txt to pdf converter is not static, so you'll need to create an instance of the class.

    ReplyDelete
  16. The first and easiest way to Create PDF from Tiff is to use the rasteredage page http://www.rasteredge.com/how-to/csharp-imaging/pdf-convert-tiff-to-pdf/

    ReplyDelete
  17. اليك خدمات منزلية متقدمة تساعدنا علي الارتقاء بشركة ركن البيت في مدينة الدمام من خلال اعمالها المتميزة التي تقدمها في مجال النظافة والقضاء علي الحشرات فخدماتنا متنوعة مثل شركة تنظيف بالدمام التي تكون متخصصة في اعمال النظافة العامة التي تتمثل في المنشأت الكبيرة والصغيرة بجميع انواع واليك خدمة متميزة ايضا وهي شركة تنظيف فلل بالدمام التي تكون لديها كل الامكانيات المثالية التي تساعدنا في تنفيذ خدمات نظافة الفلل المستعملة والمفروشة بواسطة فريق فني لديه كل الامكانيات التي تساعده في تقديم ذلك ولديك خدمة ايضا نظافة الشقق بواسطة شركة تنظيف شقق بالدمام وعمل التنظيف اللازم لها بواسطة فريق لديه اعمال التميز والتنفيذ في تقديم الخدمات المخصصة في اعمال النظافة واليك خدمة مثالية نقدمها في القضاء علي الحشرات الصغيرة بواسطة مبيدات طبيعة تساعدنا في ذلك فتعاملك مع شركة مكافحة حشرات بالدمام لديها امكانيات متميزة تساعدك علي ان تخلصك من الحشرات لان تجد كل ذلك الا من خلال ركن البيت التي لديها كل الامكانيات في البحث عن شركة رش مبيدات بالدمام التي تقوم بالرش بواسطة فني مختص معه الادوات اللازمة للقيام بذلك وعطائك الضمانات اللازمة علي ذلك واليك خدمة نقل اثاث منزلية تساعدك في الوصول الي مكانك الجديد بواسطة شركة نقل اثاث بالدمام التي لديها كل الامكانيات والسيارات التي تساعدك علي تحقيق ذلك

    ReplyDelete
  18. Try the convert multiple page tiff to pdf directly and easily with high quality on pdfcoding page http://www.pdfcoding.com/online/pdf/convert-tiff-to-pdf/.

    ReplyDelete
  19. The first and easiest way for convert tiff to searchable pdf is to use the http://www.pdfcomponent.com/online/convert-tiff-to-pdf/

    ReplyDelete
  20. Here is the link for convert multipage pdf to tiff. Hope this gives you a start for you convert multipage pdf to tiff on pdfcomponent page http://www.pdfcomponent.com/online/convert-pdf-to-tiff/.

    ReplyDelete
  21. You can try http://www.pdfcoding.com/online/pdf/convert-pdf-to-tiff/ for high quality convert multipage tiff to pdf c#. Even there is 10% discount on the first order.

    ReplyDelete
  22. You will need to download the free how to convert tiff to pdf online. download this new how to convert tiff to pdf online with high quality on page http://www.rasteredge.com/online/pdf/convert-tiff-to-pdf/.

    ReplyDelete
  23. Nice sharing. R is a language and environment for statistical computing and graphics. Want to make a career in R Programming. Learn R Programming Online Training course @ GangBoard. We are the best provider of online training on evergreen technologies.

    ReplyDelete
  24. Excellent sharing. Testing is a wonderful field for IT peoples. Want to learn Selenium Training reach GangBoard. Hadoop Online Training

    ReplyDelete
  25. The best thing is that your blog really informative thanks for your great information!
    erp in chennai

    ReplyDelete
  26. Thank you for Sharing. I'm working in brave technologies private limited, We are the best erp software developers based in chennai. erp providers in chennai

    ReplyDelete
  27. Anonymous5/03/2017

    it works perfectly, thanks

    ReplyDelete