We use Aspose.Pdf 19.4.0.
There is a large PDF document about 600 MB in size. We need to convert some pages of this document to images. To do this, we used the following code:
Summary
var resultConvert = new ConvertResult { FolderPath = UniqTempFolderName, IsImage = true };
try
{
using (new Foundation.Security.Deimpersonation())
{
using (var document = new Document(settings.InputFilePath))
{
resultConvert.PageCount = document.Pages.Count;
using (var imageStream = new FileStream(settings.ResultFilePath, FileMode.Create))
{
var resolution = new Resolution(_convertResolution);
var imageDevice = new PngDevice(resolution);
var page = document.Pages[settings.PageNumber];
var swConvertation = new Stopwatch();
swConvertation.Start();
imageDevice.Process(page, imageStream);
swConvertation.Stop();
Log.LogInfo($">> Convertation pdf to image ended. time: {swConvertation.Elapsed.TotalMilliseconds}ms");
imageStream.Close();
resultConvert.ResultFiles[settings.PageNumber] = settings.ResultFileName;
}
}
}
}
As a result, the pages take quite a long time to convert (11.5 seconds). There is an entry in the log file:
24.04.2020 17:28:49 Information >> Convertation pdf to image ended. time: 11455,1858ms
How can I make the pages convert faster?