Read and respond to this message at: 
https://sourceforge.net/forum/message.php?msg_id=5323488
By: ascar2001

Hello,

I had the same issue so I created my own PdfView:
package export;

import java.net.URL;

import org.apache.log4j.Logger;
import org.displaytag.export.PdfView;

import com.lowagie.text.BadElementException;
import com.lowagie.text.Cell;
import com.lowagie.text.Image;

public class ImagePdfView extends PdfView {

        /* (non-Javadoc)
         * @see org.displaytag.export.PdfView#getCell(java.lang.String)
         * I had to make the getCell protected to be able to override it, it 
was that
or copy full class
         * if value of cell starts with image: the url behind it is taken to 
get the
image
         * for example:
         * 
                        <display:column title="Your title" media="pdf">
                                image:http://host:port/path/image.gif
                        </display:column>
         */
        @Override
        protected Cell getCell(String cellValue) throws BadElementException {
                if(cellValue != null && cellValue.trim().startsWith("image:")){
                        Cell cell;
                        try {
                                cellValue = 
cellValue.trim().substring("image:".length());
                                cell = new Cell(Image.getInstance(new 
URL(cellValue)));
                                return cell;
                        } catch (Exception e) {
                                Logger.getLogger(this.getClass()).error("error 
when getting content of cell
" + cellValue,e);
                        }
                }
                return super.getCell(cellValue);
        }
}

then in the displaytag.properties:
export.pdf.class=export.ImagePdfView

Hope that will help others...

Regards,

Carl

______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit: 
https://sourceforge.net/forum/unmonitor.php?forum_id=249318

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
displaytag-user mailing list
displaytag-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/displaytag-user

Reply via email to