Print Page | Close Window

How to check if there are figures in a page?

Printed From: Foxit's Planet PDF Forum
Category: Lets Talk PDF
Forum Name: JavaScript
Forum Description: Discussions relating to the use of JavaScript within PDF.
URL: http://forums.planetpdf.com/forum_posts.asp?TID=49
Printed Date: 17 Sep 2019 at 10:34pm
Software Version: Web Wiz Forums 11.10 - http://www.webwizforums.com


Topic: How to check if there are figures in a page?
Posted By: oald
Subject: How to check if there are figures in a page?
Date Posted: 30 Sep 2011 at 12:50pm
I'm developing a tool to remove blank pages in a PDF document, my way is to use getPageNumWords method, if the number of words in a page is 0, the tool regards it as a blank page,
 
for (var k = this.numPages - 1; k >= 0; k--) 
{
   numWords = this.getPageNumWords(k);
   if (numWords == 0)
   {
       this.deletePages(k,k);
   }
}
 
But there is an issue that Figures that cannot be OCRed (see the attachment for an example) http://forums.planetpdf.com/uploads/151/Test.pdf - uploads/151/Test.pdf  is also removed as blank pages as there are no words in it, could you show me how to resolve this? Your help is really appreciated!



Replies:
Posted By: try67
Date Posted: 30 Sep 2011 at 2:27pm
It can't be done with JS, unfortunately.

-------------
- Acrobat Expert - Contact me personally at try6767@gmail.com
Check out my custom-made scripts website: http://try67.blogspot.com


Posted By: BAlheit
Date Posted: 30 Sep 2011 at 4:28pm
You can remove empty pages with the Preflight Tool.


Posted By: oald
Date Posted: 01 Oct 2011 at 5:37am
Hi BAlheit,
 
I'm using Acrobat 8 Professional and I just have a check, there is no "Remove empty page" function in Preflight, is it only available in Acrobat 9 or 10?


Posted By: BAlheit
Date Posted: 01 Oct 2011 at 10:37am
You can add a custom profile and add new fixups:



Posted By: oald
Date Posted: 01 Oct 2011 at 4:30pm
Hi BAlheit,
 
Thanks for your answer! But how I can get the profile? Need I create it by myself, or I can download it from somewhere?


Posted By: BAlheit
Date Posted: 01 Oct 2011 at 5:06pm
In Acrobat 8 Professional create a new profile and add the fixup 'Remove empty pages'.


Posted By: oald
Date Posted: 03 Oct 2011 at 6:29am
Hi BAlheit,
 
Thanks for your follow up, I will have a try.


Posted By: try67
Date Posted: 03 Oct 2011 at 10:12am
You can execute a preflight profile using the preflight() method of the Document object.
Use Preflight.getProfileByName() to retrieve the PreflightProfile object you want to execute.

-------------
- Acrobat Expert - Contact me personally at try6767@gmail.com
Check out my custom-made scripts website: http://try67.blogspot.com



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.10 - http://www.webwizforums.com
Copyright ©2001-2017 Web Wiz Ltd. - https://www.webwiz.net