Hi there
This message is specifically for
tom...@gmail.com who seems to have solved the problem and I would appreciate his feedback please.
I am currently attempting to use JCB with TCPDF library to produce PDF report output on ADMIN list views in my component.
I use the JCB admin view custom button option, to call a controller function which calls a model function in the admin list view code.
I have set up my own class based on the TCPDF class so that I can have custom header , footer and body options.
The data I wish to print to the PDF is sourced using the same GETITEMS and GETLISTQUERY functions as the ADMIN LIST VIEW controller/model.
I use the TCPDF "output" function to produce the report with the parameter 'I' (display in browser).
Issue 1 : If I run with above settings the report is show in current tab with garbage. To rectify I have to add code 'jexit();' after output to display pdf in current tab.
However, I need the data to print based on the filter settings as per the adminview listing. Regardless of filter setting, I found ALL data from the table is printed.
On debugging I found that the user states are not populated when the program accesses the LIST view GETITEMS method in the model.
I then added a call in the print method function in the model as follows : '$this->populateState();' prior to producing the report. I change the filter and then the report and it produces the correct data as per the filter in the current tab, but...
Issue 2 : When I try to return to the admin list view, the browser reports "Document Expired" and I have to refresh the admin list view manually. I rerun the report without changing the filter and the filtered data is diplayed correctly and the return to the list view works. If I change the filter again, and run the report, the 'document expired message is again shown.
So, next I attempted to open the report in a new window as PHP cannot output to a new window. So I am struggling with this.....
I have tried 'outputting' the report to a file, but again, I cannot display it in a new window.
The solution appears to be using ajax and javascript, but I am struggling.
I so in a conversation with tom..@gmail on 24 June this year with jcodewalker that he has 'the PDF working fine. Even have it return
as a download popup without saving anything to disk. If anyone is
interested i would'nt mind sharing the code.'
Please Tom, would you mind 'sharing the code' solution.
Regards
Franz