我正在尝试使用以下链接转换pdftoimage http://threebit.net/mail-archive/itext-questions/msg00436.html
但我得到这个错误如何让这段代码工作? “无法找到类型或命名空间名称'PdfDecoder'” 我正在寻找开源。
这个ghostscript dint在服务器上工作, http://www.codeproject.com/KB/webforms/aspnetpdfviewer.aspx
帮帮我。
答案 0 :(得分:2)
你可以试试这个......
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);
}
请查看more info
的链接你也可以试试这个
SautinSoft.PdfFocus f = new SautinSoft.PdfFocus();
f.ConvertPdfToImage(@"c:\sample.pdf", @"c:\pages\",
SautinSoft.PdfFocus.eImageFormat.Jpeg, 200);
请浏览此more info
的链接