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.

Retrieving Page Count on an Assembled Document

Avatar

Former Community Member
I need to be able to retrieve the number of pages in a PDF returned from the Assembler Service. I can retrieve the com.adobe.idp.Document object, but it does not have a getPageCount() method.



I need something similar to what the Forms service has, the FormsResult object has a getPageCount() method, but the AssemblerResult does not.



Anyone know how to do this?



Thanks,

Karl.
2 Replies

Avatar

Former Community Member
The way to do this is to add a following result block to return information in XML format about the document you created.



For example, in your DDX you would have a PDF result block followed by a DocumentInformation result block where the PDF source is the PDF result from the previous result block:



<?xml version="1.0" encoding="UTF-8"?>

<DDX xmlns="http://ns.adobe.com/DDX/1.0">



  <PDF result="out.pdf">

    ... other ddx elements ...

  </PDF>



  <DocumentInformation

    source="out.pdf"

    result="out-docinfo.xml"

  />



</DDX>



You would then obtain the "out-docinfo.xml" document from the AssemblerResult object and use the docinfo.xsd schema, installed with LiveCycle, to obtain the content of the <NumPages> element.



Notes:

1) all documents returned by Assembler are of type idp.Document, even when they contain XML content.

2) the DDX Reference Guide contains a description of the DocInfo schema (Document Information Language).

Avatar

Former Community Member
JK,



That's spot on, thanks for the information, appreciate it



Cheers,

Karl.