Export multiple orders to one PDF

Hello!

I’m using L&L 26 via API calls.

I want to export several orders (.lst) to one PDF. I’ve already done that with labels (.lbl), but with export of a list I have a problem.
For orders I use two databases. In first database is data for the order and in second database are order items. To report (.lst) data from first database is send as LlDefineVariable(), items are sent as LlDefineField().

If I call LlPrintFieldsEnd() at the end of first order, I get footer of the table, but only for the first order. For other orders I get only empty pages.
If I don’t call llPrintFieldsEnd() I don’t get the footer and on following pages I get only table with data for each order. Data send to L&L as variables are printed only on first page.

Am I doing something wrong or is it possible to export several orders to PDF only using llStgSysStorageOpen(), llStgSysAppend() and llStgSysConvert()?

Best regards, Primoz

Hello Primoz,

for this the API LlPrintResetProjectState() would be useful. This resets the state of the print job as if LlPrint[WithBox]Start() had just been called. Call the API after each printed order. In principle, this would look like this:

LlPrintWithBoxStart()

foreach (Order)
{

//Your print loop:
…LlPrint()…, LlPrintFields(),…, LlPrintFieldsEnd
LlPrintResetProjectState()

}
LlPrintEnd()

A second approach, as you mentioned, would be to use the Storage API:

HLLSTG hStgOrg;
HLLSTG hStgAppend;
hStgOrg = LlStgsysStorageOpen(“c:\test\1.ll”, “”, FALSE, TRUE);
hStgAppend = LlStgsysStorageOpen(“c:\test\l2.ll”, “”, FALSE, TRUE);
LlStgsysAppend(hStgOrg,hStgAppend);
LlStgsysStorageClose(hStgOrg);
LlStgsysStorageClose(hStgAppend);

LlStgsysStorageConvert(“c:\test\l1.ll”, “c:\test\1.pdf”, “PDF”);

More elegant here would certainly be the first solution.

Thank you @tmetternich.

LlPrintResetProjectState() solved the problem. Export of multiple orders to one PDF works perfectly.

1 Like