2
How do I save this DIV, with css formatting, if it is easier to do with table, also can, because what I need is only show this DIV with value inside.
It will be generated side by side.
var doc = new jsPDF();
var specialElementHandlers = {
'#editor': function (element, renderer) {
return true;
}
};
$('#btGerarPDF').click(function () {
doc.fromHTML($('#etiqueta').html(), 0, 0, {
'width': 170,
'elementHandlers': specialElementHandlers
});
doc.save('teste.pdf');
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.4/jspdf.debug.js"></script>
<div id="etiqueta" style="width: 89mm; height: 36mm; border: 1px solid black; font-size: 3em; text-align: center; float:left; margin-right: 10px">
<div style="padding-top: 33px;">102030</div>
</div>
<div id="etiqueta" style="width: 89mm; height: 36mm; border: 1px solid black; font-size: 3em; text-align: center; float:left; margin-right: 10px">
<div style="padding-top: 33px;">102030</div>
</div>
<div id="editor"></div>
<button id="btGerarPDF">gerar PDF</button>
Hello friend, I’ve used this library, but not with css inline. Have you tried using
@media print { }
in an archive.css
separate? You have more information about this type of media query here: http://www.joshuawinn.com/css-print-media-query/– Leandro Simões
@Leandrosimões Good morning. I think in PDF because of the control of the margins. I will print labels two columns using matrix printer, and the sheet is narrower than A4.
– Tiago