You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by John Milne <JM...@phlexglobal.com> on 2014/06/20 14:39:12 UTC

Get page count from encrypted document

Hi,

I have a number of PDF's with various levels of security and need to be able to get a page count from them.
The getNumberOfPages call fails to return a value with a document that is secured, while Adobe reader and windows preview are able to get the page count.

[cid:image001.jpg@01CF8C8D.050EFF20]

PDDocument doc = PDDocument.load(new File(args[0]));
int count = doc.getNumberOfPages();

Does anyone have any thoughts as to why and how I can get a page count?

Regards

John



[cid:image002.png@01CF8C8D.050EFF20]

John Milne, Analyst Programmer
T: +44 (0)1494 720420  F: +44 (0)1494 720430

E: jmilne@phlexglobal.com<ma...@phlexglobal.com>
W:www.phlexglobal.com<http://www.phlexglobal.com/>





Phlexglobal are worldwide leaders and specialists in the provision of local & global, technology enabled TMF document management solutions and support services.
The information in this E-mail and any attachments to it are confidential in every way and for the sole view of the addressee. If you have received it in error, please accept our apologies and delete it from your system. Thank you. | Any opinions expressed in this message or its attachments are those of the author and are not necessarily those of Phlexglobal Ltd, who disclaim all responsibility and accept no liability for the consequences of anyone acting on the information contained.
Phlexglobal Ltd is a limited company registered in England and Wales under company number 3544670 | VAT No. 108 216 051 | Registered address at Mandeville House, 62 The Broadway, Amersham, Bucks HP7 0HJ, UK


Re: Get page count from encrypted document

Posted by Dave Smith <da...@candata.com>.
I would suggest you open up the PDF in a text editor and see if you can a
page object with it's count. On all of my examples those objects are
encrypted with the key so there is no way for pdf box to figure out how
many pages there are


On Mon, Jun 23, 2014 at 5:42 AM, Gilad Denneboom <gi...@gmail.com>
wrote:

> I agree in principle, but there could be some technical issues that prevent
> it, as an encryption policy is basically a type of digital signature that
> is applied to the file.
>
>
> On Mon, Jun 23, 2014 at 11:36 AM, John Milne <JM...@phlexglobal.com>
> wrote:
>
> > Hi,
> >
> > Agreed, but there are different levels of security available on a PDF.
> > Simple security such as preventing changing a document, commenting it, or
> > form field fill in should not prevent a page count being returned without
> > calling the openProtection() method first.
> >
> > If you can view the document, then the page count should be available. To
> > my mind anyhow.
> >
> > Regards
> >
> > John
> >
> > -----Original Message-----
> > From: Gilad Denneboom [mailto:gilad.denneboom@gmail.com]
> > Sent: 23 June 2014 10:14
> > To: users@pdfbox.apache.org
> > Subject: Re: Get page count from encrypted document
> >
> > The entire point of encryption is to prevent someone without the right
> > knowledge (the password) from gaining access to the contents of your
> file,
> > such as the number of pages in it.
> >
> >
> > On Mon, Jun 23, 2014 at 10:38 AM, John Milne <JM...@phlexglobal.com>
> > wrote:
> >
> > > One last question for someone.
> > > Why do we need to decrypt the PDF to simply get the page count?
> > >
> > > Thanks
> > >
> > > John
> > >
> > > -----Original Message-----
> > > From: John Milne [mailto:JMilne@phlexglobal.com]
> > > Sent: 20 June 2014 14:43
> > > To: users@pdfbox.apache.org
> > > Subject: RE: Get page count from encrypted document
> > >
> > > Thanks Dave,
> > >
> > > That appears to do the trick.
> > >
> > > Best regards
> > >
> > > John
> > >
> > > -----Original Message-----
> > > From: Dave Smith [mailto:dave.smith@candata.com]
> > > Sent: 20 June 2014 14:09
> > > To: users@pdfbox.apache.org
> > > Subject: Re: Get page count from encrypted document
> > >
> > > After you load the document
> > >
> > > if(document.isEncrypted())
> > >             {
> > >                 document.openProtection(new
> > > StandardDecryptionMaterial(""));
> > >             }
> > >
> > > In the "" enter the password if required.
> > >
> > >
> > >
> > >
> > > On Fri, Jun 20, 2014 at 9:04 AM, Gilad Denneboom <
> > > gilad.denneboom@gmail.com>
> > > wrote:
> > >
> > > > What kind of security? If it's a file-open password then you can't
> > > > get any information about it (at least in any Adobe apps), until you
> > > > provide the password.
> > > >
> > > >
> > > > On Fri, Jun 20, 2014 at 2:39 PM, John Milne <JM...@phlexglobal.com>
> > > > wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > >
> > > > >
> > > > > I have a number of PDF’s with various levels of security and need
> > > > > to be able to get a page count from them.
> > > > >
> > > > > The getNumberOfPages call fails to return a value with a document
> > > > > that is secured, while Adobe reader and windows preview are able
> > > > > to get the page count.
> > > > >
> > > > >
> > > > >
> > > > > [image: cid:image001.jpg@01CF8C8B.EAAF6620]
> > > > >
> > > > >
> > > > >
> > > > > PDDocument doc = PDDocument.load(new File(args[0]));
> > > > >
> > > > > int count = doc.getNumberOfPages();
> > > > >
> > > > >
> > > > >
> > > > > Does anyone have any thoughts as to why and how I can get a page
> > count?
> > > > >
> > > > >
> > > > >
> > > > > Regards
> > > > >
> > > > >
> > > > >
> > > > > John
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > [image: Description: Phlex-small-png.png]
> > > > >
> > > > > *John Milne*, Analyst Programmer
> > > > > *T:* +44 (0)1494 720420  *F*: +44 (0)1494 720430
> > > > >
> > > > > *E:* jmilne@phlexglobal.com
> > > > >
> > > > > *W:*www.phlexglobal.com
> > > > >
> > > > >
> > > > >
> > > > > *Phlexglobal are worldwide leaders and specialists in the
> > > > > provision of local & global, technology enabled TMF document
> > > > > management solutions and support services.*
> > > > >
> > > > > The information in this E-mail and any attachments to it are
> > > > > confidential in every way and for the sole view of the addressee.
> > > > > If you have received it in error, please accept our apologies and
> > > > > delete
> > > it from your system.
> > > > > Thank you. | Any opinions expressed in this message or its
> > > > > attachments
> > > > are
> > > > > those of the author and are not necessarily those of Phlexglobal
> > > > > Ltd, who disclaim all responsibility and accept no liability for
> > > > > the consequences
> > > > of
> > > > > anyone acting on the information contained.
> > > > >
> > > > > Phlexglobal Ltd is a limited company registered in England and
> > > > > Wales
> > > > under
> > > > > company number 3544670 | VAT No. 108 216 051 | Registered address
> > > > > at Mandeville House, 62 The Broadway, Amersham, Bucks HP7 0HJ, UK
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
>

Re: Get page count from encrypted document

Posted by Gilad Denneboom <gi...@gmail.com>.
I agree in principle, but there could be some technical issues that prevent
it, as an encryption policy is basically a type of digital signature that
is applied to the file.


On Mon, Jun 23, 2014 at 11:36 AM, John Milne <JM...@phlexglobal.com> wrote:

> Hi,
>
> Agreed, but there are different levels of security available on a PDF.
> Simple security such as preventing changing a document, commenting it, or
> form field fill in should not prevent a page count being returned without
> calling the openProtection() method first.
>
> If you can view the document, then the page count should be available. To
> my mind anyhow.
>
> Regards
>
> John
>
> -----Original Message-----
> From: Gilad Denneboom [mailto:gilad.denneboom@gmail.com]
> Sent: 23 June 2014 10:14
> To: users@pdfbox.apache.org
> Subject: Re: Get page count from encrypted document
>
> The entire point of encryption is to prevent someone without the right
> knowledge (the password) from gaining access to the contents of your file,
> such as the number of pages in it.
>
>
> On Mon, Jun 23, 2014 at 10:38 AM, John Milne <JM...@phlexglobal.com>
> wrote:
>
> > One last question for someone.
> > Why do we need to decrypt the PDF to simply get the page count?
> >
> > Thanks
> >
> > John
> >
> > -----Original Message-----
> > From: John Milne [mailto:JMilne@phlexglobal.com]
> > Sent: 20 June 2014 14:43
> > To: users@pdfbox.apache.org
> > Subject: RE: Get page count from encrypted document
> >
> > Thanks Dave,
> >
> > That appears to do the trick.
> >
> > Best regards
> >
> > John
> >
> > -----Original Message-----
> > From: Dave Smith [mailto:dave.smith@candata.com]
> > Sent: 20 June 2014 14:09
> > To: users@pdfbox.apache.org
> > Subject: Re: Get page count from encrypted document
> >
> > After you load the document
> >
> > if(document.isEncrypted())
> >             {
> >                 document.openProtection(new
> > StandardDecryptionMaterial(""));
> >             }
> >
> > In the "" enter the password if required.
> >
> >
> >
> >
> > On Fri, Jun 20, 2014 at 9:04 AM, Gilad Denneboom <
> > gilad.denneboom@gmail.com>
> > wrote:
> >
> > > What kind of security? If it's a file-open password then you can't
> > > get any information about it (at least in any Adobe apps), until you
> > > provide the password.
> > >
> > >
> > > On Fri, Jun 20, 2014 at 2:39 PM, John Milne <JM...@phlexglobal.com>
> > > wrote:
> > >
> > > > Hi,
> > > >
> > > >
> > > >
> > > > I have a number of PDF’s with various levels of security and need
> > > > to be able to get a page count from them.
> > > >
> > > > The getNumberOfPages call fails to return a value with a document
> > > > that is secured, while Adobe reader and windows preview are able
> > > > to get the page count.
> > > >
> > > >
> > > >
> > > > [image: cid:image001.jpg@01CF8C8B.EAAF6620]
> > > >
> > > >
> > > >
> > > > PDDocument doc = PDDocument.load(new File(args[0]));
> > > >
> > > > int count = doc.getNumberOfPages();
> > > >
> > > >
> > > >
> > > > Does anyone have any thoughts as to why and how I can get a page
> count?
> > > >
> > > >
> > > >
> > > > Regards
> > > >
> > > >
> > > >
> > > > John
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > [image: Description: Phlex-small-png.png]
> > > >
> > > > *John Milne*, Analyst Programmer
> > > > *T:* +44 (0)1494 720420  *F*: +44 (0)1494 720430
> > > >
> > > > *E:* jmilne@phlexglobal.com
> > > >
> > > > *W:*www.phlexglobal.com
> > > >
> > > >
> > > >
> > > > *Phlexglobal are worldwide leaders and specialists in the
> > > > provision of local & global, technology enabled TMF document
> > > > management solutions and support services.*
> > > >
> > > > The information in this E-mail and any attachments to it are
> > > > confidential in every way and for the sole view of the addressee.
> > > > If you have received it in error, please accept our apologies and
> > > > delete
> > it from your system.
> > > > Thank you. | Any opinions expressed in this message or its
> > > > attachments
> > > are
> > > > those of the author and are not necessarily those of Phlexglobal
> > > > Ltd, who disclaim all responsibility and accept no liability for
> > > > the consequences
> > > of
> > > > anyone acting on the information contained.
> > > >
> > > > Phlexglobal Ltd is a limited company registered in England and
> > > > Wales
> > > under
> > > > company number 3544670 | VAT No. 108 216 051 | Registered address
> > > > at Mandeville House, 62 The Broadway, Amersham, Bucks HP7 0HJ, UK
> > > >
> > > >
> > > >
> > >
> >
>

RE: Get page count from encrypted document

Posted by John Milne <JM...@phlexglobal.com>.
Hi,

Agreed, but there are different levels of security available on a PDF.
Simple security such as preventing changing a document, commenting it, or form field fill in should not prevent a page count being returned without calling the openProtection() method first. 

If you can view the document, then the page count should be available. To my mind anyhow.

Regards

John

-----Original Message-----
From: Gilad Denneboom [mailto:gilad.denneboom@gmail.com] 
Sent: 23 June 2014 10:14
To: users@pdfbox.apache.org
Subject: Re: Get page count from encrypted document

The entire point of encryption is to prevent someone without the right knowledge (the password) from gaining access to the contents of your file, such as the number of pages in it.


On Mon, Jun 23, 2014 at 10:38 AM, John Milne <JM...@phlexglobal.com> wrote:

> One last question for someone.
> Why do we need to decrypt the PDF to simply get the page count?
>
> Thanks
>
> John
>
> -----Original Message-----
> From: John Milne [mailto:JMilne@phlexglobal.com]
> Sent: 20 June 2014 14:43
> To: users@pdfbox.apache.org
> Subject: RE: Get page count from encrypted document
>
> Thanks Dave,
>
> That appears to do the trick.
>
> Best regards
>
> John
>
> -----Original Message-----
> From: Dave Smith [mailto:dave.smith@candata.com]
> Sent: 20 June 2014 14:09
> To: users@pdfbox.apache.org
> Subject: Re: Get page count from encrypted document
>
> After you load the document
>
> if(document.isEncrypted())
>             {
>                 document.openProtection(new 
> StandardDecryptionMaterial(""));
>             }
>
> In the "" enter the password if required.
>
>
>
>
> On Fri, Jun 20, 2014 at 9:04 AM, Gilad Denneboom < 
> gilad.denneboom@gmail.com>
> wrote:
>
> > What kind of security? If it's a file-open password then you can't 
> > get any information about it (at least in any Adobe apps), until you 
> > provide the password.
> >
> >
> > On Fri, Jun 20, 2014 at 2:39 PM, John Milne <JM...@phlexglobal.com>
> > wrote:
> >
> > > Hi,
> > >
> > >
> > >
> > > I have a number of PDF’s with various levels of security and need 
> > > to be able to get a page count from them.
> > >
> > > The getNumberOfPages call fails to return a value with a document 
> > > that is secured, while Adobe reader and windows preview are able 
> > > to get the page count.
> > >
> > >
> > >
> > > [image: cid:image001.jpg@01CF8C8B.EAAF6620]
> > >
> > >
> > >
> > > PDDocument doc = PDDocument.load(new File(args[0]));
> > >
> > > int count = doc.getNumberOfPages();
> > >
> > >
> > >
> > > Does anyone have any thoughts as to why and how I can get a page count?
> > >
> > >
> > >
> > > Regards
> > >
> > >
> > >
> > > John
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > [image: Description: Phlex-small-png.png]
> > >
> > > *John Milne*, Analyst Programmer
> > > *T:* +44 (0)1494 720420  *F*: +44 (0)1494 720430
> > >
> > > *E:* jmilne@phlexglobal.com
> > >
> > > *W:*www.phlexglobal.com
> > >
> > >
> > >
> > > *Phlexglobal are worldwide leaders and specialists in the 
> > > provision of local & global, technology enabled TMF document 
> > > management solutions and support services.*
> > >
> > > The information in this E-mail and any attachments to it are 
> > > confidential in every way and for the sole view of the addressee. 
> > > If you have received it in error, please accept our apologies and 
> > > delete
> it from your system.
> > > Thank you. | Any opinions expressed in this message or its 
> > > attachments
> > are
> > > those of the author and are not necessarily those of Phlexglobal 
> > > Ltd, who disclaim all responsibility and accept no liability for 
> > > the consequences
> > of
> > > anyone acting on the information contained.
> > >
> > > Phlexglobal Ltd is a limited company registered in England and 
> > > Wales
> > under
> > > company number 3544670 | VAT No. 108 216 051 | Registered address 
> > > at Mandeville House, 62 The Broadway, Amersham, Bucks HP7 0HJ, UK
> > >
> > >
> > >
> >
>

Re: Get page count from encrypted document

Posted by Gilad Denneboom <gi...@gmail.com>.
The entire point of encryption is to prevent someone without the right
knowledge (the password) from gaining access to the contents of your file,
such as the number of pages in it.


On Mon, Jun 23, 2014 at 10:38 AM, John Milne <JM...@phlexglobal.com> wrote:

> One last question for someone.
> Why do we need to decrypt the PDF to simply get the page count?
>
> Thanks
>
> John
>
> -----Original Message-----
> From: John Milne [mailto:JMilne@phlexglobal.com]
> Sent: 20 June 2014 14:43
> To: users@pdfbox.apache.org
> Subject: RE: Get page count from encrypted document
>
> Thanks Dave,
>
> That appears to do the trick.
>
> Best regards
>
> John
>
> -----Original Message-----
> From: Dave Smith [mailto:dave.smith@candata.com]
> Sent: 20 June 2014 14:09
> To: users@pdfbox.apache.org
> Subject: Re: Get page count from encrypted document
>
> After you load the document
>
> if(document.isEncrypted())
>             {
>                 document.openProtection(new
> StandardDecryptionMaterial(""));
>             }
>
> In the "" enter the password if required.
>
>
>
>
> On Fri, Jun 20, 2014 at 9:04 AM, Gilad Denneboom <
> gilad.denneboom@gmail.com>
> wrote:
>
> > What kind of security? If it's a file-open password then you can't get
> > any information about it (at least in any Adobe apps), until you
> > provide the password.
> >
> >
> > On Fri, Jun 20, 2014 at 2:39 PM, John Milne <JM...@phlexglobal.com>
> > wrote:
> >
> > > Hi,
> > >
> > >
> > >
> > > I have a number of PDF’s with various levels of security and need to
> > > be able to get a page count from them.
> > >
> > > The getNumberOfPages call fails to return a value with a document
> > > that is secured, while Adobe reader and windows preview are able to
> > > get the page count.
> > >
> > >
> > >
> > > [image: cid:image001.jpg@01CF8C8B.EAAF6620]
> > >
> > >
> > >
> > > PDDocument doc = PDDocument.load(new File(args[0]));
> > >
> > > int count = doc.getNumberOfPages();
> > >
> > >
> > >
> > > Does anyone have any thoughts as to why and how I can get a page count?
> > >
> > >
> > >
> > > Regards
> > >
> > >
> > >
> > > John
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > [image: Description: Phlex-small-png.png]
> > >
> > > *John Milne*, Analyst Programmer
> > > *T:* +44 (0)1494 720420  *F*: +44 (0)1494 720430
> > >
> > > *E:* jmilne@phlexglobal.com
> > >
> > > *W:*www.phlexglobal.com
> > >
> > >
> > >
> > > *Phlexglobal are worldwide leaders and specialists in the provision
> > > of local & global, technology enabled TMF document management
> > > solutions and support services.*
> > >
> > > The information in this E-mail and any attachments to it are
> > > confidential in every way and for the sole view of the addressee. If
> > > you have received it in error, please accept our apologies and delete
> it from your system.
> > > Thank you. | Any opinions expressed in this message or its
> > > attachments
> > are
> > > those of the author and are not necessarily those of Phlexglobal
> > > Ltd, who disclaim all responsibility and accept no liability for the
> > > consequences
> > of
> > > anyone acting on the information contained.
> > >
> > > Phlexglobal Ltd is a limited company registered in England and Wales
> > under
> > > company number 3544670 | VAT No. 108 216 051 | Registered address at
> > > Mandeville House, 62 The Broadway, Amersham, Bucks HP7 0HJ, UK
> > >
> > >
> > >
> >
>

RE: Get page count from encrypted document

Posted by John Milne <JM...@phlexglobal.com>.
One last question for someone.
Why do we need to decrypt the PDF to simply get the page count?

Thanks

John

-----Original Message-----
From: John Milne [mailto:JMilne@phlexglobal.com] 
Sent: 20 June 2014 14:43
To: users@pdfbox.apache.org
Subject: RE: Get page count from encrypted document

Thanks Dave,

That appears to do the trick.

Best regards

John

-----Original Message-----
From: Dave Smith [mailto:dave.smith@candata.com]
Sent: 20 June 2014 14:09
To: users@pdfbox.apache.org
Subject: Re: Get page count from encrypted document

After you load the document

if(document.isEncrypted())
            {
                document.openProtection(new StandardDecryptionMaterial(""));
            }

In the "" enter the password if required.




On Fri, Jun 20, 2014 at 9:04 AM, Gilad Denneboom <gi...@gmail.com>
wrote:

> What kind of security? If it's a file-open password then you can't get 
> any information about it (at least in any Adobe apps), until you 
> provide the password.
>
>
> On Fri, Jun 20, 2014 at 2:39 PM, John Milne <JM...@phlexglobal.com>
> wrote:
>
> > Hi,
> >
> >
> >
> > I have a number of PDF’s with various levels of security and need to 
> > be able to get a page count from them.
> >
> > The getNumberOfPages call fails to return a value with a document 
> > that is secured, while Adobe reader and windows preview are able to 
> > get the page count.
> >
> >
> >
> > [image: cid:image001.jpg@01CF8C8B.EAAF6620]
> >
> >
> >
> > PDDocument doc = PDDocument.load(new File(args[0]));
> >
> > int count = doc.getNumberOfPages();
> >
> >
> >
> > Does anyone have any thoughts as to why and how I can get a page count?
> >
> >
> >
> > Regards
> >
> >
> >
> > John
> >
> >
> >
> >
> >
> >
> >
> > [image: Description: Phlex-small-png.png]
> >
> > *John Milne*, Analyst Programmer
> > *T:* +44 (0)1494 720420  *F*: +44 (0)1494 720430
> >
> > *E:* jmilne@phlexglobal.com
> >
> > *W:*www.phlexglobal.com
> >
> >
> >
> > *Phlexglobal are worldwide leaders and specialists in the provision 
> > of local & global, technology enabled TMF document management 
> > solutions and support services.*
> >
> > The information in this E-mail and any attachments to it are 
> > confidential in every way and for the sole view of the addressee. If 
> > you have received it in error, please accept our apologies and delete it from your system.
> > Thank you. | Any opinions expressed in this message or its 
> > attachments
> are
> > those of the author and are not necessarily those of Phlexglobal 
> > Ltd, who disclaim all responsibility and accept no liability for the 
> > consequences
> of
> > anyone acting on the information contained.
> >
> > Phlexglobal Ltd is a limited company registered in England and Wales
> under
> > company number 3544670 | VAT No. 108 216 051 | Registered address at 
> > Mandeville House, 62 The Broadway, Amersham, Bucks HP7 0HJ, UK
> >
> >
> >
>

RE: Get page count from encrypted document

Posted by John Milne <JM...@phlexglobal.com>.
Thanks Dave,

That appears to do the trick.

Best regards

John

-----Original Message-----
From: Dave Smith [mailto:dave.smith@candata.com] 
Sent: 20 June 2014 14:09
To: users@pdfbox.apache.org
Subject: Re: Get page count from encrypted document

After you load the document

if(document.isEncrypted())
            {
                document.openProtection(new StandardDecryptionMaterial(""));
            }

In the "" enter the password if required.




On Fri, Jun 20, 2014 at 9:04 AM, Gilad Denneboom <gi...@gmail.com>
wrote:

> What kind of security? If it's a file-open password then you can't get 
> any information about it (at least in any Adobe apps), until you 
> provide the password.
>
>
> On Fri, Jun 20, 2014 at 2:39 PM, John Milne <JM...@phlexglobal.com>
> wrote:
>
> > Hi,
> >
> >
> >
> > I have a number of PDF’s with various levels of security and need to 
> > be able to get a page count from them.
> >
> > The getNumberOfPages call fails to return a value with a document 
> > that is secured, while Adobe reader and windows preview are able to 
> > get the page count.
> >
> >
> >
> > [image: cid:image001.jpg@01CF8C8B.EAAF6620]
> >
> >
> >
> > PDDocument doc = PDDocument.load(new File(args[0]));
> >
> > int count = doc.getNumberOfPages();
> >
> >
> >
> > Does anyone have any thoughts as to why and how I can get a page count?
> >
> >
> >
> > Regards
> >
> >
> >
> > John
> >
> >
> >
> >
> >
> >
> >
> > [image: Description: Phlex-small-png.png]
> >
> > *John Milne*, Analyst Programmer
> > *T:* +44 (0)1494 720420  *F*: +44 (0)1494 720430
> >
> > *E:* jmilne@phlexglobal.com
> >
> > *W:*www.phlexglobal.com
> >
> >
> >
> > *Phlexglobal are worldwide leaders and specialists in the provision 
> > of local & global, technology enabled TMF document management 
> > solutions and support services.*
> >
> > The information in this E-mail and any attachments to it are 
> > confidential in every way and for the sole view of the addressee. If 
> > you have received it in error, please accept our apologies and delete it from your system.
> > Thank you. | Any opinions expressed in this message or its 
> > attachments
> are
> > those of the author and are not necessarily those of Phlexglobal 
> > Ltd, who disclaim all responsibility and accept no liability for the 
> > consequences
> of
> > anyone acting on the information contained.
> >
> > Phlexglobal Ltd is a limited company registered in England and Wales
> under
> > company number 3544670 | VAT No. 108 216 051 | Registered address at 
> > Mandeville House, 62 The Broadway, Amersham, Bucks HP7 0HJ, UK
> >
> >
> >
>

Re: Get page count from encrypted document

Posted by Dave Smith <da...@candata.com>.
After you load the document

if(document.isEncrypted())
            {
                document.openProtection(new StandardDecryptionMaterial(""));
            }

In the "" enter the password if required.




On Fri, Jun 20, 2014 at 9:04 AM, Gilad Denneboom <gi...@gmail.com>
wrote:

> What kind of security? If it's a file-open password then you can't get any
> information about it (at least in any Adobe apps), until you provide the
> password.
>
>
> On Fri, Jun 20, 2014 at 2:39 PM, John Milne <JM...@phlexglobal.com>
> wrote:
>
> > Hi,
> >
> >
> >
> > I have a number of PDF’s with various levels of security and need to be
> > able to get a page count from them.
> >
> > The getNumberOfPages call fails to return a value with a document that is
> > secured, while Adobe reader and windows preview are able to get the page
> > count.
> >
> >
> >
> > [image: cid:image001.jpg@01CF8C8B.EAAF6620]
> >
> >
> >
> > PDDocument doc = PDDocument.load(new File(args[0]));
> >
> > int count = doc.getNumberOfPages();
> >
> >
> >
> > Does anyone have any thoughts as to why and how I can get a page count?
> >
> >
> >
> > Regards
> >
> >
> >
> > John
> >
> >
> >
> >
> >
> >
> >
> > [image: Description: Phlex-small-png.png]
> >
> > *John Milne*, Analyst Programmer
> > *T:* +44 (0)1494 720420  *F*: +44 (0)1494 720430
> >
> > *E:* jmilne@phlexglobal.com
> >
> > *W:*www.phlexglobal.com
> >
> >
> >
> > *Phlexglobal are worldwide leaders and specialists in the provision of
> > local & global, technology enabled TMF document management solutions and
> > support services.*
> >
> > The information in this E-mail and any attachments to it are confidential
> > in every way and for the sole view of the addressee. If you have received
> > it in error, please accept our apologies and delete it from your system.
> > Thank you. | Any opinions expressed in this message or its attachments
> are
> > those of the author and are not necessarily those of Phlexglobal Ltd, who
> > disclaim all responsibility and accept no liability for the consequences
> of
> > anyone acting on the information contained.
> >
> > Phlexglobal Ltd is a limited company registered in England and Wales
> under
> > company number 3544670 | VAT No. 108 216 051 | Registered address at
> > Mandeville House, 62 The Broadway, Amersham, Bucks HP7 0HJ, UK
> >
> >
> >
>

Re: Get page count from encrypted document

Posted by Gilad Denneboom <gi...@gmail.com>.
What kind of security? If it's a file-open password then you can't get any
information about it (at least in any Adobe apps), until you provide the
password.


On Fri, Jun 20, 2014 at 2:39 PM, John Milne <JM...@phlexglobal.com> wrote:

> Hi,
>
>
>
> I have a number of PDF’s with various levels of security and need to be
> able to get a page count from them.
>
> The getNumberOfPages call fails to return a value with a document that is
> secured, while Adobe reader and windows preview are able to get the page
> count.
>
>
>
> [image: cid:image001.jpg@01CF8C8B.EAAF6620]
>
>
>
> PDDocument doc = PDDocument.load(new File(args[0]));
>
> int count = doc.getNumberOfPages();
>
>
>
> Does anyone have any thoughts as to why and how I can get a page count?
>
>
>
> Regards
>
>
>
> John
>
>
>
>
>
>
>
> [image: Description: Phlex-small-png.png]
>
> *John Milne*, Analyst Programmer
> *T:* +44 (0)1494 720420  *F*: +44 (0)1494 720430
>
> *E:* jmilne@phlexglobal.com
>
> *W:*www.phlexglobal.com
>
>
>
> *Phlexglobal are worldwide leaders and specialists in the provision of
> local & global, technology enabled TMF document management solutions and
> support services.*
>
> The information in this E-mail and any attachments to it are confidential
> in every way and for the sole view of the addressee. If you have received
> it in error, please accept our apologies and delete it from your system.
> Thank you. | Any opinions expressed in this message or its attachments are
> those of the author and are not necessarily those of Phlexglobal Ltd, who
> disclaim all responsibility and accept no liability for the consequences of
> anyone acting on the information contained.
>
> Phlexglobal Ltd is a limited company registered in England and Wales under
> company number 3544670 | VAT No. 108 216 051 | Registered address at
> Mandeville House, 62 The Broadway, Amersham, Bucks HP7 0HJ, UK
>
>
>