RaymondJVR
Nintex Employee
Nintex Employee

Re: How to Print a form using K2 Control Button?

Hi Sharpharp1


 


If you use the save to pdf control I am sure that it would achieve what you would like the outcome to be.


What the Pdf control does is, it takes a snapshot of the current view or form - So if you have lets say a view that the student has to fill in his name and surname and click save when he/she is done filling in the view, once the save button is clicked the save to pdf control will then execute with the default save to smartobject rule. The save to smartobject rule saves the record to SQL into a smartobject and the save to pdf takes a snapshot of the view with all the filled in content. you can then open the pdf and print it if you want as you will still have the pdf on record and the input of the user in a smartobject as input, so basically the view and its content will then be saved twice - first in a smartobject that only saves it as a record with all the filled in content and secondly as a pdf wich would look exactly like the view look when the student clicked the save button.


 


I made a quick test project, These were my steps:


1.open K2 designer


2.create a smartobject and add the field the student has to fill in


3.generate a item view from the smartobject


4.in your breadcrumb bar on the left hand side navigate to system>controls>save as pdf>generate a list view from the PDF File


5.now go open the item view in edit mode and drag a Save to PDF control into the view


6. edit the save buttons rule to look like this


 


    When Save Button is clicked


    then complete the following one after another


    then execute the Save method (Configure)


    then execute Save As PDF control's Save PDF method (Configure)


    then open PDF File List View - (When Save Button Is Clicked) as a subview (Configure)


 


Configure the above ( then execute the Save method (Configure)) rule as follows and leave the other two configure options to default:


546i7469A0E4E25A5EF9.png


7.Now save the view and run it


The view will popup, after the view is filled in and the save button is clicked the subview will popup with the pdf contaned in it, click on the pdf to open it and to be able to print it


 

0 Kudos
Reply
Sharpharp1
Apprentice

Re: How to Print a form using K2 Control Button?

Thanks Raymond for taking the time to explain it in laymans terms, I have had a quick go.

 

Just wanted to ask how you only display one PDF in the List View. In my List view there are several PDFs in there from previous attempts where i clicked Save. How can i ensure that only the current PDF I just generated by filling the form in is displayed in the list view?

 

Also, is there any settings on the server to clear out the PDFs as soon after it's been printed or displayed? Otherwise our server will become full rather quickly.

 

It mentions this in the PDF Control documentation:

12. When using the default Out of the Box PDFFile SmartObject to store the PDF file, it is important to clean up unused PDF

files on a regular basis to ensure that performance issues are not encountered when having to load PDF files. PDF files that

are only required for the duration of the process can be subsequently removed for example

 

How do I go about doing this? It says that you should do this, but not how.

 

 

0 Kudos
Reply
RaymondJVR
Nintex Employee
Nintex Employee

Re: How to Print a form using K2 Control Button?

Hi


 


When all the items are deleted this time and everytime when the save button is clicked, only one pdf item would be present thereafter you can then ensure that you delete the pdf before colsing the subview.


 


There are multiple ways of deleting the records manually one by one but i am unaware of any way to delete all or even multiple records from a list view - this is not possible as far as i know.


 


I would suggest that you use the delete button supplied in the list view to delete the records when finished with them, you can use a smartobject method to do the same thing or even a advanced condition

0 Kudos
Reply
Sharpharp1
Apprentice

Re: How to Print a form using K2 Control Button?

Hi Raymond,

 

I have deleted the records using the Delete Button, and entered a new record (record 1). It displays in the List View. I then entered another record (record 2), but it also displays in the List view. So now I have 2 records, I only want to display the current one...

 

In terms of deleting records, is the manual way the only way to do this?

I will be having potentially 1000+ users using this daily, I can't realistically delete the records manually each day.

 

Any ideas if its possible to get a workflow to run a delete method on the List each every hour, pull out the IDs and delete all and reset ID back to Zero?

0 Kudos
Reply
RaymondJVR
Nintex Employee
Nintex Employee

Re: How to Print a form using K2 Control Button?

Hi Sharpharp1


 


I have created something that would definitly be of use to you in regards to always having only the one pdf record in the list view that was created.


 


After you have filled in the form and clicked submit/save then the pdf will be created to the list view which pop's up as a subview.


 


You can set the pdf to be deleted once the user clicks on the link to open it, so it would open the pdf and remove it from the list and the smartobject at the same time. I have attached my kspx project for you to have a look at, please have a look at it and revert back to me.


 


In the package note that when the form is filled in and submitted a subview popup is displayed containing the pdf's. when you click on the pdf to view it the pdf is deleted from the pdf smartobject and the list view while the pdf is opened from where you can then save the pdf.


 


Kind Regards


Raymond

0 Kudos
Reply
daerne
Novice

Re: How to Print a form using K2 Control Button?

Hey all,

 

Thought I'd add this to the thread.  I was able to send a call to the print function via an Expression.  I threw down a hyperlink control and added an expression to it to call javascript for printing.  If you wanted a link for users to click on, they can use this...I haven't been able to add it to a button or image click.

 

724i39D242D44A4D973C.png

Reply
K2Expert1
Novice

Re: How to Print a form using K2 Control Button?

Do we have any feature or rule to download automatically withought calling subview list ? I need to generate pdf and download automatic .

0 Kudos
Reply
Vishesh
Novice

Re: How to Print a form using K2 Control Button?

Hi,

 

Option 1) As one of the member mentioned that you can do JavaScript to populate Windows Standard Print option. I have implementated this in oun eof our solution.

 

Option 2) You can use SAVE As PDF option. I have also implementated this in our one of the form, but here is the trick.. I was also worried about to fill the space on the server, so I tried to retive file and then delete it from the SmartObject as you already have file in your file attachment. By doing this you will not be worried about running out of memory issue.

 

 

 

0 Kudos
Reply
ohm
Novice

Re: How to Print a form using K2 Control Button?

 
0 Kudos
Reply
K2Expert1
Novice

Re: How to Print a form using K2 Control Button?

Hi Vishesh,

You r right I had implemented by that way only . you also can do that.

Regards,

Arvind kumar
0 Kudos
Reply