· Jul 16, 2020

create a PDF from the DeepSee UserPortal using a headless browser

Hello Community, 
I hope you're going well.

I am programming a daily reporting that will send by e-mail when people will add a dashboard as favorite by clicking on the star :


I asked Intersystems WRC on how to automatically generate a report with some line coding, but I heard there is no way to do this without a headless Browser.

I downloaded google-chrome to use the "--headless"  and "--print-to-pdf" function , to print the HTML content of my dashboard into a PDF.  ( I will use $ZF function to launch the generation ). 

I also created a delegated application "/userPortal"  to be able to use the "ZAUTHENTICATE.mac" routine : 

I will put as an argument "Username=pdfOutput" . In this way , It will create a delegate user that only have "read permission" to secure a bit my application. 

When I open the next URL in Chrome , It opens the DashboardViewer without any problem :

The URL changed automatically and remove the "Username" part ( redirection security  ? )


My problem is the next one :
When I try  to generate the PDF with the linux command, it shows the "access Denied" error in the PDF it outputs (as attached file):

sudo google-chrome-stable --no-sandbox --headless --disable-gpu --print-to-pdf http://localhost:52773/userPortal/_DeepSee.UserPortal.DashboardViewer.ze...$$$CM%20consumption.dashboard&Username=pdfOutput

I checked if the ZAUTHENTICATE.mac routine was called, and it is the case ( i put a global to see the time and the name of the "username").
It looks like, with a browser, there is a redirection after authentication that can cause the problem.

I checked the Audit database but I don't have any event for my call.
Does anyone have an idea , or have a better way to print a dashboard without a browser?  

Thank you in advance.
I wish you a good day.

Lucas Bourré

Discussion (4)1
Log in or sign up to continue

Hello Evgeny,
We tried to use the schedule part of DSW , which use a headless browser ( PhantomJS ).
I am doing the same job with my custom operation, but instead of printing the DeepSeeWeb page , I am printing a "delegated application" on Intersystems .
The problem should be arround the ZAUTHENTICATE.mac routine. Maybe the delegated application doesn't work for this sort of use, i should use a non authenticate application ? 
I'm going to give it a try