How to convert pdf to resized jpg without using ghostscript?
using (var inputStream = File.OpenRead(inputFile))
{
using (var outputStream = File.OpenWrite(outputFile))
{
using (var memoryStream = new MemoryStream())
{
MagickReadSettings settings = new MagickReadSettings();
settings.Density = new MagickGeometry(300);
settings.FrameIndex = 0;
settings.FrameCount = 1;
settings.Format = MagickFormat.Pdf;
using (MagickImage image = new MagickImage(inputStream, settings))
{
image.Quality = 100;
image.Write(memoryStream, MagickFormat.Jpg);
}
if (memoryStream.CanSeek) { memoryStream.Seek(0, System.IO.SeekOrigin.Begin); }
settings.Format = MagickFormat.Jpg;
using (MagickImage image = new MagickImage(memoryStream, settings))
{
image.Quality = 100;
image.Resize(115, 0);
image.Write(outputStream, MagickFormat.Jpg);
}
}
}
}