Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

coerce object error out of assembler

Avatar

Level 2
I have a livecycle process that uses Assembler to create a PDF package. I then want to reader extend that package. I believe that I have to use "AssemblerResult" as the output type for the Assembler service but when it is passed to ReaderExtension, I get a "cannot coerce object from AssemblerResult to document type. Any thoughts on how to get around this??
2 Replies

Avatar

Level 10
Your are correct that the Assembler service returns an AssemblerResult object. <br /><br />However the ReaderExtension service doesn't take an AssemblerResult as in input, it takes a document object.<br /><br />You need to extract the document from the AssemblerResult using the following xPath:<br /><br />/process_data/@myDoc = /process_data/assresult/object/documents[@id='out.pdf']<br /><br />out.pdf is the name you would give to the resulted document in your result tag in the DDX.<br /><br /><PDF result="pdf2image_res.pdf"><br /><br />Jasmin

Avatar

Level 2
Thank you! That is exactly what I needed.