[PDF Generator Mobile] Any demo or guidance on PDF Generator Mobile
Forge component by Reyco Seguma
Application Type
Mobile

Hi all, 


I wish to create a custom PDF through mobile devices locally but I'm having issues with setting the page layout. Most of the tools that I've found on Forge is not supporting the specific layout that I want. For this Forge, is there any demo that I can follow? Because we have the CreatePDF action that we can customize the PDF layout but how to insert the data into the PDF created from the action? We do have the textAppendData action as well for us to insert the text that we want. Another is that the PDFGetData. Based on my understanding, the steps needed to be taken are CreatePDF, textAppendData, PDFGetData, and convert the Output(text) to base64 to Binary for download? Correct me if I'm wrong here. 


Thanks,

Kenny

Solution

Hi Kenny,

Here's the flow for creating PDF.

Creating PDF
1. Add the Javacript library
- make sure you added this libraries on the block or screen you are using it to.


2. Initialize and set content for the PDF

3. Render the PDF (This generates the PDF)

4. Save the PDF on local device


Thank you

Reyco

Hi Reyco,


Thanks a lot! This is what I'm looking for. It is working as intended! Just want to add on, I tried to upload the image (converted from binary to base64 as required) in the imageAppendData client action and it doesn't work. Any advice on this?

Regards,

Kenny

Hi Kenny,

Make sure your Base64 data starts with something like this.

data:image/png;base64,(YourBase64 data here)

Example:

data:image/png;base64,iVBO832usadasd9asdasd9asd9as8das9dasdshjhas9dashk3jhkjsahd9asdhas

Thanks

Hi Reyco,

I did what you said in the previous reply,

I assigned another string in front of the output from converting binary to base64, but it seems like it still doesn't work. The image I've uploaded to the database previously is in JPG format. I've also tried changing the png to jpg to test it out but still doesn't work. Do enlighten me if I missed something around here. Thanks.

Regards,

Kenny

Try this..

data:image/jpeg;base64,iVBORw0KGgoA

just google the right format for viewing jpg, png etc.
Here's some reference
https://stackoverflow.com/questions/8499633/how-to-display-base64-images-in-html

Here's some sample of the converted Jpeg data and its usage.
use the data url format.

Make sure you converted the data correctly.
The forge component have BinaryToBase64 converter you can use it.

Thanks

Thanks, it seems like I need to convert the binary data from jpg to png to display it (Tried BinaryToBase64, and changing to jpeg doesn't work for me). Will do more test regarding this.


Regards,

Kenny 

Hi Yung Shin,

I think that might be the solution. Just convert everything to PNG to avoid anymore error.
I haven't upgraded the component yet. I might add this on the next version.

Thanks

Hi Kenny,

I have never used this component, but have you tried the demo on the forge component page?

Hi Filipe,


Thanks for informing regarding the demo, was never aware of the existence of that feature till now. I'll update with you again once I've tried out the Forge demo. Thanks again!


Regards,

Kenny

Solution

Hi Kenny,

Here's the flow for creating PDF.

Creating PDF
1. Add the Javacript library
- make sure you added this libraries on the block or screen you are using it to.


2. Initialize and set content for the PDF

3. Render the PDF (This generates the PDF)

4. Save the PDF on local device


Thank you

Reyco

Hi Reyco,


Thanks a lot! This is what I'm looking for. It is working as intended! Just want to add on, I tried to upload the image (converted from binary to base64 as required) in the imageAppendData client action and it doesn't work. Any advice on this?

Regards,

Kenny

Hi Kenny,

Make sure your Base64 data starts with something like this.

data:image/png;base64,(YourBase64 data here)

Example:

data:image/png;base64,iVBO832usadasd9asdasd9asd9as8das9dasdshjhas9dashk3jhkjsahd9asdhas

Thanks

Hi Reyco,

I did what you said in the previous reply,

I assigned another string in front of the output from converting binary to base64, but it seems like it still doesn't work. The image I've uploaded to the database previously is in JPG format. I've also tried changing the png to jpg to test it out but still doesn't work. Do enlighten me if I missed something around here. Thanks.

Regards,

Kenny

Try this..

data:image/jpeg;base64,iVBORw0KGgoA

just google the right format for viewing jpg, png etc.
Here's some reference
https://stackoverflow.com/questions/8499633/how-to-display-base64-images-in-html

Here's some sample of the converted Jpeg data and its usage.
use the data url format.

Make sure you converted the data correctly.
The forge component have BinaryToBase64 converter you can use it.

Thanks

Thanks, it seems like I need to convert the binary data from jpg to png to display it (Tried BinaryToBase64, and changing to jpeg doesn't work for me). Will do more test regarding this.


Regards,

Kenny 

Hi Yung Shin,

I think that might be the solution. Just convert everything to PNG to avoid anymore error.
I haven't upgraded the component yet. I might add this on the next version.

Thanks

Hi Kenny,

Here's the flow for modifying PDF.

Modifying PDF

1. Add the Javacript library

- make sure you added this libraries on the block or screen you are using it to.


2. Initialize and Set Content

3. Modify PDF

4. Save PDF


Thank you

Reyco

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