Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
venka reddy
document libray PDF download
May 8, 2012 11:11 PM
Answer

venka reddy

Rank: Regular Member

Posts: 231

Join Date: March 23, 2011

Recent Posts

I am working with Liferay 6.0.5

I have to upload all types of documents(like .txt, .doc, .pdf etc.,)

I am successfully uploading all the documents,

But when I am trying to download pdf, it is opening in the same window with illegal charaters as below

%PDF-1.6 %???? 1696 0 obj <> endobj xref 1696 8 0000000016 00000 n 0000010976 00000 n 0000011102 00000 n
0000011234 00000 n 0000011428 00000 n 0000011510 00000 n 0000011812 00000 n 0000000456 00000 n trailer
<<817CF48008D94442B393B8F19630E883>]>> startxref 0 %%EOF 1703 0 obj<>stream x??|}xU???d??&MZRhK???b?%?Vw??Z?`D???B?4h???:I?6@?

Could you provide solution to solve the promblem??
venka reddy
RE: document libray PDF download
May 9, 2012 1:33 AM
Answer

venka reddy

Rank: Regular Member

Posts: 231

Join Date: March 23, 2011

Recent Posts

venka reddy:
I am working with Liferay 6.0.5

I have to upload all types of documents(like .txt, .doc, .pdf etc.,)

I am successfully uploading all the documents,

But when I am trying to download pdf, it is opening in the same window with illegal charaters as below

%PDF-1.6 %???? 1696 0 obj <> endobj xref 1696 8 0000000016 00000 n 0000010976 00000 n 0000011102 00000 n
0000011234 00000 n 0000011428 00000 n 0000011510 00000 n 0000011812 00000 n 0000000456 00000 n trailer
<<817CF48008D94442B393B8F19630E883>]>> startxref 0 %%EOF 1703 0 obj<>stream x??|}xU???d??&MZRhK???b?%?Vw??Z?`D???B?4h???:I?6@?

Could you provide solution to solve the promblem??
Hiral Ramavat
RE: document libray PDF download
May 9, 2012 8:24 AM
Answer

Hiral Ramavat

Rank: Regular Member

Posts: 102

Join Date: February 13, 2012

Recent Posts

Does it show any error in logs? Are you using OOB Document Library or have you customized it?
venka reddy
RE: document libray PDF download
May 10, 2012 2:00 AM
Answer

venka reddy

Rank: Regular Member

Posts: 231

Join Date: March 23, 2011

Recent Posts

Hi,
Thanks for your reply

it is not showing any error log ,

Here is my code


InputStream inputStream = DLLocalServiceUtil.getFileAsStream(CompanyId, CompanyConstants.SYSTEM, path);

int fileContentLength = (int)DLServiceUtil.getFileSize(CompanyId, CompanyConstants.SYSTEM, path);


String contentType = MimeTypesUtil.getContentType(fileName);

ServletResponseUtil.sendFile(response, fileName, iinputStream , fileContentLength , contentType);
Jitendra Rajput
RE: document libray PDF download
May 9, 2012 11:05 PM
Answer

Jitendra Rajput

Rank: Liferay Master

Posts: 873

Join Date: January 7, 2011

Recent Posts

Have you created custom portlet to download documents ? Or you are getting this with OOB portlet ?
venka reddy
RE: document libray PDF download
May 10, 2012 2:01 AM
Answer

venka reddy

Rank: Regular Member

Posts: 231

Join Date: March 23, 2011

Recent Posts

Hi Jitendra ,

I have created custom portlet to download documents
Jitendra Rajput
RE: document libray PDF download
May 10, 2012 4:37 AM
Answer

Jitendra Rajput

Rank: Liferay Master

Posts: 873

Join Date: January 7, 2011

Recent Posts

If you have Liferay Portal Source then look into GetFileAction
Inside com.liferay.portlet.documentlibrary.action package .


In that you will find OOB implementation of functionality that you are trying to implement.
venka reddy
RE: document libray PDF download
May 10, 2012 9:33 PM
Answer

venka reddy

Rank: Regular Member

Posts: 231

Join Date: March 23, 2011

Recent Posts

hi Jitendra ,

Thanks for your reply,

i will try it and inform u