This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Oct 19, 2011, 8:39 PM
37 Posts

Page count validation for pdf's

  • Category: Server Side JavaScript
  • Platform: Windows
  • Release: 8.5.2
  • Role: Developer
  • Tags: pdf,attachments
  • Replies: 1
Hello, all!
 I am a longtime Domino developer, relatively new to XPages.  The requirement is quite simple, although, I have never been able to find anyone else who has even tried this...
 
Basically, validate one set of attachments, pdf's only, based on how many pages are in each file.  So, if the limit is 25 pages, this is how it works:
  1. attach file #1 - 10 pages.  OK.
  2. attach file #2 - 10 pages.  OK.
  3. attach file #3 - 7 pages.  OOPS!  Sorry, you've gone over the 25 page limit.  Please try another.
  4. attach file #4 - 5 pages.  OK.
At this point, the user can't attach any more pdf's, unless some are removed.  This is in several file uploads, but the totals are for the entire web form.
 
I've been able to do this in traditional Domino, using a small java applet to return the page counts, and javascript to update the total before validating.  Is there any way to do this with SSJS or other way?  Note that the pdf file shouldn't be saved at all if it goes over the limit.
Thanks, in advance!
 
Steve in NYC
 
"Every morning is the dawn of a new error..."
Oct 20, 2011, 5:13 AM
54 Posts
Re: Page count validation for pdf's
You can use Java libraries and Java language in SSJS. So if you have already solved this with a Java applet, it should be easy way you to port it to SSJS.
iText is a great library to handle PDF files, I think that would give the page count information quite easy.
 
 
"Every morning is the dawn of a new error..."
Totally agree you on this one :)
 
 

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal