pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Smith <dave.sm...@candata.com>
Subject Re: Get page count from encrypted document
Date Fri, 20 Jun 2014 13:08:44 GMT
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 <JMilne@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
> >
> >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message