Thanks again, all working great.
Compuamerica C.A.
Original Message:
Sent: 07-22-2022 08:38
From: Stephane Pfefer
Subject: Print a PDF from a DSP to a Service
Hello Alejandro,
Yes we call the exec operation of our USP from a DSP.
In order to avoid timeouts from the browser, we register the print request into a table and we call the operation with /async switch.
The browser will check every 5 seconds for the completion of the print request and will request the file to be downloaded.
The postactivate operation looks like:
vFileName = "SomeFilename"
vFileNameAndPath = "CompletePath/SomeFilename"
webgen ,"%%vFileName%%%.html" ; Generates the Html file on server in CompletePath directory
; generate pdf from html
vRepScript = "PathForTheScript"
vLgCmde = "%%vRepScript%%%/picklist/picklist.sh %%vFileName %%param1"
activate/sync "cx0ossx".commandout(vLgCmde,vTraceWkhtmltopdf)
; Upload pdf
fileload/raw "%%vFileName%%%.html", vPDF
And the shell:
# Move to correct directory
cd CompletePath
# create pdf file.
wkhtmltopdf -O landscape --enable-local-file-access ${1}.html $1.pdf
I hope that it helps,
------------------------------
Stephane Pfefer
Application Specialist
Darling
Original Message:
Sent: 07-22-2022 08:08
From: Alejandro Blanco Uribe
Subject: Print a PDF from a DSP to a Service
Hello Stephane,
So if I understand yo correctly, you use USPs as a report where it print itself. So in theory I should be able to call from a DSP a USP that generates its own PDF?
And just to be sure, could you please show me an example of the shell script calling wkhtmltopdf? Or even the block of code from the PostActive trigger?
Thanks for the reply.
Regards.
------------------------------
Alejandro Blanco Uribe
Compuamerica C.A.
Original Message:
Sent: 07-22-2022 04:57
From: Stephane Pfefer
Subject: Print a PDF from a DSP to a Service
Hello Alejandro,
We use USPs for this kind of PDF creation. With USP, we get a better view of the generated html.
I think that DSPs might also work since wkhtmltopdf is able to process Javascript but I don't see the point. There is no interaction after Html generation, so static HTML is just fine.
In the PostActivate trigger of the USP, we call webgen to intercept the HTML.
Then we use an Operation defined in the signature with the 'COMMAND' operation in order to call a Shell script that will call wkhtmltopdf.
We use a lot these Shell scripts called by this operation and we don't get any trouble.
------------------------------
Stephane Pfefer
Application Specialist
Darling
Original Message:
Sent: 07-21-2022 09:58
From: Alejandro Blanco Uribe
Subject: Print a PDF from a DSP to a Service
Hi Stephane,
I think you're right on-topic, I'm curious about how you call-out the wkhtmltopdf from the web application, are you using DSPs?
I testes wkhtmltopdf with the CLI and works fine, my issue is when I try using the "spawn" from Uniface or when I use an OS Signature with the "command" operation.
Thanks and regards
------------------------------
Alejandro Blanco Uribe
Compuamerica C.A.
Original Message:
Sent: 07-15-2022 02:52
From: Stephane Pfefer
Subject: Print a PDF from a DSP to a Service
Sorry if I am a bit off-topic but that might give ideas to a few persons in order to create PDF files.
We are using Linux for Uniface Application servers. When we migrated from Uniface 9.6 Fat Client to a Uniface 10 Web applications, we got the issue with reports which were printed to the local PC printers. We did not manage to create correct Ghost files that would be handled by CUPS-PDF, especially since we need to be able to print Unicode characters (like Chinese).
We finally ended by replacing all reports by USPs. USPs create a HTML file that we save on the server instead of sending it back to the client. This HTML file is afterwards transformed into a PDF by tool wkhtmltopdf and the PDF is sent back to the client as a download. This works very well for us and this handles Unicode as well.
------------------------------
Stephane Pfefer
Information Technology Manager
It Services B.V.
Original Message:
Sent: 07-11-2022 04:27
From: Iain Sharp
Subject: Print a PDF from a DSP to a Service
When we tried printing from a service, we ran afoul of windows not having a full user session and therefore there being no printers 'installed' in the service environment. We were using crystal reports rather than uniface prints, so there may be some difference.
I am not sure if adding /su to your userver entry in urouter.asn (and potentially calling the DSP/service using a valid domain user credentials) will give you access to the printers, but this might be the problem.
Regards,
Iain
------------------------------
Iain Sharp
Head of Technical Services
Pci Systems Ltd
Sheffield GB
Original Message:
Sent: 07-11-2022 04:23
From: Jean-Marc Salis
Subject: Print a PDF from a DSP to a Service
Hi Alejandro.
As stated by others, you can use MFilemon with a GhostScript printer to "print" PDF.
It's still working, at least on Windows Server 2019 (haven't tested it on 2022).
I haven't tested it in a DSP situation, but it worth a shot I think.
You can find a retranscription of my discussion with @Gianni Sandigliano regarding installation and waiting for the file to be ready (with links to informations) here :
https://community.rocketsoftware.com/forums/forum-home/digestviewer/viewthread?MessageKey=efd8fa99-722e-465e-8e75-317dd8174e35&CommunityKey=edb92b7f-cb45-44f3-9782-c48a111007d6#bmefd8fa99-722e-465e-8e75-317dd8174e35
------------------------------
Jean-Marc Salis
Mp Services
Montauban Cedex FR
Original Message:
Sent: 07-07-2022 11:20
From: Alejandro Blanco Uribe
Subject: Print a PDF from a DSP to a Service
Hi Daniel,
I understand, I'll be looking into that. If you know of a free alternative please let me know.
Thanks and regards
------------------------------
Alejandro Blanco Uribe
Compuamerica C.A.
Original Message:
Sent: 07-07-2022 08:46
From: Daniel Iseli
Subject: Print a PDF from a DSP to a Service
Hello Alejandro,
Which edition of PDFCreator are you using? If I understand it correctly then you need at least the Server or Terminal Server edition to print from a Windows Service process (i.e. UServer). I have found this:
I hope this helps.
Regards
------------------------------
Daniel Iseli
Principal Technical Support Engineer
Uniface Services
Rocket Software, Switzerland
Original Message:
Sent: 07-06-2022 19:27
From: Alejandro Blanco Uribe
Subject: Print a PDF from a DSP to a Service
Hello,
I'm using PDFCreator to print automatically some reports I have in Uniface. Those reports are being activated with a Service.
So far so good, now I've tried to call that same service from a DSP and nothing happens.
I need some help figuring this out.
Regards
------------------------------
Alejandro Blanco Uribe
Compuamerica C.A.
------------------------------