How to print a content in a form using javascript:window.print()

0
Hi.. I am new here so please bare with me. Can any one please tell me how to print the content in a form using javascript:window.print() . In my case I have a generated PDF opened in a document viewer. I want add a print button so users can print the document. Can any one please explain in steps how to do this?  I don't want the download and print option. I have already used that method.   Sorry I am a novice.. Regards  
asked
3 answers
0

Hi Dilan, if the PDF is opened in the browser (ie Chrome) there is already a print button available. Otherwise I guess this goes outside of the scope of Mendix functionality.

answered
0

Hi Dilan,

I am not sure what document viewer you are using. Assuming it is a custom widget for mendix, your best bet is that it supports adding a print button. If that is not the case and what you are tying to achieve can be done with some html and javascript than you can use HTMLSnippet to inject these in a page https://appstore.home.mendix.com/link/app/56/

Hope this helps,

Andej

answered
0

Are you sure the document viewer you're referring to doesn't already have the print option available when the PDF is shown in the document viewer? As I recall, whenever you hover the PDF the print option (among others) should appear and be available.

Another option would be to enable the PDFjs library (separate option on the Document Viewer widget). I'm fairly certain this setting did show the options for printing the PDF. Do keep in mind that if you enable this option you can only show PDF files in the Document Viewer Widget.

answered