You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the following demo program I would expect the HorizontalResolution and VerticalResolution to both be set to the dpi value passed into GhostscriptRasterizer.GetPage but it seems ot have no impact and resulting document always have 96 as the Horizontal and Vertical Resolution.
static void Main(string[] args)
{
using (FileStream fs = File.OpenRead(@"C:\temp\annots.pdf"))
{
var mytiff = ProcessMemoryStream(fs);
FileStream file = new FileStream(@"C:\temp\ghostscript.tif", FileMode.Create, FileAccess.Write);
mytiff.WriteTo(file);
file.Close();
mytiff.Close();
}
Console.ReadKey();
}
static MemoryStream ProcessMemoryStream(FileStream inputMS)
{
var gv = new GhostscriptVersionInfo(@"C:\Program Files\gs\gs10.00.0\bin\gsdll64.dll");
using (var rasterizer = new GhostscriptRasterizer())
{
rasterizer.Open(inputMS, gv, false);
MemoryStream tiffStream = new MemoryStream();
System.Drawing.Image img = rasterizer.GetPage(300, 2);
Console.WriteLine($"{img.Width}x{img.Height}");
Console.WriteLine($"{img.HorizontalResolution}x{img.VerticalResolution}"); // <---- Always prints 96x96 regardless of the dpi value above
img.Save(tiffStream, ImageFormat.Tiff);
rasterizer.Close();
return tiffStream;
}
}
I'm usign the latest version of Ghostscript, 10.0.0.0 and of Ghostscript.NET, 1.2.3.
I've also tried using the latest version of Ghostscript.NET from main and changing the hardcoded default values tform 96 to 300 with no impact:
public class GhostscriptViewer : IDisposable
{
...
private int _zoom_xDpi = 300;
private int _zoom_yDpi = 300;
...
}
Thanks for building a great wrapper
Ultimately I would like to emulate this command in code and i think all i need is the Resolution now
In the following demo program I would expect the HorizontalResolution and VerticalResolution to both be set to the dpi value passed into GhostscriptRasterizer.GetPage but it seems ot have no impact and resulting document always have 96 as the Horizontal and Vertical Resolution.
I'm usign the latest version of Ghostscript, 10.0.0.0 and of Ghostscript.NET, 1.2.3.
I've also tried using the latest version of Ghostscript.NET from main and changing the hardcoded default values tform 96 to 300 with no impact:
Thanks for building a great wrapper
Ultimately I would like to emulate this command in code and i think all i need is the Resolution now
FYI there was a change to fix this issue but that seems to not have worked:
x and y dpi ignores the set value #75
The text was updated successfully, but these errors were encountered: