Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / November 2007

Tip: Looking for answers? Try searching our database.

PDF Processing

Thread view: 
imranbaseer - 15 Nov 2007 13:15 GMT
Hi members,
    I am PDF Processing...When i tried to execute the following code ,it
thows NULLPOINTER exception...The exception occured at this line System.out.
println(view.getProperty("Default_Zoom_Type"));..... I dont know how to solve
tis.....Please refer the following code and give me the solution for this.....

                   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.
Andrew Thompson - 15 Nov 2007 14:30 GMT
...
>     I am PDF Processing...When i tried to execute the following code ,it
>thows NULLPOINTER exception...

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.

Signature

Andrew Thompson
http://www.athompson.info/andrew/

imranbaseer - 16 Nov 2007 10:47 GMT
OUTPUT FOR THAT PROGRAM:::
10
java.lang.NullPointerException
    at java.util.Hashtable.put(Unknown Source)
    at com.adobe.acrobat.gui.ReaderPrefs.getClientProperties(ReaderPrefs.java:
1063)
    at com.adobe.acrobat.Viewer.getProperties(Viewer.java:1191)
    at com.adobe.acrobat.Viewer.getProperty(Viewer.java:1186)
    at PdfPack.PdfCheck1.main(PdfCheck1.java:112)
Exception in thread "main"

>...
>>     I am PDF Processing...When i tried to execute the following code ,it
[quoted text clipped - 36 lines]
>Please copy/paste the stacktrace.  As well as the
>output you are seeing.
Andrew Thompson - 16 Nov 2007 11:04 GMT
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..)

Signature

Andrew Thompson
http://www.athompson.info/andrew/

imranbaseer - 16 Nov 2007 11:16 GMT
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....

>Please post comments 'in-line'  as I do, rather than top-posting them...
>
[quoted text clipped - 13 lines]
>(I am bowing out of this thread, for the moment.  Hopefully
>one of the Java gurus will spot the problem..)
Ed Webb - 16 Nov 2007 12:06 GMT
> 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 good luck figuring it out on your own.
Jeff Higgins - 16 Nov 2007 12:59 GMT
haha 1 qwik sear in rt 4um bring ans qwik haha yahoo
> 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
[quoted text clipped - 18 lines]
>>(I am bowing out of this thread, for the moment.  Hopefully
>>one of the Java gurus will spot the problem..)
Jeff Higgins - 16 Nov 2007 13:06 GMT
Andrew Thompson - 16 Nov 2007 13:20 GMT
>....dont waster ur time with me k.

Is that a question?  OK, happy to 'comply'.

>...bye....

Bye-bye.  *Plonk.*

Signature

Andrew Thompson
http://www.athompson.info/andrew/

Thomas A. Russ - 17 Nov 2007 02:10 GMT
> 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.

Signature

Thomas A. Russ,  USC/Information Sciences Institute

Tom N - 17 Nov 2007 02:31 GMT
> 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

>>Please post comments 'in-line'  as I do, rather than top-posting
>>them...
[quoted text clipped - 8 lines]
>>>     at
>>>     com.adobe.acrobat.gui.ReaderPrefs.getClientProperties
(ReaderPrefs
>>>     .java:
>>>1063)
[quoted text clipped - 4 lines]
>>(I am bowing out of this thread, for the moment.  Hopefully
>>one of the Java gurus will spot the problem..)
imranbaseer - 16 Nov 2007 10:49 GMT
10 is the number of pages of the pdf file.....
nullpointer exception in getproperty() method........

>...
>>     I am PDF Processing...When i tried to execute the following code ,it
[quoted text clipped - 36 lines]
>Please copy/paste the stacktrace.  As well as the
>output you are seeing.
Roedy Green - 16 Nov 2007 01:20 GMT
>        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.
Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.