Created
June 4, 2019 18:42
-
-
Save dmslabsbr/a5b23c877970fd9caf4fa68eb3eca0e0 to your computer and use it in GitHub Desktop.
Function to show numbers in a jsPDF pdf to help you put text in correct point.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Mostra números x : y para ajudar a colocar os dados nos locais certos. | |
* @param {*} doc | |
*/ | |
function mostraRegua(doc) { | |
let pH = doc.internal.pageSize.height; | |
let pW = doc.internal.pageSize.width; | |
doc.setFontSize(5); | |
doc.setTextColor(255, 0, 0); | |
doc.setDrawColor(0,0,255); | |
for (var y = 0; y < pH; y += 50) { | |
for (var x = 0; x < pW; x += 50) { | |
doc.text(x+3, y+2, '' + x + " / " + y); | |
doc.circle(x, y, 1); | |
} | |
} | |
return doc; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment