Printing Markdown Text

I have a template column which holds markdown text summary of an order placed by a user on my app.
looks something like this:

Order # 28936

Item Quantity
Greenfield Cane Moalsses 500G x 1
Romi Cheese (Apx 300-350g) x 1
Beef Shawarma Halal 500g x 1

Any advice how I can get this markdown text printed? The trigger to print doesn’t have to be automated. I will press a button to print a copy of the order which is then attached to the order for shipping.

Copy to Clipboard action?

That’s a bit rough, because you’ll get the markdown formatting with it, so you’d then need to paste it into something that can render the markdown, before printing it.

An alternative would be to email it to yourself and then print the email?

If you wanted to get fancy, you could send the raw data through a webhook to something like Integromat, and then create a scenario that inserts the data into a template and emails it as an attachment, which could then be printed.

3 Likes

Thank you Darren.
I have 2 columns, a template text summary and a template markdown summary.

I hope to print an order summary using a thermal printer so I want to keep the Markdown format

I am still not sure how to break this down, correct me if the below is wrong:

  • A click on the print button in the Glide App will trigger a custom action that adds a row in Google Sheets to the Print Tab (or delete the row there and add a new one to save rows).
    (or do I replace this step with another that passes the value of the field outside Glide?)

  • Zapier or Integromat recognizes a new row added to the google sheet and reads the value of the summary cell (markdown)

  • somewhere in between I have to convert the markdown to pdf or to html then pdf?

  • how do I automate a print command without having to press another button outside Glide?

We do something a bit similar in one of our apps. When somebody creates an invoice (adds a row to an invoices table) within the app, that same action also sends the details (a few of the column values) to Integromat via a Webhook. We use Integromat to insert them into a template (in this case a formatted Google doc) and then convert to a PDF. In our case we then send that PDF via Telegram or email. The commonality is the requirement to get some formatted data out of Glide and into a PDF that you can then do something with.

1 Like

Is your thermal printer online, and does it have an API that you can post to?

If yes, then a very simple solution would be to use a bit of Apps Script to get the job done. So…

  • Tap button in Glide, which adds a row to your Google Sheet
  • Trigger function detects the new row, and posts the data to the printer
  • Done
1 Like

How do you convert the google doc to pdf? Is it through integromat as well?


Yes. If you’re using a Google Doc as your “template” and populating it from a webhook then you can add the “Download As PDF” module. This creates the PDF and makes it available within Integromat for you to subsequently email / Telegram / whatever.

4 Likes

I have a scenario that looks like this now

The Webhook takes the Markdown Order Summary from Glide to Integromat, switches it to HTML then to PDF.

left with a couple more issues now:

  • how to connect the printer to the automation and get this pdf printed automatically.
  • Integromat wants to specify the coordinates of the PDF… width is fine but I’m not sure how to automate the height.

would highly appreciate if any advice on the 2 issues above

1 Like

Would you advice to use the Integromat scenario below or should I give the App Script a try?

the data in the Google Sheet will be in Markdown. Would I need to convert in App Script to a different format then to the printer? I’l have a look at the community I think i saw you post sample scripts for a very similar scenario?

I don’t think you answered my question about whether or not the printer has an API or some other listening interface that you can post data to.

Again, if it does, the Apps Script solution should be quite straight forward. If there is an API and you can point me at the associated docs, I don’t mind helping you with that.

But if there is no way to communicate directly with the printer, then the integromat option is probably the next best choice.

1 Like

apologies for that, the printer is in the UK while i am working on the app from Qatar. I’ve yet to receive the info regarding the printer. thank you for the advice.

Okay, no problems. Once you have that, just give me a shout if you need some help with it.