Java SWT Browser opens download dialog when viewing PDF on Linux
NickName:Firzen Ask DateTime:2013-11-26T23:14:30

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();
        browser.setUrl(path);
    }
}

But on Linux it only shows download dialog. It is very strange, because my default browser is Firefox and when i type

$ firefox blabla.pdf

it opens normal Firefox window with displayed PDF.

Is there any easy way to display PDF with SWT Browser on Windows and Linux?

Thanks in advance

Copyright Notice:Content Author:「Firzen」,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/20220910/java-swt-browser-opens-download-dialog-when-viewing-pdf-on-linux

More about “Java SWT Browser opens download dialog when viewing PDF on Linux” related questions

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

Instead of displaying pdf files in Red Hat Linux, the SWT browser opens a save prompt. Is there any way to handle this?

My application is based on eclipse 4.4.2 and has a preview pdf functionality which opens pdf files in a SWT browser. The pdf files open just fine in Windows in the SWT browser but in linux the save

Show Detail

PDF files download instead of viewing in browser tab

I'm developing an internal only application for a closed network using xampp on a Windows 7 PC and I have found that for some reason any PDF file that is over 15MB in size will be forced to download

Show Detail

force browser to download a file instead viewing it

On my web I want to have two buttons - first Download that should download a pdf to the user's computer and another View that opens pdf in a new tab. The thing is, I don't know how to make the Down...

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

SWT eclipse browser does not work on Linux

I have tried eclipse GIT sample to open SWT browser Ref : http://git.eclipse.org/c/platform/eclipse.platform.swt.git/tree/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet260.j...

Show Detail

Java SWT Print How to Print to File on Linux?

I am trying to print a simple report using the code below. On Windows, this code works fine when attempting to print to PDF generator driver (instead of a real printer). But, on my Linux box, when ...

Show Detail

how to handle open/save dialog in browser when download a pdf file in C#

hii,, I have a mail list where i can select many mails and download (with/without opening the mail). During the download process i update the mail status(download/open) and show the content in pdf...

Show Detail

Java SWT Dragging Dialog Causes Application To Crash

I have a dialog box that loads an image when a button is clicked. Essentially when the button is clicked it opens a larger version of the image displayed on they button. The dialog opens and displa...

Show Detail

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