C# Printing PDF to thermal printer (Star TSP100) produces an unclear/fuzzy receipt

243 Views Asked by At

I have a C# .NET Framework Console App that sends PDF documents to named printers. I mainly print to an A4 printer & a thermal printer.

Here is a code snippet of the printing process:

// PdfiumViewer
var pdfViewer = new PdfViewer
{
    Document = PdfDocument.Load(filename)
};

// Create the printer settings for our printer
var printerSettings = new PrinterSettings
{
    PrinterName = printer,
    Copies = (short)1,
};

// Create our page settings with the paper size as the document size.
var pageSettings = new PageSettings(printerSettings)
{
    Margins = new Margins(0, 0, 0, 0), // No margins
    Color = false,
    PaperSize = new PaperSize("Custom PDF Size", pdfViewer.Document.PageSizes[0].Width, pdfViewer.Document.PageSizes[0].Height)
};

// Proceed to print
// Now print the PDF document
using (var document = PdfDocument.Load(filename))
{
    using (var printDocument = document.CreatePrintDocument())
    {
        printDocument.PrinterSettings = printerSettings;
        printDocument.DefaultPageSettings = pageSettings;
        printDocument.PrintController = new StandardPrintController();
        
        // Print the document
        printDocument.Print();
    }
}

I only print single page documents. Printing to the A4 Printer works just fine. Printing to the Thermal Printer (Star TSP100) always produces an unclear/fuzzy receipt. You can see the difference between the documents & printout below.

Unclear/Fuzzy Printout | PDF Document

The page size of the PDF document is 3.78 x 7.92 inches.

Printing the same PDF to the A4 Printer produces a very clear document.

I just wanted to know why is the receipt unclear. Are there any possible fixes?

I tried converting the PDF to a bitmap for the receipt and then printing - The results were worse. The output was more unclear

BMP Conversion output

1

There are 1 best solutions below

2
On

Please verify Your printer settings. You should have similar window in Your printer's settings. example

example