Fórum

Get first page of pdf as image in liferay

thumbnail
Praful Shukla, modificado 7 Anos atrás.

Get first page of pdf as image in liferay

Junior Member Postagens: 46 Data de Entrada: 29/09/15 Postagens Recentes
Hi,
Currently, I am using a structure and template for displaying my various PDFs in tabular format.
Now, I'm thinking to make it in grid format. So for the same I want that first page of PDF uploaded,
should be shown dynamically as an image in my web content and after clicking on the image the
PDF should open.
Is there any way to achieve this..??

Thanks in Advance..!!
thumbnail
David H Nebinger, modificado 7 Anos atrás.

RE: Get first page of pdf as image in liferay

Liferay Legend Postagens: 14914 Data de Entrada: 02/09/06 Postagens Recentes
Yeah, just don't worry about it.

When you upload a doc into docs and media, Liferay will generate a thumbnail image for it. When the doc is a PDF, it will be a thumbnail of the PDF.

For your use case, you should have your doc id, so from there you can use the Liferay APIs to get the thumbnail for display purposes.
thumbnail
Praful Shukla, modificado 7 Anos atrás.

RE: Get first page of pdf as image in liferay

Junior Member Postagens: 46 Data de Entrada: 29/09/15 Postagens Recentes
Hello David,

Thank you for your quick reply, but I want to know how can I use the Liferay's API to get the thumbnail of my uploaded PDF.
Help is highly appreciated.
thumbnail
David H Nebinger, modificado 7 Anos atrás.

RE: Get first page of pdf as image in liferay

Liferay Legend Postagens: 14914 Data de Entrada: 02/09/06 Postagens Recentes
Check out DLUtil.getThumbnailSrc() methods...
thumbnail
Praful Shukla, modificado 7 Anos atrás.

RE: Get first page of pdf as image in liferay

Junior Member Postagens: 46 Data de Entrada: 29/09/15 Postagens Recentes
Hello David,
I am not able to get the thumbnail of my PDF document by using the following code,
<img src="DLUtil.getThumbnailSrc(fileEntry, fileEntry.getFileVersion(), null, themeDisplay)"/>
Where am I getting wrong..??
Could you please help me over this..??