掲示板

PDF display..

thumbnail
11年前 に Muzakir Khan によって更新されました。

PDF display..

Regular Member 投稿: 112 参加年月日: 12/03/15 最新の投稿
Hi!..
My requirement is to open a pdf using iframe in a portlet. I have a simple Java class that successfully opens a pdf file, but it opens in new window..
My question is, how to integrate this concept in liferay such that the pdf should open in iframe. My java class code is as below.


package com.pdfreader;
import java.awt.Desktop;
import java.io.File;

//Cross platform solution to view a PDF file
public class AnyPlatformAppPDF {

public static void main(String[] args) {

try {

File pdfFile = new File("/home/sourceone/Documents/imppdf/TagLibraries.pdf");
if (pdfFile.exists()) {

if (Desktop.isDesktopSupported()) {
Desktop.getDesktop().open(pdfFile);
} else {
System.out.println("Awt Desktop is not supported!");
}

} else {
System.out.println("File does not exists!");
}

System.out.println("Done");

} catch (Exception ex) {
ex.printStackTrace();
}

}
}

Any help will be greatly appreciated.

Kind Regards
Khan
thumbnail
11年前 に David H Nebinger によって更新されました。

RE: PDF display..

Liferay Legend 投稿: 14917 参加年月日: 06/09/02 最新の投稿
If you search for it, I think you'll find the answer.

This has come up before and there has been lots of info on it.
11年前 に realiste realiste によって更新されました。

RE: PDF display..

Junior Member 投稿: 31 参加年月日: 12/07/20 最新の投稿
hi Muzakir Khan
I have the same problem as you.
did  you have a solution?
thumbnail
11年前 に Victor Zorin によって更新されました。

RE: PDF display..

Liferay Legend 投稿: 1228 参加年月日: 08/04/14 最新の投稿
Displaying pdf in iframe/browser is always going to be problematic for a generic user that does not sit within the Standard Operating Environment.
Display of PDF is heavily dependent on browser and Adobe installations on a specific computer.

From our experience we found that a fairly client environment - independent approach is to provide image-based previews of pages while providing download links. This is one of the examples. You can also have a look how Liferay document library delivers PDF images.
thumbnail
11年前 に Hitoshi Ozawa によって更新されました。

RE: PDF display..

Liferay Legend 投稿: 7942 参加年月日: 10/03/24 最新の投稿
Displaying pdf in iframe/browser is always going to be problematic for a generic user that does not sit within the Standard Operating Environment.
Display of PDF is heavily dependent on browser and Adobe installations on a specific computer.

From our experience we found that a fairly client environment - independent approach is to provide image-based previews of pages while providing download links. This is one of the examples. You can also have a look how Liferay document library delivers PDF images.


Agree on using image instead of pdf. PDF is Adobe proprietary format and there's some difference between how it's displayed on different web browsers and on tools used to create pdf files.