[英]Create PDF Thumbnail C# in WinForms
我正在尋找一個簡單的免費組件,可以在其中生成給定的pdf文件Thumbnail。
我研究了PDFBox
, GhostScript
和Abobe Interop
。 GhostScript
太重而無法部署(文件太多),並且Abobe Interop
需要安裝Acrobat Pro 7或更高版本,否則COM異常和PDFBox呈現功能仍未實現。 Win-forms是否有免費的簡單組件?
我也查看了http://tallcomponents.net/ PDF縮略圖組件,僅適用於Web
提前致謝。
看一下PDFLibNet 。 它是一個可用於查看PDF的DLL。 您可以使用它為每個頁面生成預覽圖像,如下所示:
Image RenderPage(PDFLibNet.PDFWrapper doc, int page)
{
doc.CurrentPage = page + 1;
doc.CurrentX = 0;
doc.CurrentY = 0;
using (var box = new PictureBox())
{
// have to give the document a handle to render into
doc.RenderPage(box.Handle);
// create an image to draw the page into
var buffer = new Bitmap(doc.PageWidth, doc.PageHeight);
doc.ClientBounds = new Rectangle(0, 0, doc.PageWidth, doc.PageHeight);
using (var g = Graphics.FromImage(buffer))
{
var hdc = g.GetHdc();
try
{
doc.DrawPageHDC(hdc);
}
finally
{
g.ReleaseHdc();
}
}
return buffer;
}
}
我們正在尋找一種類似的解決方案-從pdf創建圖像“縮略圖”。 在搜索中,我們查看了以上所有內容,但它們都有自己的問題和復雜性。
我們偶然發現了abcPDF(http://www.websupergoo.com/)。 該產品具有全部功能,並且簡單易用。 這是他們有關從PDF創建PNG的文檔的深層鏈接。 http://www.websupergoo.com/helppdf8net/source/4-examples/19-rendering.htm
我已經在SourceForge.net上創建了項目。 我已使用Windows API,因此您不需要任何Adobe Pro:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.