Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Detect Empty Pages

Contributor ,
Feb 12, 2016 Feb 12, 2016

Hi,

     I need to detect empty pages of pdf document.  if i use the concept of the below code its fail to me bcoz., document contains document name, date & time at bottom of the page.  How can i detect empty pages of pdf document using javascript or java? Can anyone help me...

for(var i=this.numPages-1;i>=0;i--)

{

    numWords = this.getPageNumWords(i);

   if(numWords == 0)

    {

          app.alert("Empty Pages");

    }

}

Thanks in advance,

Sudha K

TOPICS
Acrobat SDK and JavaScript
4.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 12, 2016 Feb 12, 2016

You can't do it with JavaScript, and whether you can do it with Java depends on which library you're using. It also depends on exactly what you mean by the term "empty". A page can contain text, graphics, or images, all of which may not be visible or appear to be visible. It's not a simple problem.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Feb 12, 2016 Feb 12, 2016

Hi George,

     Thank you...

     In javascript, we can check that using preflight.  Can we call that preflight using java or anyother language??

     Could you guide me how to proceed with java?? I have attached sample blank pages for your reference.

     Screen shot 2016-02-13 at 6.52.01 AM.png

- Sudha K

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 13, 2016 Feb 13, 2016

You can run Preflight Profiles using JavaScript's preflight method of the Document object.

This is not really the place to discuss how to achieve it with Java. Try either the forum/mailing list for the specific library you're using or the Acrobat SDK forum.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Feb 17, 2016 Feb 17, 2016

Ok thank you... I will check in javascript...

Can I call the acrobat script using java?? 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 17, 2016 Feb 17, 2016

‌Are you trying to do this on a server?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 17, 2016 Feb 17, 2016

Can I call the acrobat script using java??

AFAIK, No.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 04, 2016 Mar 04, 2016

Hi,

     Not in server... I want to get the pdf page numbers for multiple pdfs and want to write it as report for both OS( Mac and PC).

    We can do this using applescript and javascript but it will run only in mac.  But I want to run on both OS.  So thought of to use java for both OS...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 04, 2016 Mar 04, 2016

Do you just want the number of pages in each file? It can be easily done with JS, using this command:

this.numPages

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 04, 2016 Mar 04, 2016

In Windows you can use the linkage between Visual Basic and Acrobat JavaScript ("JSObject") as described in the Acrobat SDK. This is the method for external scripting.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 09, 2016 Mar 09, 2016

Hi,

     Sorry for the late reply....

  

     I can get pdf page numbers using javascript.  Also can generate report with the help of applescript.  But I want it for both OS...

     I want to get the all page numbers of file and also empty page's page number of PDF File and need to write report csv for both OS (Window & Mac OSX).  Is it possible? Using scripting or script with java or any other scripting?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 09, 2016 Mar 09, 2016

‌Page numbers on the page are just text. You can get text and text location, uding this to guess page numbers. There is no access to other page contents. Si you can detect pages without text but not blank pages.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 09, 2016 Mar 09, 2016

ok... can i write csv file using acrobat scripting???

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 10, 2016 Mar 10, 2016

I don't know. See what the docs say. I know nothing about XFA JavaScript except that it is different.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 10, 2016 Mar 10, 2016

‌Sorry I mixed up my reply, forget XFA. But check what export options are documented.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 10, 2016 Mar 10, 2016

‌ah wait - you don't want to export csv you want to write a file. No. But not a problem, write it from your VB environment.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 10, 2016 Mar 10, 2016

If I use VB, it will work for only Windonws is it right???  But I want to run the tool for both OS...  Can I use this for both OS???

I saw this link ... Can we use this for javascript??

http://stackoverflow.com/questions/11978407/java-scriptenginemanager-no-longer-works-with-mountain-l...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 10, 2016 Mar 10, 2016

With Acrobat Javascript you can create a Report document and save it.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 10, 2016 Mar 10, 2016

Can u tell me how to to that using acrobat scripting??

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 10, 2016 Mar 10, 2016

H‌ave you got the Acrobat JavaScript API document?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 10, 2016 Mar 10, 2016

yes I'm having...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 11, 2016 Mar 11, 2016

In the Javascript Reference look for the Report object.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 14, 2016 Mar 14, 2016

I have referred the reference and also I have tested the code given in tat pdf.  Its creating PDF file.  Report will create only PDF File?? Can we create CSV file??

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 14, 2016 Mar 14, 2016

You can save the Report as a text file.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 15, 2016 Mar 15, 2016

Can you tell me how to do??

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines