[Html2PdfConverter] HTML2pdf converter usage in service studio - How

Forge Component
(60)
Published on 17 May by Guilherme Pereira
60 votes
Published on 17 May by Guilherme Pereira

Folks, I have a very simple scenario.  I want to allow a user of an application built in service studio v11 to be able to press a button and download a pdf of the screen that is being displayed.

I thought that HTML2PDF might be able to assist me.  I went to forge installed it into my service studio personal environment and it shows as an application alongside the rest of my apps.  But, how do I use it?  There are virtually no clues as to how I incorporate it into one of my existing applications.  I am fairly bright, though getting on a bit.  I have Cobol, Fortran, MSDOS, php, HTML etc. and a multitude of other skills under my belt but I am jiggered if I can work out how to get anything to print either to a page or to a pdf within OutSystems 11.  Is it me or am I missing something here?

Could someone please explain how I use a component from the forge within Service Studio 11.

Yours frustrated.

Chris.


Hi Christopher,

Open that app you just installed and click on "Open In Browser" button. that will open in the browser the module that contains the full documentation of this component. Just follow the steps and let us know if after that you still need some help.

Regards,

Marcelo

Thank you Marcello, just a quick question.  I am assuming that the personal cloud environment is running on a Microsoft platform which is the recommended version to install.  Is this not done when I installed the HTML2pdf component from Forge?

Regards,

Chris.

Marcelo Ferreira wrote:

Hi Christopher,

Open that app you just installed and click on "Open In Browser" button. that will open in the browser the module that contains the full documentation of this component. Just follow the steps and let us know if after that you still need some help.

Regards,

Marcelo

Marcelo,

This is the first problem.  It states "the most recommended version is the MinGW version under 'Bleeding edge'"  So, I download that and it then says "Use a compression software to extract the binaries"  BUT the file is an .exe file that wants to run and install an application...  Not a compressed binaries file.

So, which binary file should I be downloading?   I have downloaded the stable version for 64 bit and in that there are 4 files in the bin directory.  So which one has to be uploaded to the server?   This should all be in the instructions!



I am assuming that I have added the correct ones as the Green tick box has appeared.  What about the .dll file and the .a file.  Are they supposed to be uploaded as well?  Again, should all be in the instructions.

Your assistance would be greatly appreciated.

Regards,

Chris.


I have added the additional .dll and .a binaries to the "Additional Libraries" section and going to the pdf page, entering a url into the box and generate pdf actually works and downloads a pdf in the right format to my machine. 

So, the next question is going to be: How do I use this in my application.  Are there any instructions on how to include it into one's personal application?  Or do I have to take the existing demonstration to pieces in order to make it work.  Oh for the days of good instruction manual!!!

Regards,

Chris.

Hi Christopher

You can open an exe file as archive using 7-Zip. And extract the binaries. But from your image looks like you already did that. But I prefer use stable versions instead of bleeding edge. And yes windows 64 is the correct version.

After inserting the binaries on the menu you can select the pdf option and test if everything is working fine.

To know how to use you need to go to that same page which is on the module and check this page HtmlToPdfConverter > HowToPDF to understand how to use it.

Regards,

Marcelo


Marcelo Ferreira wrote:


To know how to use you need to go to that same page which is on the module and check this page HtmlToPdfConverter > HowToPDF to understand how to use it.


Thank you but before I get that far how do I get these modules into my application?  I can open it as a separate application within my development environment and yes it works.  I can put a url into the input field and click create pdf and and "Example.pdf" downloads to my desktop.  I am again assuming that I have to make set the module to public and then "Manage Dependencies" to be able to see it but again where are the instructions on how to do this?  Or are there no instructions and developers just know how to do this?

Get sunny Sunday we are having!!!

Regards,

Chris.  In the UK.


Hi Chris,

Yes if you follow the basic courses you will learn how to do it. The actions that need to be public already are. In your module you just need to "Manage Dependicies" select the module of this component and add these actions and use them.

Regards,

Marcelo

Dear Marcelo,

I have done the courses and built the example application.  But nowhere in there does it show how to add an application from the forge or how to add a different theme to one's own application.  I have now managed to do that by transferring the modules from the HTML2PDF application into my application. More by trial and error than by anything else.  Not something that a raw newcomer would be able to do.  All I am saying is that for a beginner with Outsystems it is not very clear.  I am sure that others are in the same situation.  It would be great to have a help page that shows EXACTLY how to add items from the forge into your own apps.  

As I have said I have now managed to get this to work.  It works well and has solved a lot of issues that I had with printing etc.  I have even added a new UI flow with a basic theme to allow me to create a printable / pdf page that does not contain too much CSS.  i.e. a basic theme that prints easily.  Again, I am sure that this would be very useful to the average user of OutSystems 11.  Great product but more difficult to use than should be.


Regards,


Chris.

P.S.  Not sure which of our conversations to mark as the "Solution"!

Hi Chris,

Check if this lesson helps you.

Regards,

Marcelo

Thank you Marcelo, yes that helped a lot.  I had not done the 2hr lesson.  I did the full 24hr expert one!!

Now another issue.  I wish to produce a Landscape pdf.  I have tried adding this:

"-O, --orientation <Landscape>" 

in the "OtherArgs" box of the GeneratePDF action but get an exception every time.

As ever your help is appreciated.

Regards, Chris.

HI Christoper,


I've released a new version 1.1.17 that now includes the sample app (available on the try now) as the component demo that you can download to check the usage. Hopefully this will help other new members facing the same challenges you did.


Regarding the last exception do you mind sharing a screenshot or the actual module so we can try and see how you're using the orientation in other args?


Cheers,

Guilherme

Solution

Guilherme Pereira wrote:

Regarding the last exception do you mind sharing a screenshot or the actual module so we can try and see how you're using the orientation in other args?


I have sorted the exception out.  As you can see I had added the Argument as above.  But it only works if you add it as:

"--orientation Landscape"

I have not been able to find any information in the help file to show that this was the way that it should be added to the argument list.

Regards,

Chris.

P.S.  I now have it working well and it is doing everything that I need.

Solution