none
How to convert PDF to JPEG through C#

    Question

  • Hello,

     

    Can any one tell me that how to convert PDF file into JPEG Format using C#?

     

    Thanks


    Ashish Patel, MCTS Software Engineer [Level - 2]
    Sunday, October 03, 2010 8:58 AM

Answers

All replies

  • Sunday, October 03, 2010 9:15 AM
  • Can any one tell me that how to convert PDF file into JPEG Format using C#?
    Ashish Patel, MCTS Software Engineer [Level - 2]
    Sunday, October 03, 2010 11:29 AM
  • Search "PDF to JPEG" in this forum.

    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
    Visual C++ MVP
    Sunday, October 03, 2010 2:37 PM
  • Hi Ashish_Patel,

     

    The following thread is suitable for your request.

    converting pdf file to an jpeg image

    RyannosaurusRex

    One solution is to use a third party library.  ImageMagick is a very popular, freely available too.  You can get the .NET wrapper for it by clicking the big green download button here.  The original ImageMagick download page is here.

     

    Yan Jun - MSFT

     http://www.codeproject.com/KB/library/pdftoimages.aspx Convert PDF pages to image files using the Solid Framework

       http://www.print-driver.com/howto/convert_pdf_to_jpeg.html Universal Document Converter

       http://www.makeuseof.com/tag/6-ways-to-convert-a-pdf-file-to-a-jpg-image/ 6 Ways To Convert A PDF To A JPG Image

     

    And you also can take a look at this thread:

    how to open a page from a pdf file in pictureBox in C#

    I had given a method is convert pdf to tiff first, and then retrieve the bmp from tiff.

     

    If there’s anything unclear, please feel free to let me know.

     

    Have a nice day!

    Mike

    -------------------------------------------------------------------

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to the others community members reading the thread.

     

    *****************************************************

    [All-In-One Code Framework]

    Sample world! You will get more from this world!

    Welcome to the new world!

    =================================================

    Third party disclaimer

     

    This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information is found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    Wednesday, October 06, 2010 6:22 AM
    Moderator
  • Hi  Ashish_Patel,

    You can use for this "PDF Focus .Net". Library supports PDF to Jpeg convertion succesful. 

    Example code for the converting from PDF file to JPEG files in C#:

     

                SautinSoft.PdfFocus f = new SautinSoft.PdfFocus();
                f.OpenPdf(@"c:\Multipage.pdf");
    
                if (f.PageCount > 0)
                {
                    //Save all PDF pages to image folder as jpeg images, 120 dpi
                    int result = f.ToImage(@"c:\folder with images\", "page",System.Drawing.Imaging.ImageFormat.Jpeg, 120);


     


    Thursday, January 12, 2012 12:25 PM
  • Hi Ashish_Patel,

     

    The following thread is suitable for your request.

    converting pdf file to an jpeg image

    RyannosaurusRex

    One solution is to use a third party library.  ImageMagick is a very popular, freely available too.  You can get the .NET wrapper for it by clicking the big green download button here.  The original ImageMagick download page is here.

     

    Yan Jun - MSFT

     http://www.codeproject.com/KB/library/pdftoimages.aspx Convert PDF pages to image files using the Solid Framework

       http://www.print-driver.com/howto/convert_pdf_to_jpeg.html Universal Document Converter

       http://www.makeuseof.com/tag/6-ways-to-convert-a-pdf-file-to-a-jpg-image/ 6 Ways To Convert A PDF To A JPG Image

     

    And you also can take a look at this thread:

    how to open a page from a pdf file in pictureBox in C#

    I had given a method is convert pdf to tiff first, and then retrieve the bmp from tiff.

     

    If there’s anything unclear, please feel free to let me know.

     

    Have a nice day!

    Mike

    -------------------------------------------------------------------

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to the others community members reading the thread.

     

    *****************************************************

    [All-In-One Code Framework]

    Sample world! You will get more from this world!

    Welcome to the new world!

    =================================================

    Third party disclaimer

     

    This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information is found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    The answer is very good, if you don't understand the c # how to convert PDF to jpeg?
    My sister is using OXPDF software, it can quickly put the file conversion into jpeg files. bing search this software. Found it has a lot of other functions. I have a good try  . Perfect convert PDF to jpeg.
    • Proposed as answer by Apitron LTD Thursday, June 06, 2013 12:39 PM
    • Unproposed as answer by Apitron LTD Thursday, June 06, 2013 12:39 PM
    Thursday, August 30, 2012 1:32 AM
  • Windows 8.1 now has PDF rendering APIs and ability to save as images. Check out samples @ 

    http://code.msdn.microsoft.com/windowsapps/PDF-viewer-sample-85a4bb30

    Saturday, June 29, 2013 3:10 AM
  • Hi, recently I came over a blog entry demonstrating this,

    here is the code:

    using Apitron.PDF.Rasterizer;
    using Apitron.PDF.Rasterizer.Configuration;
    
    internal class Program
    {
        private static void Main(string[] args)
        {
            // open and load the file
            using (FileStream fs = new FileStream(@"..\..\..\Documents\file.pdf", FileMode.Open))
            {
                // this object represents a PDF document
                Document document = new Document(fs);
                   
                // default rendering settings
                RenderingSettings settings = new RenderingSettings();
    
                // process and save pages one by one
                for (int i = 0; i < document.Pages.Count; i++)
                {
                    Page currentPage = document.Pages[i];
    
                    // we use original page's width and height for image as well as default rendering settings
                    using (Bitmap bitmap = currentPage.Render((int)currentPage.Width, (int)currentPage.Height,settings))
                    {
                        bitmap.Save(string.Format("{0}.png", i), ImageFormat.Png);
                        }
                    }
                    // preview first rendered page
                    Process.Start("0.png");
                }
            }
     }

    Tuesday, July 23, 2013 6:44 AM
  • Thanks ravibh! Just what I needed.
    Tuesday, October 29, 2013 6:00 PM