论坛

主页 » Liferay Portal » English » 3. Development

组合视图 统一视图 树状图
讨论主题 [ 上一个 | 下一个 ]
toggle
Muzakir Khan
PDF display..
2012年5月20日 下午11:18
答复

Muzakir Khan

等级: Regular Member

帖子: 112

加入日期: 2012年3月14日

最近的帖子

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
David H Nebinger
RE: PDF display..
2012年5月23日 上午8:09
答复

David H Nebinger

等级: Liferay Legend

帖子: 6129

加入日期: 2006年9月1日

最近的帖子

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.
realiste realiste
RE: PDF display..
2012年8月9日 下午8:17
答复

realiste realiste

等级: Junior Member

帖子: 31

加入日期: 2012年7月20日

最近的帖子

hi Muzakir Khan
I have the same problem as you.
did  you have a solution?
Victor Zorin
RE: PDF display..
2012年8月9日 下午11:47
答复

Victor Zorin

等级: Liferay Legend

帖子: 1174

加入日期: 2008年4月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.
Hitoshi Ozawa
RE: PDF display..
2012年8月10日 上午7:56
答复

Hitoshi Ozawa

等级: Liferay Legend

帖子: 7990

加入日期: 2010年3月23日

最近的帖子

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.