user992772
user992772

Reputation: 11

pdf to image issues

am trying to convert pdftoimage using the below link http://threebit.net/mail-archive/itext-questions/msg00436.html

but i get this error how to get this code to work ? "The type or namespace name 'PdfDecoder' could not be found" am looking for open source .

this ghostscript dint work on server , http://www.codeproject.com/KB/webforms/aspnetpdfviewer.aspx

help me.

Upvotes: 1

Views: 1925

Answers (1)

Glory Raj
Glory Raj

Reputation: 17701

you Can try this.....

 pdfDoc = (Acrobat.CAcroPDDoc)
 Microsoft.VisualBasic.Interaction.CreateObject("Ac roExch.PDDoc", "");
 int ret = pdfDoc.Open(inputFile);
 if (ret == 0)
 {
     throw new FileNotFoundException();
 }
// Get the number of pages (to be used later if you wanted to store that information)
 int pageCount = pdfDoc.GetNumPages();
// Get the first page
pdfPage = (Acrobat.CAcroPDPage)pdfDoc.AcquirePage(0);
pdfPoint = (Acrobat.CAcroPoint)pdfPage.GetSize();
pdfRect = (Acrobat.CAcroRect)
Microsoft.VisualBasic.Interaction.CreateObject("Ac roExch.Rect", "");
pdfRect.Left = 0;
pdfRect.right = pdfPoint.x;
pdfRect.Top = 0;
pdfRect.bottom = pdfPoint.y;
// Render to clipboard, scaled by 100 percent (ie. original size)
 // Even though we want a smaller image, better for us to scale in .NET
// than Acrobat as it would greek out small text
 pdfPage.CopyToClipboard(pdfRect, 0, 0, 100);
IDataObject clipboardData = Clipboard.GetDataObject();
if (clipboardData.GetDataPresent(DataFormats.Bitmap))
{
  Bitmap pdfBitmap =
  (Bitmap)clipboardData.GetData(DataFormats.Bitmap);
}

pls take a look at this link For more info

you can try this one also

 SautinSoft.PdfFocus f = new SautinSoft.PdfFocus();
 f.ConvertPdfToImage(@"c:\sample.pdf", @"c:\pages\", 
 SautinSoft.PdfFocus.eImageFormat.Jpeg, 200);

pls go through this link for more info

Upvotes: 2

Related Questions