This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Dec 19, 2012, 7:36 AM
21 Posts

iTextPDF insert image to PDF

  • Category: APIs
  • Platform: All
  • Release: 8.5.2
  • Role:
  • Tags: itext,itextpdf,api,pdf
  • Replies: 4
I use iTextPDF to generate PDF file from xpages document
 
I do some search from google and found this script from a blog.
It should insert an image to a PDF file, but it seems like not working
 
============================================================================================
 
var imageString = "http://" + facesContext.getExternalContext().getRequest().getServerName()+ "/" +  db.getFilePath() + "/getImageURLView/A795D3AEB37B1D2848257ACD001688E2/$File/YTL_Logo2.gif";

var image:com.itextpdf.text.Image = new com.itextpdf.text.Image.getInstance(imageString);
 
============================================================================================
 
 
Could you guys tell me what is wrong with the script, TQ. 
Dec 19, 2012, 3:20 PM
366 Posts
Re: iTextPDF insert image to PDF
 Did you "print" the string to verify that the produced string is correct?
 
If you put the produced string URL into a browser does it find the graphic? 
 
The code looks ok, except you can use the session and database global SSJS variables instead of having to invoke facesContext. 
 
 
Dec 19, 2012, 11:53 PM
3 Posts
Re: iTextPDF insert image to PDF
If this is running on a server, you need to make sure your server can do a DNS-lookup to find the url.
Print the url to the console, and do a check on the server to see if you can find it (using IE on Windows, or wget on Linux)
Dec 20, 2012, 12:49 AM
21 Posts
Re: iTextPDF insert image to PDF
 Ok, thanks u guys...
I will test it out again and see what will happened.. 
Nov 7, 2013, 12:17 PM
41 Posts
iText insert image to pdf header and footer

Hi,

I am also using same but get it error .It is not working ..


This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal