on 12-12-2007 3:39 PM
Hi,
I've a model and this model, I show in pdf. I Know insert rows and columns and pdf document (PdfPtable, PdfPCell...),but I don't know insert a image in the pdf document. How can I do it?
Thanks
hi guillermo,
PdfPTable head = new PdfPTable(1);
head.getDefaultCell().setBorder(0);
Image image = Image.getInstance(logoUrl);
PdfPCell imageCell = new PdfPCell(image);
imageCell.setBorder(0);
imageCell.setHorizontalAlignment(PdfCell.ALIGN_RIGHT);
head.addCell(imageCell);
regards, jens
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Guillermo,
.
in your webdynpro application add all needed images to "src/mimes/Components/<component_name>".
try {
// determine the current portal and select the appropriate image
String logo = "xyz.gif";
String path =
WDURLGenerator.getAbsoluteWebResourceURL(
wdComponentAPI.getDeployableObjectPart(), logo);
} catch(WDURLException e1) {
}
hi guillermo,
than put your image in the dest-->images folder and use the following coding:
public static String getImageUrl(IPortalComponentRequest request, String imageName) {
StringBuffer buffer = new StringBuffer(1024);
HttpServletRequest httpRequest = request.getServletRequest();
String protocoll = (httpRequest.isSecure())? "https" : "http";
buffer.append(protocoll)
.append("://")
.append(httpRequest.getServerName())
.append(httpRequest.getServerPort())
.append(request.getWebResourcePath())
.append("/images/")
.append(imageName);
return buffer.toString();
}
regards, jens
Hi Guillermo,
the coding - I sent you - is from a project 2 years ago and currently runs productive. Therefore I can insure it works.
Why it is not working in your context, I can't tell you.
Find it out by debugging your app, check the image url by requesting the resource directly in the browser and so on...
or post the stacktrace or detailed error description. "It didn't finction" will not help to find out the reason.
regards, Jens
Hi Guillermo,
the coding - I sent you - is from a project 2 years ago and currently runs productive. Therefore I can insure it works.
Why it is not working in your context, I can't tell you.
Find it out by debugging your app, check the image url by requesting the resource directly in the browser and so on...
or post the stacktrace or detailed error description. "It didn't finction" will not help to find out the reason.
regards, Jens
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.