Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Can "DAM Update Asset workflow" generate thumbnails for multiple pages of a PDF?

Avatar

Level 2

We need to generate thumbnails for multiple pages of a PDF asset to allow user have more options to choose from.

It seems from Using PDF Rasterizer, by adding "PDF Rasterizer Handler" step, we can customize the OOBO workflow behavior.

My question is:

Is there a way to update the arguments value (for example -p) to generate thumbnails for multiple PDF pages?

11 Replies

Avatar

Level 2

The question is not answered - not sure how to update "Assumed Answered" to "Not Answered"

Avatar

Employee Advisor

All AEM is doing is running the "PDFRasterizer -d -p 1 -s 1280 -t PNG -i ${file}" command directly on the rasterizer software. So, you have to check if rasterizer software allows that operation.

You should be able to run this command directly from the command prompt using the file name. Try using the help command and check if that option is available.

Some of the OOTB options available

-d: Flag to enable smooth rendering of text, vector artwork, and images. Creates better quality images. However, including this parameter causes the command to run slowly and increase the size of images.

-p: Page number. Default value is all pages. '*' denotes all pages.

-s: Maximum image dimension (height or width). This is converted to DPI for each page. If pages are of different size, each may potentially scale by different amount. The default is actual page size.

-t: Output image type. Valid types are JPEG, PNG, GIF and BMP. The default value is JPEG.

-i: Path for input PDF. You must set this parameter.

-h: Help

Avatar

Level 2

Thanks for the reply.

What do you mean by "you have to check if rasterizer software allows that operation?"

I got the following error in the log after I updated the workflow following exactly in Using PDF Rasterizer

Could it be related to the rasterizer software issue as you mentioned?

11.06.2019 16:25:05.804 *ERROR* [JobHandler: /etc/workflow/instances/server0/2019-06-11/mathworks-dam-update-asset_4:/content/dam/mathworks/white-paper/5G_ebook.pdf/jcr:content/renditions/original] com.day.cq.dam.pdfrasterizer.process.PdfRasterizerHandlingProcess execut

: failed to execute command [[/opt/aem/aeminstall/crx-quickstart/launchpad/felix/bundle723/data/binaries/PDFRasterizer, -d, -p, 1, -s, 1280, -t, PNG, -i, /tmp/cqdam1325151506090818801.tmp/asset_675516a7f9f441c89c99cda14aa9043d.pdf]] for asset [/content/dam/mathworks/whi

e-paper/5G_ebook.pdf]:

org.apache.commons.exec.ExecuteException: Process exited with an error: 127 (Exit value: 127)

        at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404)

        at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)

        at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:153)

        at com.day.cq.dam.pdfrasterizer.process.PdfRasterizerHandlingProcess.execute(PdfRasterizerHandlingProcess.java:233)

        at com.day.cq.workflow.compatibility.CQWorkflowProcessRunner.execute(CQWorkflowProcessRunner.java:93)

        at com.adobe.granite.workflow.core.job.HandlerBase.executeProcess(HandlerBase.java:189)

        at com.adobe.granite.workflow.core.job.JobHandler.process(JobHandler.java:258)

        at org.apache.sling.event.impl.jobs.JobConsumerManager$JobConsumerWrapper.process(JobConsumerManager.java:500)

        at org.apache.sling.event.impl.jobs.queues.JobQueueImpl.startJob(JobQueueImpl.java:291)

        at org.apache.sling.event.impl.jobs.queues.JobQueueImpl.access$100(JobQueueImpl.java:58)

        at org.apache.sling.event.impl.jobs.queues.JobQueueImpl$1.run(JobQueueImpl.java:227)

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

        at java.lang.Thread.run(Thread.java:745)

Avatar

Level 2

I just noticed that there is a dependency for the package which was mentioned in Using PDF Rasterizer

aem-assets-pdf-rasterizer-pkg-3.8-CQ630-B0002.zip

, and I cannot find the dependency:

day/cq60/product:cq-foundation-content:1.3.272

Could it be the reason for the error?

Avatar

Level 2

If it is the dependency's problem, where can I get day/cq60/product:cq-foundation-content:1.3.272?

Avatar

Employee Advisor

Can you make sure you have downloaded the correct libraries from package share?

Also, The PDF Rasterizer library is currently available for Windows and Linux only.

If this is still an issue, Please log a daycare ticket and we can further investigate the issue.

Avatar

Community Advisor

What version of AEM are you running ? Also for raster as per AEM documentation it says -p if we pass * it denotes all pages . So can you try something like

PDFRasterizer -d -p * -s 1280 -t PNG -i ${file}

I couldn't test this because I don't have AEM 6.3 and there is no Raster package available for 6.4

Avatar

Level 2

Hi Veena,

I tried to use * instead of 1 in the command, but got the same error message:

4.06.2019 11:34:27.703 *ERROR* [JobHandler: /etc/workflow/instances/server0/2019-06-13/mathworks-dam-update-asset_2:/content/dam/mathworks/white-paper/mpc-ebooklet.pdf/jcr:content/renditions/original] com.day.cq.dam.pdfrasterizer.process.PdfRasterizerHandlingProcess exe

cute: failed to execute command [[/opt/aem/aeminstall/crx-quickstart/launchpad/felix/bundle723/data/binaries/PDFRasterizer, -d, -p, *, -s, 1280, -t, PNG, -i, /tmp/cqdam8480531329260487208.tmp/asset_6cd9aca7aa244058aa74e18e33748f14.pdf]] for asset [/content/dam/mathworks/

white-paper/mpc-ebooklet.pdf]:

org.apache.commons.exec.ExecuteException: Process exited with an error: 127 (Exit value: 127)

        at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404)

        at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)

        at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:153)

        at com.day.cq.dam.pdfrasterizer.process.PdfRasterizerHandlingProcess.execute(PdfRasterizerHandlingProcess.java:233)

        at com.day.cq.workflow.compatibility.CQWorkflowProcessRunner.execute(CQWorkflowProcessRunner.java:93)

        at com.adobe.granite.workflow.core.job.HandlerBase.executeProcess(HandlerBase.java:189)

        at com.adobe.granite.workflow.core.job.JobHandler.process(JobHandler.java:258)

        at org.apache.sling.event.impl.jobs.JobConsumerManager$JobConsumerWrapper.process(JobConsumerManager.java:500)

        at org.apache.sling.event.impl.jobs.queues.JobQueueImpl.startJob(JobQueueImpl.java:291)

        at org.apache.sling.event.impl.jobs.queues.JobQueueImpl.access$100(JobQueueImpl.java:58)

        at org.apache.sling.event.impl.jobs.queues.JobQueueImpl$1.run(JobQueueImpl.java:227)

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

        at java.lang.Thread.run(Thread.java:745)

Avatar

Employee

Value 127 is returned by /bin/sh when the given command is not found within your PATH system variable and it is not a built-in shell command.

Avatar

Level 2

Do you suggest adding PDFRasterizer to PATH system variable on AEM server?

Avatar

Level 2

I have trouble run this in command line, specifically I'm not able to install the jar file.

My steps are:

  1. on our AEM Linux server, I uploaded the package downloaded from Package Share to /opt/aem/pdftest directory
  2. run unzip aem-assets-pdf-rasterizer-pkg-3.8-CQ630-B0002.zip
  3. cd jcr_root/libs/dam/install, and found  cq-dam-pdfrasterizer-3.8-CQ630-B0002.jar
  4. run "java -jar cq-dam-pdfrasterizer-3.8-CQ630-B0002.jar", trying to install the jar file, but got the following error: "no main manifest attribute, in cq-dam-pdfrasterizer-3.8-CQ630-B0002.jar"

How to install the jar file so that I can test the command?