Skip to content

Instantly share code, notes, and snippets.

@jonasbits
Created April 22, 2014 01:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonasbits/11162346 to your computer and use it in GitHub Desktop.
Save jonasbits/11162346 to your computer and use it in GitHub Desktop.
My code to use with jsPDF.js - http://mrrio.github.io/jsPDF/
var doc = new jsPDF("p","cm","a4");
//19x27px gradient background image
//doc.addImage(imgData,"JPEG",0.1,0.1,20.8,29.4);
//Data URL Size: 1187 bytes
//Original size: 872 bytes
//doc.setDrawColor(255,0,0); // draw red lines
doc.setLineWidth(0.03);
//fold-lines
doc.line(0.1, 7.3, 0.6, 7.3);
doc.line(0.1, 15.0, 0.7, 15.0);
doc.line(0.1, 22.3, 0.6, 22.3);
//cut-lines-left
doc.line(3, 9, 3, 10);
doc.line(3, 10, 16, 10);//4
doc.line(17.5, 9, 17.5, 10);
doc.line(17.5, 10, 18.5, 10);
//cut-lines-right
//x,y x,y
doc.line(3, 19, 3, 20);
doc.line(3, 19, 16, 19);//4
doc.line(17.5, 19, 17.5, 20);
doc.line(17.5, 19, 18.5, 19);
//calling-card-lines top
sealing = 1;
left = 6;
right = 15;
floor = 6.7
doc.line(left, sealing+1, left+1, sealing);
doc.line(right, sealing+1, right-1, sealing);
doc.line(left, floor-1, left+1, floor);
doc.line(right-1, floor, right, floor-1);
//calling-card-lines bottom
sealing = sealing + 22;
floor = floor + 22;
doc.line(left, sealing+1, left+1, sealing);
doc.line(right, sealing+1, right-1, sealing);
doc.line(left, floor-1, left+1, floor);
doc.line(right-1, floor, right, floor-1);
//END - no comment at the last row, bug
var comment = "if using http://mrrio.github.io/jsPDF/"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment