cancel
Showing results for 
Search instead for 
Did you mean: 

Recreate PDF preview of document?

nettania
Confirmed Champ
Confirmed Champ

Hello,

How can I write a javascript which recreates the PDF preview of a document?

For thumbnails you can use the following tow commands for recreation:

document.createThumbnail("doclib", true);
document.save();

Reason ist, that I have sveral documents where the preview is not working. The reason for this problem was a transfomer issue combined with to few system resources. Using the above command I was able to recreate all thumbnails.

Thanks,

Florian

5 REPLIES 5

angelborroy
Community Manager Community Manager
Community Manager

Try using:

document.createThumbnail("pdf", true);
document.save();
Hyland Developer Evangelist

Thank you for the information. Can this method also be used for images?

I have two examples:

One image where thumbnail (detail view) and preview (gallery view) is working, the image has two subnotes:

cm:doclib
cm:imgpreview

On an image where thumbnail and preview does not work, this subnodes do not exists.

document.createThumbnail("doclib", true);
document.createThumbnail("imgpreview", true);
document.save();

Would this work, or how can I write a script which creates thes two subnodes?

And last question, is there a possibility to improve the "convert" process?

Thanks,

Florian

You can create missing renditions using rendition name.

document.createThumbnail("pdf", true);
document.createThumbnail("doclib", true);
document.createThumbnail("imgpreview", true);
document.save();

Can you provide additional details on convert/transformation improvements?

Hyland Developer Evangelist

Hi,

thank you for the clarification, this has helped a lot.

According to the convert performance:

Currently we are not using the T-Engine, this is a future project of us. We are using the jodconverter an image magick. This is the currentl configuration of alfresco-global.properties:

#
# External locations
#-------------
jodconverter.officeHome=/usr/lib/libreoffice
jodconverter.portNumbers=8101
jodconverter.enabled=true

### Jod converter file size settings ###
content.transformer.JodConverter.extensions.docx.pdf.maxSourceSizeKBytes=15000

#
# Image magick
#
img.root=
img.exe=/usr/bin/convert

If I execute the script to create the different renditions, al lot of convert processes are started parallel. Is there a chance to set the max number of parallel convert processes?

Florian

You may try using an asynchronous action for that process, since this kind of elements are executed using a Thread Pool.

default.async.action.threadPriority=1
default.async.action.corePoolSize=8
default.async.action.maximumPoolSize=20
Hyland Developer Evangelist