PilotBob
PilotBob

Reputation: 3117

Does jsPDF allow for custom document sizes such as single labels?

I am trying to create pdf with a single label to print to a Brother PL-7 label printer.

I found jsPDF that is able to generate a PDF, however two problems.

  1. I can't seem to specify the document to a custom size.
  2. I am unsure of how to put the bar code I have in a canvas generated by jsBarcode into the PDF.

How can I create a single label size PDF document with a bar code included on it?

Upvotes: 0

Views: 1279

Answers (1)

David Ma
David Ma

Reputation: 59

I had the same issue and found this fix on their github issues page in regards to the first problem:

https://github.com/MrRio/jsPDF/issues/372

worked for me perfectly once the that code was altered.

I know a lot less about how what exactly jsBarcode generates, but if it is generating a canvas file as you mentioned in your question, it can be converted into a png/jpeg and then be fed into jsPDF. See HTML5 canvas, convert canvas to PDF with jspdf.js.

Upvotes: 1

Related Questions