How can i print automatically an inovice?
Question

I want make a inovice for a order. And i want a button to print automatically or direct the inovice. 

For format A6

What is the best option to do that?

Hi K A

   You can use the forge component https://www.outsystems.com/forge/component-overview/5641/ultimate-pdf 

and you can try this link solution https://www.outsystems.com/forums/discussion/74665/customize-paper-size-of-pdfultimate-pdf/


Hope this will help you

Regards

Ashutosh Soni

I did use ultimate, but I don't want to create a pdf then printing.  I want to create a button that immediately prints the PDF.

Hello,

You can use JavaScript for that on a button  action flow

code -

 window.print()

I hope this helps 

Thanks

Thank for answer.

But i dont want print the window. I want button that can direct print the inovice.


Thanks 

Check this if it help

Or please share oml or picture of what you want to achive from what you have.

Hi, K A 

Use this forge component 

https://www.outsystems.com/forge/component-overview/9761/reactive-print-pdf-button

It provide a button to print your content anything you want just provide Id of the content .

It take two input parameter  

        1 =  ContainerId

        2 = FileName

For containerId you provide container name + .Id

Ex: if my container name is MyContainer   

  then,            ContainerId =  MyContainer.Id



above image    ContainerId =Invoice.Id

It print only you want to need not anything else on entire screen.

Attach demo URL please check it :

https://personal-ddjq2r3a.outsystemscloud.com/Print/Invoice?_ts=637923525467539929


and also attach .oml file:

Invoice_Print.oml

Thank you for your answer. 

only one thing i miss, is : when i click on print button, i dont what get i page for printing. i want when i click on print button, the inovice is printed immediately.



I want make it automatic, because it is a cash register system. Is there any solution?


I don't want to get this page, if I can do it in the backend. I don't want the user to be able to do this.

Hello

You need to make some changes in your JS widget,

Delete the Existing JavaScript Code and replace by this JavaScript code attached below in blue.


Code Snipet - 

var element = document.getElementById($parameters.ContainerId);var opt = {    image: { type: 'png', quality: 1 },    margin: $parameters.Margin,    filename: $parameters.Filename};html2pdf().set(opt).from(element).toContainer().save()        .then(function(){          var doc = $('.html2pdf__container');          doc.find('.show-on-export').show(); // show content hide by CSS.        })


You need to make these changes in ReactivePrintPDFButton Application Forge that you have downloaded

the just publish and refresh the dependencies in your consumer module.

I hope this helps

Thanks

I can't do what i want to do with javascript i guess



Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.