Questions and discussion about using ProcessMaker: user interface, running cases & functionality
By heemalkumar
#795725
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.
User avatar
By amosbatto
#795734
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.
By heemalkumar
#795737
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?
User avatar
By amosbatto
#795749
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 12528 times
It appears in the upper right hand corner of the DynaForm:
PrintUpperCorner.png
PrintUpperCorner.png (12.51 KiB) Viewed 12528 times
If clicked, then it opens a print dialog box for your operating system:
PrintIconUpperRightCorner.png
PrintIconUpperRightCorner.png (28.78 KiB) Viewed 12526 times
But it creates a PDF file without formatting:
PDFGeneratedFromScreen.png
PDFGeneratedFromScreen.png (18.5 KiB) Viewed 12528 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/fire ... re-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.
User avatar
By amosbatto
#795762
We don't have a plugin to take screenshots in PM. Your best bet is to use html2canvas or a similar library.
By heemalkumar
#796172
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
(256.35 KiB) Downloaded 325 times
User avatar
By amosbatto
#798782
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/Proces ... ding_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.

Get an instant solution to move emails to MBOX for[…]

Most Demanding OST to PST Converter

The most demanding OST to PST Converter is TrijaT[…]

Betvisa clone scripts are pre-built software solut[…]

A Bet365 Clone Script is essentially a ready-made […]