Hello Ajay!
On Wednesday, November 14, 2012 at 2:52:33 PM UTC+2, singh ajay wrote:
-- you need to do following things.
1. Create servlet (on server side) which will convert pdf to image
2. in gwt show image instead pdf
Please take a look at screen shot in the attachment, there is pdf viewer developed on gwt.
if ("application/force-download".equals(fileType) ||"application/pdf".equals(fileType) ){
response.setContentType("image/png");
try{
RandomAccessFile raf = new RandomAccessFile(file, "r");
FileChannel channel = raf.getChannel();
ByteBuffer buf = channel.map(FileChannel.MapMode.READ_ONLY, 0, channel.size());
PDFFile pdffile = new PDFFile(buf);
if (pdffile.getNumPages() < pageNumber){
pageNumber = pdffile.getNumPages();
}
PDFPage page = pdffile.getPage(pageNumber);
BufferedImage img=null;
int w = (int) page.getBBox().getWidth();
int h = (int) page.getBBox().getHeight();
Rectangle rect = new Rectangle(0, 0, w, h);
int rotation = page.getRotation();
Rectangle rect1 = rect;
if (rotation == 180) {
rect1 = new Rectangle(0, 0, rect.height, rect.width);
}
img = (BufferedImage) page.getImage( (int)(w+w*coef), (int)(h+h*coef),rect1,null,true,true);
ImageIO.write(createResizedCopy(img, (int)(w+w*coef), (int)(h+h*coef),fileName,rotate,isSmall,coef), imageOutput, response.getOutputStream());
Here is code example
On Wednesday, November 14, 2012 at 2:52:33 PM UTC+2, singh ajay wrote:
Hi Folk,can any one help me out with my problem,I am generating PDF file using JRXML using Java JASPEREXPORTMANAGER.but i don't know how to view pdf in gwt UI.any frame or special container require.Do let me know.Ragards,Ajay Singh, Mumbai, India
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:
Post a Comment