My company has these small 4 in printers. When a driver delivers , they can print a receipt from a webpage. Problem is, these print jobs come out hard coded 8 x 11 pdf.
I found I can use drafts to capture the text from the pdf and print (almost perfectly) from there. The problem, as you might have guessed is the pdf doesn’t honor spaces or line breaks very well. So I am trying to figure out the best way to reformat the text in Drafts.
Basically the The text readout looks like this in the resulting Drafts document:
Item Itemnumber sku Quantity Unit Price Total
Widget 65542 0 4.00$25.00$100Widget2 65542 0 3.00$30.00$90
I am pretty good with regex and can format the results to detect line breaks and add spaces, but not sure where to begin exactly with Drafts. Thoughts?
I’m guess the captured text was a table in the PDF? It’s probably putting a space (or possibly at tab) between each value.
Drafts doesn’t really do “formatted” text. You could format that as a Markdown Table, and then be able to print using a print action that converted the Markdown to an HTML table. Not sure how that would come out, but maybe work looking at. It would require a bit of work to reformat the text, however.
Thanks! at this stage, I’d be happy if I could get it to honor line breaks. I am using the shortcut called Force select all which captures all text from a webpage (in this case it’s a pdf). It does capture all the text - I then share it to Drafts.
Do you know of a Drafts action which would do something similar; pulls PDF text into a Draft which honors the line breaks? That would get me started.
Drafts can extract text from a PDF.
As far as line feeds, if you use a Print action that prints as plain text, the line feeds should all come through as normal (example action). If you are using a Print action that coverts Markdown to HTML to print, then you need to use the standard Markdown convention of placing two spaces at the end of a line to make it insert an HTML line break tag (