Code: Select all
//FPL output page
outputpage PAGE_1;
Code: Select all
//JavaScript generate PDF
var opts = new PdfOptions();
opts.pages = [pages.PAGE_1;
form.generatePdf(opts);
This delay is caused when the Ebase server sits behind a firewall or IIS server and the Ebase server cannot resolve the domain name of the CALLING url. The Ebase Server generates the PDF content. If the PDF contains relative images, it uses the calling url's IP Address/domain name to create a URL to the file it is looking for. This is also true for stylesheets from the presentation template (This is a bug, at the time of writing, version 4.4.3).
e.g
I have a form MY_PDF. On this form it has a button to generate a PDF.
To load the form:
http://www.mytestwebsite.com/ufs/ufsmain?formId=MY_PDF
Click on the Button to generate the PDF (It does not matter if using FPL or JavaScript as this goes through the same PDF generation code).
On the PDF I have an image configured as /images/my_image.gif
The PDF generation code does not know the location of /images/my_image.gif, so it creates a full URL using the calling URL, e.g:
http://www.mytestwebsite.com/ufs/images/my_image.gif
then the Ebase server tries to resolve the full URL. This is where the delay can occur, as if the Ebase Server cannot resolve the www.mytestwebsite.com (Back to the firewall or IIS Server), this can take a few seconds to timeout. It will do this for every image on the PDF. At the time of writing this (Version 4.4.3), the pdf generator also does the same lookup for an internal stylesheet servlet, this is a bug.
To fix the problem:
The Ebase server must be able to resolve the domain name. If there is no DNS on the Ebase Server, or it cannot resolve the address:
It is easiest to add the firewall or IIS server IP address to the hosts file so that it can resolve the domain name to an IP.
In Windows the file is located in:
Windows 95/98/Me c:\windows\hosts
Windows NT/2000/XP Pro c:\winnt\system32\drivers\etc\hosts
Windows XP Home c:\windows\system32\drivers\etc\hosts
In Linux:
/etc/hosts
Add the line to the hosts file:
#<ip_address_of_your_firewall_or_iis_server> <external_domainname>
#e.g
222.11.2.11 www.mytestwebsite.com
The Ebase server should now be able to resolve the URL properly. It is like a big loopback as the IIS server or firewall will push it back to the Ebase Server to fetch the image or styles.