Thank in advance...
import com.adobe.acrobat.Viewer;
import java.io.*;
public class PdfCheck1{
public static void main(String ar[])throws Exception{
Viewer view = new Viewer();
InputStream input = new FileInputStream("E:\\Imran\\PRO\\PDF\\
ListofPages.
pdf");
view.setDocumentInputStream(input);
System.out.println(view.getPageCount());
System.out.println(view.getProperty("Default_Zoom_Type"));
}
}
with regards,
J.Imran Baseer.
Did you mean a NullPointerException?
If so,
a) Please don't SHOUT at us.
and
b) Please be specific.
Programming is hard. Debugging is harder.
Debugging an application remotely, where the
exceptions and errors are being 'paraphrased' is
even harder again.
Don't make it hard on us (please).
>...The exception occured at this line System.out.
>println(view.getProperty("Default_Zoom_Type"));
I would have guessed that if any property either does not
exist, or is not defined for that PDF file, it returns null.
OTOH, that does not explain the exception, since the output
should simply have been
null
like this line would print..
System.out.println((String)null);
Indeed, the NPE suggests the viewer itself is null, but if
so, the page count could not have been referenced on the
previous line*.
*
> System.out.println(view.getPageCount());
Which leads me to..
Please copy/paste the stacktrace. As well as the
output you are seeing.
--
Andrew Thompson
http://www.athompson.info/andrew/
Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-gui/200711/1
> view.setDocumentInputStream(input);
> System.out.println(view.getPageCount());
> System.out.println(view.getProperty("Default_Zoom_Type"));
I think it unlikely you safely managed to get view.getPageCount() and
then die on view.getProperty.
If view were null, the error would come on view.getPage(Count())
if the property were null, you would simply see the word "null", not a
NullPointerException. Please add some debug code and check the line
number.
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
Andrew Thompson wrote:
>...
--
Andrew Thompson wrote:
>...
--
Please post comments 'in-line' as I do, rather than top-posting them...
>OUTPUT FOR THAT PROGRAM:::
OK. No need to SHOUT!
>>Please copy/paste the stacktrace. As well as the
>>output you are seeing.
>10
>java.lang.NullPointerException
> at java.util.Hashtable.put(Unknown Source)
> at com.adobe.acrobat.gui.ReaderPrefs.getClientProperties(ReaderPrefs.java:
>1063)
Huhh.. That is odd, I thought HashTable was able to
accept 'null' values.
(I am bowing out of this thread, for the moment. Hopefully
one of the Java gurus will spot the problem..)
--
Andrew Thompson
http://www.athompson.info/andrew/
Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-gui/200711/1
Andrew Thompson wrote:
>Please post comments 'in-line' as I do, rather than top-posting them...
>
>>OUTPUT FOR THAT PROGRAM:::
>
>OK. No need to SHOUT!
>
>>>Please copy/paste the stacktrace. As well as the
>>>output you are seeing.
>[quoted text clipped - 3 lines]
>> at com.adobe.acrobat.gui.ReaderPrefs.getClientProperties(ReaderPrefs.java:
>>1063)
>
>Huhh.. That is odd, I thought HashTable was able to
>accept 'null' values.
>
>(I am bowing out of this thread, for the moment. Hopefully
>one of the Java gurus will spot the problem..)
>
--
Well good luck figuring it out on your own.
Is that a question? OK, happy to 'comply'.
>...bye....
Bye-bye. *Plonk.*
--
Andrew Thompson
http://www.athompson.info/andrew/
Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-gui/200711/1
> hey....coooool......i need answer,tats y i sent mutilple threads... If
> t s not possible tell frankly........i tink u r weak n java.....dont
> waster ur time with me k....bye....
I think you'll find something helpful here...
http://tinyurl.com/34ugs8
> hey....coooool......i need answer,tats y i sent mutilple threads... If t s
> not possible tell frankly........i tink u r weak n java.....dont waster ur
> time with me k....bye....
Well, then I suggest you hire a consultant to give you those answers.
Posting to a free newsgroup, where the answers you get are from
volunteers, and then complaining about it is just bad manners.
--
Thomas A. Russ, USC/Information Sciences Institute