Foros de discusión
How to download PDF from Liferay 6.1 document library
Satish Babu Anupoju, modificado hace 11 años.
How to download PDF from Liferay 6.1 document library
Junior Member Mensajes: 79 Fecha de incorporación: 20/02/11 Mensajes recientes
Hi Friends
Currently I am working with Liferay 6.1.
As per my requirement I have to upload bunch of all types of documents(like .txt, .doc, .pdf etc.,)
I am successfully uploading all the documents, But when I am trying to download, especially pdf and jpeg it is not giving any popup(like open and save ) and opening in the same window. It's not happening for remaining file extensions.
As per my requirement When I click on the download I want to ask one popup (link open and save ).
Can any one provide some suggestions to solve this issue.
Thanks in advance
Regards
Satish Babu
Currently I am working with Liferay 6.1.
As per my requirement I have to upload bunch of all types of documents(like .txt, .doc, .pdf etc.,)
I am successfully uploading all the documents, But when I am trying to download, especially pdf and jpeg it is not giving any popup(like open and save ) and opening in the same window. It's not happening for remaining file extensions.
As per my requirement When I click on the download I want to ask one popup (link open and save ).
Can any one provide some suggestions to solve this issue.
Thanks in advance
Regards
Satish Babu
David H Nebinger, modificado hace 11 años.
RE: How to download PDF from Liferay 6.1 document library
Liferay Legend Mensajes: 14914 Fecha de incorporación: 2/09/06 Mensajes recientes
Your browser is determining that it can handle the display of the PDF which is why it is not prompting.
I believe there are headers that you can set to force the download, but you'll have to google for that information. Note that I do not believe there is a standard cross-browser solution.
I believe there are headers that you can set to force the download, but you'll have to google for that information. Note that I do not believe there is a standard cross-browser solution.
simon tuffle, modificado hace 11 años.
RE: How to download PDF from Liferay 6.1 document library
Regular Member Mensajes: 150 Fecha de incorporación: 18/05/09 Mensajes recientes
Hi David H Nebinger,
Could you please be more clear, as even i am also looking for the same..
Regards,
Could you please be more clear, as even i am also looking for the same..
Regards,
Hitoshi Ozawa, modificado hace 11 años.
RE: How to download PDF from Liferay 6.1 document library
Liferay Legend Mensajes: 7942 Fecha de incorporación: 24/03/10 Mensajes recientes
Well, it's possible to download pdf file by right clicking on "Download" and selecting "Save target as..."
Or set the following property in portal-ext.properties
mime.types.content.disposition.inline=flv,swf,wmv
Or set the following property in portal-ext.properties
mime.types.content.disposition.inline=flv,swf,wmv
Ravi Kumar Gupta, modificado hace 11 años.
RE: How to download PDF from Liferay 6.1 document library
Liferay Legend Mensajes: 1302 Fecha de incorporación: 24/06/09 Mensajes recientes
There is one more thing. Reading that should be useful. http://www.jguru.com/faq/view.jsp?EID=252010
Hitoshi Ozawa, modificado hace 11 años.
RE: How to download PDF from Liferay 6.1 document library
Liferay Legend Mensajes: 7942 Fecha de incorporación: 24/03/10 Mensajes recientes
In other words, to use
portal-service/src/com/liferay/portal/kernel/servlet/ServletResponseUtil.java
to call #531
protected static void setHeaders(
HttpServletRequest request, HttpServletResponse response,
String fileName, String contentType) {
even though, it's just doing this
String extension = GetterUtil.getString(
FileUtil.getExtension(fileName)).toLowerCase();
String[] mimeTypesContentDispositionInline = null;
try {
mimeTypesContentDispositionInline = PropsUtil.getArray(
"mime.types.content.disposition.inline");
}
catch (Exception e) {
mimeTypesContentDispositionInline = new String[0];
}
if (ArrayUtil.contains(
mimeTypesContentDispositionInline, extension)) {
contentDisposition = StringUtil.replace(
contentDisposition, "attachment; ", "inline; ");
}
response.setHeader(
HttpHeaders.CONTENT_DISPOSITION, contentDisposition);
}
portal-service/src/com/liferay/portal/kernel/servlet/ServletResponseUtil.java
to call #531
protected static void setHeaders(
HttpServletRequest request, HttpServletResponse response,
String fileName, String contentType) {
even though, it's just doing this
String extension = GetterUtil.getString(
FileUtil.getExtension(fileName)).toLowerCase();
String[] mimeTypesContentDispositionInline = null;
try {
mimeTypesContentDispositionInline = PropsUtil.getArray(
"mime.types.content.disposition.inline");
}
catch (Exception e) {
mimeTypesContentDispositionInline = new String[0];
}
if (ArrayUtil.contains(
mimeTypesContentDispositionInline, extension)) {
contentDisposition = StringUtil.replace(
contentDisposition, "attachment; ", "inline; ");
}
response.setHeader(
HttpHeaders.CONTENT_DISPOSITION, contentDisposition);
}
Ravi Kumar Gupta, modificado hace 11 años.
RE: How to download PDF from Liferay 6.1 document library
Liferay Legend Mensajes: 1302 Fecha de incorporación: 24/06/09 Mensajes recientes
Thanks Hitoshi for sharing the code snippet. I was thinking the same but just was lazy enough to look into it. And its good to know that Liferay is taking care by itself.
simon tuffle, modificado hace 11 años.
RE: How to download PDF from Liferay 6.1 document library
Regular Member Mensajes: 150 Fecha de incorporación: 18/05/09 Mensajes recientes
Hi Hitoshi,
Thanks for sharing your idea. What ultimately we need a popup to download the pdf & jpeg files.
If it is possible with hooks, Could you please explain me with more clear steps, So that i can do the same in my machine.
Regards,
Thanks for sharing your idea. What ultimately we need a popup to download the pdf & jpeg files.
If it is possible with hooks, Could you please explain me with more clear steps, So that i can do the same in my machine.
Regards,
Hitoshi Ozawa, modificado hace 11 años.
RE: How to download PDF from Liferay 6.1 document library
Liferay Legend Mensajes: 7942 Fecha de incorporación: 24/03/10 Mensajes recientes
This is just for pdf.
Just set the following property in portal-ext.properties:
mime.types.content.disposition.inline=flv,swf,wmv
Just set the following property in portal-ext.properties:
mime.types.content.disposition.inline=flv,swf,wmv
simon tuffle, modificado hace 11 años.
RE: How to download PDF from Liferay 6.1 document library
Regular Member Mensajes: 150 Fecha de incorporación: 18/05/09 Mensajes recientes
I have already set the properties in portal-ext.properties. But didn't found any luck.
Thanks for prompt response.
Regards,
Thanks for prompt response.
Regards,
Hitoshi Ozawa, modificado hace 11 años.
RE: How to download PDF from Liferay 6.1 document library
Liferay Legend Mensajes: 7942 Fecha de incorporación: 24/03/10 Mensajes recientes
Can you tell me which browser and version you're using? Right click on the "Download" doesn't work either?
simon tuffle, modificado hace 11 años.
RE: How to download PDF from Liferay 6.1 document library
Regular Member Mensajes: 150 Fecha de incorporación: 18/05/09 Mensajes recientes
Hi Hitoshi,
I am able to right click on the "download" and "saveAs". But i need is a popup should open as its opening while downloading txt,ppt,doc etc.
Regards,
I am able to right click on the "download" and "saveAs". But i need is a popup should open as its opening while downloading txt,ppt,doc etc.
Regards,