PDFファイルのページから画像を取得したい。良い解決策は、ghostscriptsharp を使用することです。単一ページまたは複数ページを取得するための特別なメソッドがあります。
GeneratePageThumbs(string inputPath, string outputPath, int firstPage, int lastPage, int width, int height)
ここに私の完全なコードがあります:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GhostscriptSharp;
namespace GetPages
{
class Program
{
static void Main(string[] args)
{
GhostscriptWrapper.GeneratePageThumbs(@"C:\Users\User\Downloads\English_Medium_Extra_for_WEB-2.pdf",
@"C:\Users\User\Desktop\Test", 1, 3, 130, 130);
}
}
}
しかし、この方法を使用すると例外があります。
ExternalException
Ghostscript 変換エラー