How to know whether file is document file or not and page count

How can i know whether the file is document file
Eg: File file = new File("test.text"); 
        File file = new File("test.doc"); 
        File file = new File("test.pdf");   etc should return true
File file = new File("test.exe"); 
       File file = new File("test.dat");  etc should return false
and if it is true i should get the page count for example if pdf or doc file is containinf 100 pages
i should get the value 100 is there any way to acheive this in java pls give some idea or example code
Regards

To get the number of pages you would need to write or find an existing Java API that can parse the proprietary formats of each type. And some formats do not really have pages. For instance, the number of pages of a .txt (often opened by Notepad by default) file would depend on your page length which is not generally stored in the file it is set by the tool you use to read the file.

Similar Messages

  • How to know whether the javascript is disabled or not while loading the jsp

    Hi,
    My query is like how to know whether the javascript is disabled or not while loading the Application main JSP in Mozilla browser.
    I want some Java code or JavaScript code.

    To the point, just let JS fire a specific HTTP request inside the same session.
    This can be done in several ways. 1) Create a hidden <img> element and set the `src` attribute so that it will request a (fake) image from the server. The server just have to intercept on this specific request. 2) Fire an ajaxical request and let the server intercept on it. You can use a Filter for this which sets a token in the session scope to inform that the client has JS enabled.

  • How to know whether the phone is replaced or not?

    Dear All,
    Please help in how to know whether Iphone 5 is replaced or not? I came to know that on replacement, imei number gets changed. please make me aware.

    Nobody here can make you aware.  You need to contact Apple directly.

  • How to know whether my phone is unlocked or not

    how to know whether my iphone is unlocked or not.

    You don't know if you bought an unlocked iphone or not?
    What did you ask for?
    What does your reciept say?

  • How to know whether file is modified or metadata from SharePoint Document Library version history

    I have uploaded a document in document library. I am writing code to retrieve the items from the library only if document is modified, not the metadata.
    So if for an item only metadata is modified then it should not come, if document is modified then it should come. I tried from version history but it doesnt work. Any idea?
    Mark ANSWER if this reply resolves your query, If helpful then VOTE HELPFUL
    INSQLSERVER.COM
    Mohammad Nizamuddin

    Each file has an associated SPListItem which contains the metadata. See if the SPFile.TimeLastModified reflects the file and not the metadata.
    http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfile.timelastmodified.aspx
    Dimitri Ayrapetov (MCSE: SharePoint)

  • How can I open files from Appleworks and Pages 4.3 in Mavericks?

    I have documents I created in Appleworks and Pages 4.3 that I can't open in Pages 5.1 using Mavericks.  How can I open those files?

    Mavericks is the Operating System (OSX).
    LibreOffice [free] may be able to open your AppleWorks files but probably not perfectly.
    Pages '09 should still be in your Applications/iWork folder.
    Pages 5 can open Pages '09 files but will alter/damage them.
    Peter

  • How to know whether tomcat server is up or not..?

    I have developed a java webstart application.In that,I need to include a component in a frame that shows whether the appplication is connected to the server(tomcat) or not.If it is connected to server,then a green light is up,if not red light is up.It should show the connection status althrough the application.I browsed through the apache documentation of Catalina class, http://tomcat.apache.org/tomcat-4.1-oc/catalina/docs/api/org/apache/catalina/startup/Catalina.html ,thinking that it could help me out.But I couldn't find it useful.So,I need a way to know whether the application is connected to server or not.Is there anyway to do it?Thanks in advance..!

    hell2heaven wrote:
    Yes I need both first and second case,there exists some server listening on a particular port and he can send some request and get some response from it.Well, the second implies the first, so unless you're interested in "The port is active, but the server isn't running properly," testing the second is sufficient--the first won't provide any additional information.
    Here my server is apache tomcat and it is running on port 8085.Actually,what happens in the application is when user inputs data via text field,a connection is opened to the appropriate servlet and object is passed to the servlet through that established connection.then servlet returns another object reporting the result,what happened on the server side.I want user to feel sure that he can send data to the servlet running on tomcat successfully.Am I clear enough now..?
    Not really.
    And if you're saying, "I want to see if the server is running before the user sends a request," that's pointless. Just send the request. If it succeeds, the server is running. If it fails, the server is not running or is unreachable or had some error. If you test first and it comes back good, the server can still go down between your test and the "real" request.

  • How to know Whether the FI document is parked or completed in abap code

    Hi..
    In our company scenario workflow will be triggered only when document is 'completed'. But some times end users pressing only 'parking'. Then Documents are not comoing into workflow.
    So my requirement is
    1. Whether to Deactivate the 'Save as Parked' from F-65,F5V0,FBV0,MIR7.
    OR
    2.Stopping the user by pressing the 'Save as Parked' by populating error messages through Valiations/Subsitutions/Enhancements.
    Thanks in Advance.
    Mahender.

    Hi,
    you are saying that the workflow will get trigerred only when document is posted.
    Then try to create a new workflow which will get triggerred during parking.
    You can go through the following links which will give you an idea how to start developing a new workflow.
    Following are the links for a similar development which i got 1 year before.
    [USer Exit / Badi F-47  & F-59;
    [send message to sbwp;
    [Workflow in Process;
    [Set the Automatic Customisation & Prefix numbers in SWU3 in Production ?;
    all the best.
    Regards
    Sajid.

  • How to know whether all Idocs sent perfectly or not to target System

    Hi All,
    We are sending the Material Master Idocs via XI and to WMS File system ( Idoc-XIFile)
    How can a business user confirm that all the sent Idocs are reached to WMS by End of the day.
    Is there any way to match or any report kind of thing for this please
    Regards
    Vamsi

    HI vamsi,
    Following  is the solution that we are using >
    1. There is a separate interface ( file to idoc )that runs at the end of the business day..
    This interface will pick up a file ( from say ur WMS system) and post an idoc STATUS.SYSTAT01
    the file in this case will have the idoc number of the material idoc and the status( say 11 for OK ) and the same will be mapped to idoc.
    This idoc in turn will change the status of the material idoc from 03 to 11 . Then a filter can be made on this to find out which idocs did not reach status 11..
    however here there are chances that this ack interface can go in error as well
    2.  Or u can have a separate interface ( file to Proxy ) ..here the difference would be that single file will have all the idoc numbers that were received during that day and then in the proxy u can write abap code to change the status of those idocs to say status OK
    Edited by: Tarang Shah on Feb 6, 2010 8:05 PM
    Edited by: Tarang Shah on Feb 6, 2010 8:06 PM
    Edited by: Tarang Shah on Feb 6, 2010 8:14 PM

  • How to know whether Caps Lock Is On or Not

    Hi
    My application is in Foms 6i and oracle 9i. In logon screen , i want show toltip
    if caps lock is on stating that 'Caps lock is on.'. It should occur at the start of the logon form without entering any data( or after filling Userid an also do)
    How do I implement this.
    Regards,
    Subhash

    Also see
    Find whether the caps lock is on or off

  • How to know whether a connection leak occured in weblogic8.1

    How to Know whether Conenction Leak has Occured or Not ??..Where does the WeblogicServer8.1 print the STACK TRACE if connection Leak has occured ? or does it maintain a LOG FILE , where any entries can be seen................

    To turn on Debug flags add these to the startup scripts.
    -Dweblogic.Debug=weblogic.JDBCConn="true",weblogic.JTAJDBC="true"
    Essentially, you will need to edit the config.xml file (when the server is down) and add the proprty to the ConnectionPool definition:
    http://e-docs.bea.com/wls/docs61/config_xml/mbeans.html
    ConnLeakProfilingEnabled="true"
    Thanks and regards,
    Pazhanikanthan. P

  • How to know whether the current database is using a password file or not?

    How to know whether the current database is using a password file or not?

    The remote_password_file is the parameter that determines if you can use or not a password file. The values this parameter can have are NONE, SHARED, EXCLUSIVE. It is pretty obvious, if it is set to either SHARED or EXCLUSIVE the oracle instance has enabled the access through a password file for the SYSDBA and SYSOPER roles.
    ~ Madrid

  • How to know whether a file is opened  or not ?

    Hi all,
    How to know whether a file is opened by its editor or not ? File may be any of the type.

    There are platform-dependent commands that tell whether a file (or directory, port etc.) is used by which processes.
    [oracle@izsak ~]$ fuser .
    .:                    9299c
    [oracle@izsak ~]$ ps -p  9299 -f
    UID        PID  PPID  C STIME TTY          TIME CMD
    oracle    9299  9298  0 Apr25 pts/0    00:00:00 -bash
    [oracle@izsak ~]$ ls -l $fn
    -rw-r-----  1 oracle oinstall 111215876 Apr 25 19:05 /opt/oracle/product/AS/10g/R2/opmn/logs/OC4J~ebank~default_island~1
    [oracle@izsak ~]$ fuser $fn
    /opt/oracle/product/AS/10g/R2/opmn/logs/OC4J~ebank~default_island~1:  3746  3747  3748  3749  3750  3751  3752  3753  3754  3755  3756  3758  3761  3762  3765  3767  3769  3770  3771 18638 21605 21743 21744 21745 22140 22143
    [oracle@izsak ~]$ ps -p 3746 -f
    UID        PID  PPID  C STIME TTY          TIME CMD
    oracle    3746 26427  0 Apr23 ?        00:00:01 /opt/oracle/product/AS/10g/R2/jdk/bin/java -server -Djava.security.policy=/opt...

  • How to know whether a method is thread-safe through the java-doc?

    In some book, it says that SAXParserFactory.newSAXParser() is thread-safe,but in the java-doc,it doesn't say that.
    newSAXParser
    public abstract SAXParser newSAXParser()
    throws ParserConfigurationException,
    SAXExceptionCreates a new instance of a SAXParser using the currently configured factory parameters.
    Returns:
    A new instance of a SAXParser.
    Throws:
    ParserConfigurationException - if a parser cannot be created which satisfies the requested configuration.
    SAXException - for SAX errors.
    I want to know, how to know whether a method is thread-safe?

    System.out is a PrintStream object. None of the methods there use the synchronized modifier, but if you look in the source code, you will find out it is thread-safe, because it will use synchronized blocks whenever it writes some text.
    The source code is in the src.jar file which you can extract.
    I didn't find any comments about that PrintStream is thread-safe in the API.

  • How to know whether a vacation rule is set for a user

    Hi,
    How to know whether a vacation rule is set for a user or not in the BPM process. Can anyone help me in this.
    Thanks,

    In Linux a user has to have read permission on a file to even see that it exists. As a result, if a user (or a group to which they belong) doesn't have read access to the file File.exists() will return false. Windows which doesn't have as tightly controlled access to files will admit that a file exists whether it can be read or not.
    PS.
    This is proof that I should never answer a question off the top of my head when I haven't had my red bull yet. This is wrong. You will be able to see it if you have read and execute on the directory.
    thumps self in head
    Message was edited by:
    puckstopper31

Maybe you are looking for

  • Issues with using leapord as a gateway.

    I performed a clean install of mac osx server 10.5.1 on our new xserve. I then used the gateway setup assistant to set the xserve up as a router. Ethernet 1 has a static IP which is connected to our dsl line. Ethernet 2 is connected to a switch with

  • Locale layout

    Hi, I am localizing a big JSF web application. the desired locale is fa_IR which is farsi for Iran. Iranian write from right to left and the local web applications are all from right to left. it means that when a convertor button is clicked , everyth

  • Poor Customer Service and a Rude Associate

    My wife's iPhone 5 recently stopped receiving cellular signal. We took it to the verizon store and they were unable to fix it. because it was less than a year old and broke due to no fault of our own the store said that they would send us a new iPhon

  • Integration from CRM on Demand

    Hi All, Is it possible to send integration request from siebel crm on demand.If so, How do we do it. I want to integrate CRM on demand with peoplesoft system.Is there any way for the same. Any help is appreciated. Thanks in advance. Vamsi.

  • How do I restore my macbook pro camera after installing mavericks?

    I am trying to fix various loss of peripherals following my upgrade to Mavericks. Does anyone know an easy way to restore the computer's camera?