Dynaform to PDF

Questions and discussion about using ProcessMaker: user interface, running cases & functionality

Moderator: amosbatto

heemalkumar
Posts: 14
Joined: Thu May 04, 2017 5:40 pm
Country: Fiji

Dynaform to PDF

Unread postby heemalkumar » Tue Sep 26, 2017 10:42 pm

Good Day All,
I am trying to figure out a way the form attached to the last Task prints to PDF by itself and gets saved somewhere.
Please advise how this could be done.

Many Thanks.

amosbatto
Posts: 5564
Joined: Mon Jun 22, 2009 10:28 am
Country: Bolivia
Location: La Paz

Re: Dynaform to PDF

Unread postby amosbatto » Wed Sep 27, 2017 4:19 pm

You need to create an Output Document with the variables used in your DynaForm in its template. Then, you can use a trigger to generate a PDF of the Output Document and then copy that PDF to a location. See example 3 in PMFGenerateOutputDocument().

Remember that if you fire a trigger immediately after a DynaForm, then the variables in that DynaForm have not yet been saved to the database, so you need to use PMFSendVariables() to save those variables (see the example). The other option is to fire the trigger before the next step in the task (or before assignment if the last step in the task), when the variables have been saved to the database.

If you don't want to use a trigger, then simply set the Output Document as a step in a task and let the user download the file and manually store the PDF file.
Amos B. Batto ♦ ProcessMaker Technical Documentation Writer & Forum Manager ♦ Cofounder of ILLA (http://www.illa-a.org)

heemalkumar
Posts: 14
Joined: Thu May 04, 2017 5:40 pm
Country: Fiji

Re: Dynaform to PDF

Unread postby heemalkumar » Wed Sep 27, 2017 5:44 pm

Thanks Amos.
I would like my Dynaform to print to PDF just the way the user sees it when they were actioning a task. Would that be possible?

amosbatto
Posts: 5564
Joined: Mon Jun 22, 2009 10:28 am
Country: Bolivia
Location: La Paz

Re: Dynaform to PDF

Unread postby amosbatto » Thu Sep 28, 2017 9:10 pm

ProcessMaker provides an option to show a print button on DynaForms, which will generate a PDF similar to an Output Document.
printFormProperty.png
printFormProperty.png (27.14 KiB) Viewed 242 times

It appears in the upper right hand corner of the DynaForm:
PrintUpperCorner.png
PrintUpperCorner.png (12.51 KiB) Viewed 242 times

If clicked, then it opens a print dialog box for your operating system:
PrintIconUpperRightCorner.png
PrintIconUpperRightCorner.png (28.78 KiB) Viewed 240 times

But it creates a PDF file without formatting:
PDFGeneratedFromScreen.png
PDFGeneratedFromScreen.png (18.5 KiB) Viewed 242 times


If you want to automatically open the print dialog box when the DynaForm is submitted, then add this JavaScript code to your DynaForm:

Code: Select all

var printed = false;
getFormById( $("form").prop("id") ).setOnSubmit( function() {
  if (printed == false) {
     $("a.print-button").click();
     printed = true;
     return false;
  }
});


The problem is if you want the PDF to have the same style as your DynaForm. You can use an outside library like html2canvas, that creates a screenshot based on the DOM. I haven't tried it, so I don't know if it will render all the CSS correctly. There are also many plugins to take screenshots of web browsers. For example: http://designwebkit.com/web-design/firefox-screenshot-capture-addons/
There is no way (that I know) to use JavaScript with these plugins to take a screenshot of your DynaForm, so you have to rely on the user to do it manually.
Amos B. Batto ♦ ProcessMaker Technical Documentation Writer & Forum Manager ♦ Cofounder of ILLA (http://www.illa-a.org)

heemalkumar
Posts: 14
Joined: Thu May 04, 2017 5:40 pm
Country: Fiji

Re: Dynaform to PDF

Unread postby heemalkumar » Thu Sep 28, 2017 11:25 pm

Hi There
Do you know if there is any Process Maker plugin which should do this task?

amosbatto
Posts: 5564
Joined: Mon Jun 22, 2009 10:28 am
Country: Bolivia
Location: La Paz

Re: Dynaform to PDF

Unread postby amosbatto » Fri Sep 29, 2017 8:40 pm

We don't have a plugin to take screenshots in PM. Your best bet is to use html2canvas or a similar library.
Amos B. Batto ♦ ProcessMaker Technical Documentation Writer & Forum Manager ♦ Cofounder of ILLA (http://www.illa-a.org)

heemalkumar
Posts: 14
Joined: Thu May 04, 2017 5:40 pm
Country: Fiji

Re: Dynaform to PDF

Unread postby heemalkumar » Wed Nov 15, 2017 10:35 pm

Hi Amos,
So I have an issue now. I have an image appearing on my Dynaform.
Image goes from task to task properly and appears. however, when I am trying to Print the Dynaform to PDF, the image disappears. I am using the print button on Process Maker.
But when I just do a Ctrl+P, then the image does show up.

Would you know why that happens.
Attached screenshot.
Attachments
PA Print Issue.docx
(256.35 KiB) Downloaded 2 times

amosbatto
Posts: 5564
Joined: Mon Jun 22, 2009 10:28 am
Country: Bolivia
Location: La Paz

Re: Dynaform to PDF

Unread postby amosbatto » Thu Nov 16, 2017 7:42 pm

Is your image a digital signature? If so, which digital signature (SigPlus, E-Lock or DocuSign)?
Amos B. Batto ♦ ProcessMaker Technical Documentation Writer & Forum Manager ♦ Cofounder of ILLA (http://www.illa-a.org)

heemalkumar
Posts: 14
Joined: Thu May 04, 2017 5:40 pm
Country: Fiji

Re: Dynaform to PDF

Unread postby heemalkumar » Mon Nov 20, 2017 6:16 pm

Hi Amos
Yes, It is Topaz systems Inc.

amosbatto
Posts: 5564
Joined: Mon Jun 22, 2009 10:28 am
Country: Bolivia
Location: La Paz

Re: Dynaform to PDF

Unread postby amosbatto » Mon Nov 20, 2017 7:53 pm

PM doesn't have an integration with Topaz Systems. Are you implementing this in a Panel control in your DynaForm?

You should contact Topaz Systems and ask them if there is a way to save their digital signature as a graphics file. If so, you can fire a trigger after the DynaForm which uses the PMFAddInputDocument() function to add the signature graphics file as an Input Document. If the graphics file is only saved on the local PC, then you will have to upload the file to the PM server. See:
http://wiki.processmaker.com/3.0/ProcessMaker_WSDL_Web_Services#Uploading_Files

Then, your next step in the task can be an Output Document which contains:
<img src="/path/to/signature/file.jpg">

If Topaz Systems doesn't provide a way to save the digital signature as a graphics file, then you will have to use a web browser screenshot plugin like FireShot.
Amos B. Batto ♦ ProcessMaker Technical Documentation Writer & Forum Manager ♦ Cofounder of ILLA (http://www.illa-a.org)


Return to “Using ProcessMaker 3”

Who is online

Users browsing this forum: No registered users and 2 guests