原創|使用教程|編輯:郝浩|2013-04-11 11:00:18.000|閱讀 5240 次
概述:JpegDevice類允許您將PDF頁面轉換為JPEG圖像。這個類提供了一個叫Process的方法來執行這一轉換操作。您首先需要創建一個文檔類對象,從中獲取您想要轉換為JPEG的特定PDF頁面。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
JpegDevice類允許您將PDF頁面轉換為JPEG圖像。這個類提供了一個叫Process的方法來執行這一轉換操作。您首先需要創建一個文檔類對象,從中獲取您想要轉換為JPEG的特定PDF頁面。之后,你需要調用Process方法將頁面轉換為JPEG圖像。
下面是示例代碼
C#
//open document Document pdfDocument = new Document("input.pdf"); using (FileStream imageStream = new FileStream("image.jpg",FileMode.Create)) { //create JPEG device with specified attributes //Width, Height, Resolution, Quality //Quality [0-100], 100 is Maximum //create Resolution object Resolution resolution = new Resolution(300); //JpegDevice jpegDevice = new JpegDevice(500, 700, resolution, 100); JpegDevice jpegDevice = new JpegDevice(resolution, 100); //convert a particular page and save the image to stream jpegDevice.Process(pdfDocument.Pages[1], imageStream); //close stream imageStream.Close(); }
VB.NET
'open document Dim pdfDocument As New Document("input.pdf") Using imageStream As New FileStream("image.jpg",FileMode.Create) 'create JPEG device with specified attributes 'Width, Height, Resolution, Quality 'Quality [0-100], 100 is Maximum 'create Resolution object Dim resolution As New Resolution(300) 'JpegDevice jpegDevice = new JpegDevice(500, 700, resolution, 100); Dim jpegDevice As New JpegDevice(resolution, 100) 'convert a particular page and save the image to stream jpegDevice.Process(pdfDocument.Pages(1), imageStream) 'close stream imageStream.Close() End Using
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉載自:慧都控件網