i managed to make simple pdf pages with some text and images on the “page”, but now comes the hard thing.
I stored some data in a tiny_db asset and whanna make a grid on the paper.
I see this example code on the jspdf page, but do not know how to handle those “vectors” to pass to the pdf generation code … lists?:
var generateData = function (amount) {
var result = [];
var data =
{
coin: "100",
game_group: "GameGroup",
game_name: "XPTO2",
game_version: "25",
machine: "20485861",
vlt: "0"
};
for (var i = 0; i < amount; i += 1) {
data.id = (i + 1).toString();
result.push(Object.assign({}, data));
}
return result;
};
function createHeaders(keys) {
var result = [];
for (var i = 0; i < keys.length; i += 1) {
result.push({
'id' : keys[i],
'name': keys[i],
'prompt': keys[i],
'width': 65,
'align': 'center',
'padding': 0
});
}
return result;
}
var headers = createHeaders(["id", "coin", "game_group", "game_name", "game_version", "machine", "vlt"]);
var doc = new jsPDF({ putOnlyUsedFonts: true, orientation: 'landscape' });
doc.table(1, 1, generateData(100), headers, { autoSize: true });
i replied by myself … for the question if autotable is able to add plain text to the pages and not only tables, i tested adding a line to your example:
doc.text(‘This is some text.’, 20, 20);
and setting the table Y coordinate like that: doc.autoTable({startY: 30,
PS: remember always to add a ; ath the end of all jspdf “commands” (the last one do not care).
but real differences from appy builder and app inventor? … some time i’ll try to search commands and procedures on AI2 i think are present and then i realize i can have dreamt of them
like a sort of “got to scree” instead of “open screen” or a way to know if a screen is already opened