Skip to main content
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.
------------------------------
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.
------------------------------
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
------------------------------
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
------------------------------
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.
------------------------------
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.
------------------------------
Hi Alejandro,

I seem to remember that some customers us a print monitor tool called Mfilemon. See also this old post in the forum:
I did not test this myself though.

I hope this helps.

Regards

------------------------------
Daniel Iseli
Principal Technical Support Engineer
Uniface Services
Rocket Software, Switzerland
------------------------------
Hi Alejandro,

I seem to remember that some customers us a print monitor tool called Mfilemon. See also this old post in the forum:
I did not test this myself though.

I hope this helps.

Regards

------------------------------
Daniel Iseli
Principal Technical Support Engineer
Uniface Services
Rocket Software, Switzerland
------------------------------
Hi Daniel,

I remember @Gianni Sandigliano explaining me how to print a form to pdf with Mfilemon and GS (this I can do it with the PDFCreator), but the question is if it'll work when I call the SVC from the DSP to print the report.

Also is it possible to use PDFCreator printer with the Mfilemon?

Another thing that I notice is that when I make the call to the service from the DSP is that Uniface doesn't find the printer and I was wondering if that got to do with the logical printer registry being in HKEY_CURRENT_USER instead of HKEY_LOCAL_MACHINE

Thanks for the reply.​​

Regards​

------------------------------
Alejandro Blanco Uribe
Compuamerica C.A.
------------------------------
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.
------------------------------
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
------------------------------
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
------------------------------
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
------------------------------
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
------------------------------

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.
------------------------------

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.
------------------------------
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.
------------------------------
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.
------------------------------

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
------------------------------


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
------------------------------

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.
------------------------------
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.
------------------------------

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
------------------------------

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
------------------------------
Hi Stephane,

Thanks again, all working great.

------------------------------
Alejandro Blanco Uribe
Compuamerica C.A.
------------------------------