swt browser diplays pdf in new window
NickName:Stefano Franchini Ask DateTime:2015-06-05T16:35:34

swt browser diplays pdf in new window

I'm experiencing a strange issue with the SWT browser widget. I developed a multipage application using the "transition composite" widget from opal widgets. In my last window I need to display a pdf. I've been looking for free open source solutions on the web, and the only one I could fine was IcePdf but the renderization of the page was not great. Then I found out I could use the browser widget to diplay a pdf. I created a new project with the following code :

    shell = new Shell();
    shell.setSize(l, h);

    Browser browser = new Browser(shell, SWT.NONE);
    browser.setBounds(xb, yb, lb, hb);
    browser.setUrl("file://" + pdfPath);

and it worked great. But then if I run the same code in my actual application, it opens the pdf into adobe reader and not into the application itself.

Has anybody else noticed that issue before? And if yes how can I solve it?

Thanks in advice, Stefano Franchini

Copyright Notice:Content Author:「Stefano Franchini」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/30661956/swt-browser-diplays-pdf-in-new-window

Answers
flavio.donze 2015-06-05T08:57:33

I think there is an internet explorer or adobe reader setting which needs to be changed.\n\nThis might help:\n\nIf you want the browser to open PDF files in a separate Acrobat window, configure the browser to use Acrobat or Adobe Reader as a helper application. Then, when you select a PDF file in Internet Explorer, the browser will open the PDF file in an Acrobat window instead of the browser window.\n\nTo configure the browser to use Acrobat or Adobe Reader to open PDF files:\n\n\nQuit Internet Explorer.\nStart Acrobat or Adobe Reader.\nChoose \"Edit\" > \"Preferences.\"\nSelect Internet in the list on the left.\nDeselect \"Display PDF\" in Browser, and click \"OK.\"\nRestart Internet Explorer.\n\n\nNote: The next time you select a link to a PDF file, the browser may prompt you to open or save the file. If you choose to open the file, the browser opens the file in the helper application that you specified. If you choose to save the file, the browser downloads the file to the hard disk.\n\nhttps://helpdesk.egnyte.com/hc/en-us/articles/201637224-How-Do-I-Open-PDF-Files-in-Adobe-and-Not-Internet-Explorer- ",


More about “swt browser diplays pdf in new window” related questions

swt browser diplays pdf in new window

I'm experiencing a strange issue with the SWT browser widget. I developed a multipage application using the "transition composite" widget from opal widgets. In my last window I need to display a p...

Show Detail

How to view PDF data bytes using SWT Browser

I have a function that returns a byte array of PDF data, and I want to view it in a Java SWT application. I do not want to use any jars such as Icepdf, jpedal, etc. Just SWT and Java. One obvious

Show Detail

PDF is not shown in java swt browser

I'm using java swt browser for java single page application. In the browser the webpages is showing the PDF successfully, but in the swt browser PDFs are not shown properly. I'm using <object/&g...

Show Detail

How to open pdf files in swt Browser composite

I have created a browser using swt Browser, but if I set a URL that is a pdf file it only display a black X in the top left corner. Is there a solution to make the browser display the pdf?

Show Detail

open external browser window from swt browser

I'm using swt browser in my Java EE application. On many points of the application, when you click on a link, i do javascript window.open and it is fine, it opens a new window, which is also a head...

Show Detail

Java SWT Browser opens download dialog when viewing PDF on Linux

I have following code which works well on Windows: private void showSelectedPdf() { File selected = getSelectedPdf(); if(selected != null) { String path = selected.getAbsolutePath...

Show Detail

SWT Browser seems to stick around even after I dispose it

I have an SWT application and I use canvas to show images, video, and PDF files. The user can drag any media type onto a canvas. I use a browser object for showing the PDF only. When I'm done showi...

Show Detail

Linux SWT Browser JavaScript.window.close() method not working

I have implemented sample swt browser application, it's working in windows operating system, but the same code I have tested in linux operating system, browser is opening but window.close() functio...

Show Detail

Open a PDF in a new browser window with ColdFusion cfpdfform

I'm using ColdFusion 8 to and the object to create an xml document and then write the data to fields in an existing PDF file on our intranet. The problem is that I need the PDF to open in a new b...

Show Detail

Open PDF in new browser full window

How do I open PDF document in new browser window? The window should be full and withouth menu. Just a PDF document in a clean full window with native Javascript or jQuery.

Show Detail