Number of pages in a pdf generated document

1
I am generating a pdf document which  could span across various amount of pages. Is there a way to store or return the value of the amount of pages in a variable? Is there anyway I could get the amount of pages that was generated in the file document? Thank you, Kofi
asked
2 answers
3

Import community commons from the appstore. Create a java action with a parameter filedocument and return integer.

 

	// BEGIN USER CODE
		IContext context = getContext();
		PDDocument inputDoc = PDDocument.load(Core.getFileDocumentContent(context, filedocument.getMendixObject()));
		return inputDoc.getNumberOfPages();
	// END USER CODE

 

answered
1

Hey Kofi,

I just published a module which contains a number of Java actions to extract the contents and metadata of PDF files, one of which is to get the number of pages in your PDF document. 

You can find the module here: https://appstore.home.mendix.com/link/app/109922/ 

Hope it helps in the future.

answered