generatePDF not working if have background image

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

edwinayin@qq.com
Ebase User
Posts: 24
Joined: Fri Nov 04, 2016 7:41 pm

generatePDF not working if have background image

#1

Postby edwinayin@qq.com » Fri Mar 24, 2017 3:57 pm

Hello everyone,

I am trying to generate a pdf file with the background images using "generatePdf()".

On the page, if I print by using browser's default print, I can check "background graphics" option to be able to see the background image.

But through "generatePdf()", I haven't found a way of getting the background images showing.

Any suggestions?

Many thanks.

regards,
Edwina
0 x

Steve
Moderator
Moderator
Posts: 414
Joined: Fri Sep 07, 2007 3:44 pm
Location: Sandy, UK
Contact:

#2

Postby Steve » Fri Mar 24, 2017 4:32 pm

Hi Edwina,

Do you go through IIS to access Ebase?

Also how are you setting the background image on the PDF?

Kind regards

Steve
0 x

edwinayin@qq.com
Ebase User
Posts: 24
Joined: Fri Nov 04, 2016 7:41 pm

#3

Postby edwinayin@qq.com » Fri Mar 24, 2017 4:41 pm

Hello Steve,

I am not going through IIS to access Ebase.

I am using

Code: Select all

ctrl.setStyle("background-image:url();") 
to set the background image on my before page script.

Also tried

Code: Select all

 ctrl.setCssClass()
., and set the image in the class.

Both way, background images will show on the html page, but not displaying when I use "generatePdf()"

thanks,
Edwina
0 x

Steve
Moderator
Moderator
Posts: 414
Joined: Fri Sep 07, 2007 3:44 pm
Location: Sandy, UK
Contact:

#4

Postby Steve » Fri Mar 24, 2017 5:38 pm

Hi Edwina,

I have just test this by setting the background image URL from the workspace and relative to the server. Both work.

Could you export your form and the image you are setting as the background. I will test this for you. Please send to support@ebasetech.com

I have seen problems with the format of the image and had to recreate the image using an imaging tool before the image can be displayed in the PDF.

Steve
0 x

edwinayin@qq.com
Ebase User
Posts: 24
Joined: Fri Nov 04, 2016 7:41 pm

#5

Postby edwinayin@qq.com » Tue Mar 28, 2017 1:27 pm

Thanks to Steve my issue is solved, just want to write here in case someone else might have the same issue in the future.

I was using base 64 encoding to set my background image.

Code: Select all

background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAAG0lEQVQYV2NkYGD4z8DAwMgABXAGNgGwSgwVAFbmAgXQdISfAAAAAElFTkSuQmCC);
After I changed it to use a physical image. It worked.

I was also trying to overlay two background images.

This only works when I set one background by using

Code: Select all

ctrl.setStyle("background-image:url(...)");
and the other using

Code: Select all

ctrl.setCssClass("ImageC");
and set the second image url in the "ImageC" class.

Hope this helps.

Edwina
0 x


Who is online

Users browsing this forum: No registered users and 140 guests