Printing Reports to PDF always create ODS on mobile

19 views
Skip to first unread message

Manos Pappas

unread,
Jul 2, 2026, 7:02:09 AMJul 2
to Jam.py Users Mailing List
Hello,

I have a Jam v7 application that runs on a Linux server (Rocky Linux 9.8) with LibreOffice headless installed.
On the report client_module, the following is stated:

function on_before_print_report(report) {
    report.extension = 'pdf';
}

 When the application runs on desktop (any browser) and the user requests to print the report, a PDF file is returned to the server without issues. When the application runs on a mobile browser (Android or iOS), an ODF file is returned instead (which is not desirable).

What am I doing wrong here?

Thank you very much in advance for your help.

Regards,
Manos

Dean D. Babic

unread,
Jul 2, 2026, 10:25:15 AMJul 2
to Jam.py Users Mailing List

interesting.
with Invoice, and it works with v5
But Customer list does not on my mobile. Brave browser.
Safari not so. 
It might be that in mobile view on V7 the on_print is not firing.
Try setting it as in v5 invoice.
Or even set pdf on the report server code. 

To debug from local dev server and mobile phone, youll need ngrok software. 

Dean Babic

unread,
Jul 2, 2026, 10:32:08 AMJul 2
to Jam.py Users Mailing List
Or maybe email the report. That way no issues with the mobile browsers. Just a thought.

--
You received this message because you are subscribed to a topic in the Google Groups "Jam.py Users Mailing List" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jam-py/9BDfpuZwFi8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jam-py+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/jam-py/b856e31b-9b2b-4ce1-93a9-2139d303948an%40googlegroups.com.

Dean D. Babic

unread,
Jul 2, 2026, 11:08:13 PMJul 2
to Jam.py Users Mailing List
Hey Manos, 
how is it going with this? I just tried sharing connection with my iPhone, and as I wrote,
Brave browser works. Even Customer LIst  and Purchases. But nothing on Safari and Opera browsers.
And nothing from PythonAnywhere.

172.20.10.1 is my IPhone, see the pic with the server on Linux - using shared iphone Connection.
It will be very hard to debug this, due to mobile devices....
 
172.20.10.1 - - [03/Jul/2026 10:56:02] "POST /api HTTP/1.1" 200 -
172.20.10.1 - - [03/Jul/2026 10:56:03] "GET /static/reports/customers_report_2026-07-03_10-56-01.958364.pdf HTTP/1.1" 200 -
...
172.20.10.1 - - [03/Jul/2026 10:56:46] "POST /api HTTP/1.1" 200 -
172.20.10.1 - - [03/Jul/2026 10:57:22] "GET /static/reports/purchases_report_2026-07-03_10-57-21.712394.pdf HTTP/1.1" 200 -
To unsubscribe from this group and all its topics, send an email to jam-py+un...@googlegroups.com.
brave_browser.png

Dean D. Babic

unread,
Jul 2, 2026, 11:19:55 PMJul 2
to Jam.py Users Mailing List
Ha! This is a popup issue:
Tell users to allow pop-ups for the site in Settings → Safari → Block Pop-ups (not ideal, since it depends on every user changing a setting).

Now it works. On both, Safari and Opera. And working on PythonAnywhere:
https://jampy.pythonanywhere.com/ 

Youll need to look if PDF was actually created in static/reports
-rw-rw-r-- 1 dba dba 265469 Jul  3 10:56 customers_report_2026-07-03_10-56-01.958364.pdf
-rw-rw-r-- 1 dba dba  20349 Jul  3 10:57 purchases_report_2026-07-03_10-57-21.712394.pdf

Dean D. Babic

unread,
Jul 3, 2026, 12:33:23 AMJul 3
to Jam.py Users Mailing List
Here is a fix for popups:
function on_before_print_report(report) {
report._popup = window.open('', '_blank');

if (!report._popup || report._popup.closed) {
report.alert('Please allow pop-ups for this site to view the report.');
}
}

function on_open_report(report, url) {
if (report._popup && !report._popup.closed) {
report._popup.location = url;
} else {
window.location = url;
}
}

I tested it and it works.

Manos Pappas

unread,
Jul 3, 2026, 1:33:15 AMJul 3
to Jam.py Users Mailing List
Hi Dean,

The application was a v5 application that was converted to v7 by following the advise from the official documentation.
So far v7 is working great, mobile support is much improved since v5 and users do like the new UI/UX more than the old one.

I've also found the following: if I uncheck on the production server the option "Production" in the application parameters, the print function does work and returns a PDF.
If the "Production" option is checked (and the fake builder.html file is created in the application directory), the function returns an ODF instead.

I will try to study the source when I have some time, to try to understand why on mobile the option to print as PDF is always ignored.

Regards,
M.
Reply all
Reply to author
Forward
0 new messages