Closed atmike closed 1 year ago
Can you please share your PDF so I can take a look into this?
Found your Mail address and send you all the Information to your gmail address. Thanks for helping
Got it, please give me some time to look into this.
It looks like interpolation issue. By default GhostscriptRasterizer
adds -dDOINTERPOLATE
parameter which you can override (turn it off) by adding -dNOINTERPOLATE
custom switch before opening GhostscriptRasterizer
like this:
int desired_dpi = 360;
using (var rasterizer = new GhostscriptRasterizer(Ghostscripts))
{
var bytes = StaticHelper.ReadFully(inputFile);
var path = Path.Combine(setting.DownloadFolder, Guid.NewGuid().ToString() + ".pdf");
File.WriteAllBytes(path, bytes);
rasterizer.CustomSwitches.Add("-dNOINTERPOLATE"); // >>>>> custom switch
rasterizer.Open(path);
for (var pageNumber = 1; pageNumber <= rasterizer.PageCount; pageNumber++)
{
PrintInfo PrintInfo = new PrintInfo() { PDFFile = path };
var pageFilePath = Path.Combine(setting.DownloadFolder, string.Format("Page-{0}-{1}.png", Guid.NewGuid().ToString(), pageNumber));
var img = rasterizer.GetPage(desired_dpi, pageNumber);
img.Save(pageFilePath, ImageFormat.Png);
img.Dispose();
}
rasterizer.Close();
}
I've tested your PDF with -dNOINTERPOLATE
custom switch and that fixes the problem.
Cheers
Hi Josip, thank you for your help this was exactly the solution. Barcodes look good and I can scan them. Thanks a lot for your help
Hello all, I currently have the task that I have to print shipping labels that I get as PDF via C#. I use Ghostscript to split the PDF into individual pages and then print the images. This works very well, but I have the problem that everything is printed bold. This is especially a problem with the printed 2D barcodes, because then you can not read them.
Here is the Code I' using at the moment to create the Images:
As you can see a already played with GraphicsAlphaBits / TextAlphaBits and sets them to 0 and I changed the DPI. But nothing worked the Bold will not go away.
By the way, when I send the PDF directly to the printer, it prints correctly.
Anyone have an idea how to solve this?
Best Regards Michael