Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

PDF Handler

Avatar

Former Community Member

Hi everyone,

The basic PDF Handler seems to create subassets for every single page, which can be quiet annoying, if PDF's are uploaded with more than 100 pages.

How do we change this behaviour to only create an image for the first page?


Kind regards,

 

Jerry

1 Accepted Solution

Avatar

Correct answer by
Level 10

You can use the PdfHandler API and a custom handler:

https://docs.adobe.com/docs/en/cq/5-6-1/javadoc/com/day/cq/dam/handler/standard/pdf/PdfHandler.html

This class extends AbstractAssetHandler.

Bascially - you have to create your own handler and use PdfHandler to define the functionality that you want. That is the reason for the PdfHandler class. 

We have a community article that shows you how to create a custom handler that uses AbstractAssetHandler.

https://helpx.adobe.com/experience-manager/using/damhandler.html

View solution in original post

5 Replies

Avatar

Correct answer by
Level 10

You can use the PdfHandler API and a custom handler:

https://docs.adobe.com/docs/en/cq/5-6-1/javadoc/com/day/cq/dam/handler/standard/pdf/PdfHandler.html

This class extends AbstractAssetHandler.

Bascially - you have to create your own handler and use PdfHandler to define the functionality that you want. That is the reason for the PdfHandler class. 

We have a community article that shows you how to create a custom handler that uses AbstractAssetHandler.

https://helpx.adobe.com/experience-manager/using/damhandler.html

Avatar

Level 10

What version of CQ are you using? 

Avatar

Former Community Member

Thanks for the informations.

 

As I understand, if we write a new Handler for PDF's, this will not overwrite the existing one. So we will have two handlers and have to manually deactivate the original one.

Is there a possibility to:

    1. Overwrite the existing one

or

    2. deactivate the existing one via a mecanism/package/bundle. Otherwise with each restart of the AEM process, it will started again and has to be deactivated manually. We have several author instances.

Avatar

Level 10

I am not sure why you want to deactivate the existing one? When you upload a PDF - the handler will be invoked. Why would you want to deactivate it? 

Avatar

Former Community Member

As I said, we just want to overwrite the original one or deactivate it

The reason is, that we will have quite a lot of PDF's with a lot of pages. This will pollute the system with preview images of pages, which are never needed. Furthermore we want different sizes for the preview-images.

The goal is to have 1 preview Image of the first page in custom sizes. If you see a better way, than rewrite the PDF Handler, please let me know.

 

Kind regards,

 

Jerry