Closed daiger14 closed 6 years ago
Could you provide us with an SVG sample that reproduces this issue? Which version of svg2pdf and jsPDF are you using?
SVG sample https://pastebin.com/tBCLpWc7
$ npm view jspdf-yworks version 1.3.2
$ npm view svg2pdf.js version 1.2.1
This is not a bug of svg2pdf. You need to set the unit of jsPDF to "pt":
const doc = new jsPDF({
unit: "pt"
})
The reason is that font-sizes are always given in points, whereas all other measures are given in the unit passed to the constructor (default: "mm").
Hello. Text in generated pdf doesn't have alignment and font size like in original svg. Code:
const doc = new jsPDF(); result.forEach((page) => { svg2pdf(page, doc, { xOffset: 0, yOffset: 0, scale: 0.39, }); doc.addPage(); });
Example: Original svg PDF PDF generated from canvas (convert svg to image and draw in canvas) Maybe I did something wrong? Or need to add some settings to pdf? Tried this simple code to check if will be some difference, nothing has changed.doc.setFont('helvetica'); doc.setFontType('bold'); doc.setFontSize(20);
Thanks.