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