PDF格式的图像问题
本文关键字:问题 图像 格式 PDF | 更新日期: 2023-09-27 18:12:00
我尝试使用下面的链接转换pdftoimagehttp://threebit.net/mail-archive/itext-questions/msg00436.html
,但我得到这个错误如何得到这个代码的工作?"找不到类型或命名空间名称'PdfDecoder' "我在寻找开源软件。
这个ghostscript不能在服务器上工作,http://www.codeproject.com/KB/webforms/aspnetpdfviewer.aspx
帮助我。
你可以试试.....
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);
}
请查看此链接获取更多信息
你也可以试试这个
SautinSoft.PdfFocus f = new SautinSoft.PdfFocus();
f.ConvertPdfToImage(@"c:'sample.pdf", @"c:'pages'",
SautinSoft.PdfFocus.eImageFormat.Jpeg, 200);