Print raw text to printer using Python in Windows?
<p>I am using Posiflex thermal receipt printer to print retail bills using python.</p>

<p>I tried with following </p>

<pre><code>import os

os.startfile("C:/Users/TestFile.txt", "print")
</code></pre>

<p>but whenever I tried printing there is white space trailing the text resulting in wastage of paper. How can I print just raw text eliminating trailing white space?</p>

<p>please find <a href="https://i.stack.imgur.com/7I9pF.png" rel="nofollow noreferrer">image</a> for clarity.
I want to print it like 2nd one but the output is like the 1st one.</p>