Click here to Skip to main content
16,003,345 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I want to export PDF Page into image. Can anybody suggest me how can I achive with C#.net

Thanks in Advance,
Bharath
Posted
Comments
Sergey Alexandrovich Kryukov 30-Jan-12 3:40am    
I wonder why? This is not easy. Why do you think this is more suitable for archive than PDF itself? By some strange reason, there is a log of commercial software...
--SA

This component rasterize the page to bitmap. Then you can convert it to other image format.

http://code.google.com/p/mupdf-converter/feeds[^]

Example:

C#
int page = 1;
int dpi = 200;
MuPDFLib.RenderType RenderType = RenderType.RGB;
bool rotateAuto = true;
string file = @"C:\test.pdf";
string password = ""; 

MuPDFLib.MuPDF pdfDoc = new MuPDFLib.MuPDF(file, password);

pdfDoc.Page = page;
if (picPDF.Image != null)
    picPDF.Image.Dispose();
Bitmap bm = pdfDoc.GetBitmap(0, 0, dpi, dpi, 0, RenderType,
                             rotateAuto, false, 0);
                
pdfDoc.Dispose();
 
Share this answer
 
v2
Comments
Musakkhir 18-Nov-13 8:14am    
what is picPDF? is it an object of an image control?
Musakkhir 18-Nov-13 13:06pm    
I am converting PDF File to image(in Png Format), A PDF files contains more than 500 pages and I have to display all pages into listboxcontrol, Also Consider the performance issue the pages should display immediately.

int dpi = 200;
MuPDFLib.RenderType renderType = MuPDFLib.RenderType.RGB;
bool rotateAuto = true;
string password = "";
MuPDFLib.MuPDF pdfDoc = new MuPDFLib.MuPDF(yourPdfFilename, password);
pdfDoc.Page = pdfDoc.PageCount;
for(int i=1;i<pdfDoc.PageCount;i++)
{
Bitmap bm = pdfDoc.GetBitmap(0, 0, dpi, dpi, 0, renderType,
rotateAuto, false, 0);
MemoryStream ms = new MemoryStream();
bm.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
ms.Position = 0;
BitmapImage bi = new BitmapImage();
bi.BeginInit();
bi.StreamSource = ms;
bi.EndInit();
pdfDoc.Dispose();
System.Windows.Controls.Image image = new System.Windows.Controls.Image();
image.Source = bi;

ListBoxControl1.Items.Add(image);
}
use iTextSharp library
...............
 
Share this answer
 
Similar question with answer
How to convert PDF,Word,Excel to jpg in C#.NET[^]
 
Share this answer
 
Comments
Rajesh Anuhya 30-Jan-12 10:17am    
Cool, +5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900