Test.doc to test.pdf using jakarta tomcat POI

Hi
I need to convert my test.doc file in to
test.pdf.I found a API jakarta tomcat POI project handling file systems
1) is it possible to do that?(test.doc convert to test.pdf)
2) do i have to use POIFS API or HSSF API HPSF API?which API
3) do i have to use a jar file which i can add to class path?
4) Is there any place where i can see a simple example for file type convertion
Thanks for your help
Suda

This should help some.
This code converts word to text.
Did it two days ago. No shizerat.
You'll need to download the hdf code from
the "scratch section" of the poi site- which is how I got it to work.
import java.io.*;
import org.apache.poi.hpsf.*;
import org.apache.poi.poifs.eventfilesystem.*;
public class PoiTest {
public static void main(String[] args)
throws IOException
final String filename = args[0];
POIFSReader r = new POIFSReader();
r.registerListener(new MyPOIFSReaderListener(),
"\005SummaryInformation");
r.read(new FileInputStream(filename));
// create temp file of content
String curDir=System.getProperty("user.dir");
String pathSep=System.getProperty("file.separator");
String tempF=curDir+pathSep+"temp.txt";
testDoc td=new testDoc(filename, tempF);
td.getText();
} // end of class PoiTest
-----------Shizzy code, I know - but it worked for me----
----this is my docTest class I wrote to make it easy--
to get word into a text file---------------------------------------
import org.apache.poi.hdf.extractor.util.*;
import org.apache.poi.hdf.extractor.data.*;
import org.apache.poi.hdf.extractor.*;
import java.util.*;
import java.io.*;
import javax.swing.*;
import java.awt.*;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.poifs.filesystem.POIFSDocument;
import org.apache.poi.poifs.filesystem.DocumentEntry;
import org.apache.poi.util.LittleEndian;
class testDoc {
String origFileName;
String tempFile;
WordDocument wd;
testDoc(String origFileName, String tempFile) {
this.tempFile=tempFile;
this.origFileName=origFileName;
public void getText() {
try {
wd = new WordDocument(origFileName);
Writer out = new BufferedWriter(new FileWriter(tempFile));
wd.writeAllText(out);
out.flush();
out.close();
catch (Exception eN) {
System.out.println("Error reading document:"+origFileName+"\n"+eN.toString());
} // end for getText
} // end of class

Similar Messages

  • .doc to pdf using jakarta tomcat POI

    Hi
    I need to convert my test.doc file in to
    test.pdf.I found a API jakarta tomcat POI project handling file systems
    1) is it possible to do that?(test.doc convert to test.pdf)
    2) do i have to use POIFS API or HSSF API HPSF API?which API
    3) do i have to use a jar file which i can add to class path?
    4) Is there place where i can see a simple example for file type convertion
    Thanks
    Suda

    Asking the same question in the same way with a different subject will not get it
    answered any faster...
    http://forum.java.sun.com/thread.jsp?forum=31&thread=330932&tstart=0&trange=15
    As a matter of fact, I HATE when people do that....
    If anyone knew the answer and wanted to get the duke dollars (if any)
    (suggest you offer some)
    then they would answer... the FIRST time.
    The answer to your question seems to be:
    1) DO SOME RESEARCH!
    2) RTFM!
    3) WRITE SOME TESTS
    4) READ/STUDY THE API

  • Should I install Apache Web server to use Jakarta Tomcat Servlet engine?

    Hello,
    I have some problems and now have a question:
    Should I install Apache Web server to use Jakarta Tomcat Servlet engine?
    JTK home page is available via http://localhost:8080
    Tomcat ver 3.1.3
    Thanks.

    No, you don't need to run Apache webserver (httpd) to run Tomcat. Tomcat by default runs on port 8080, but you can set it to any port, including 80, if you have permission to do so (on *nix systems, you need root permissions to run services on any port below 1024).
    Tomcat is a webserver as well, just one that includes a servlet container and JSP processor. So it will serve your html files, images, etc (aka static content), just as well as Apache httpd, in addition to being able to run servlets and JSPs.
    Apache httpd has more options for serving static content than Tomcat, so many people prefer to use it as their main webserver and only use Tomcat as a sort of "plugin" to handle servlets and JSPs. This can be achieved through a connector. Instructions on how to set this up are on the Jakarta website.
    So you could use Apache and Tomcat combined, next to each other, or totally separated. In many cases, just Tomcat will do.

  • Please help: Error using Jakarta-tomcat 4.0 beta

    Hi all,
    Could you please help me with a following error?
    I am trying to start Jakarta-tomcat 4.0:
    C:\ Jakarta-tomcat 4.0\bin\startup.bat and I receive the error:
    Catalina.start: LifecycleException: null.open: java.net.BindException: Address
    already in use: JVM_Bind
    LifecycleException: null.open: java.net.BindException: Address already in use:
    JVM_Bind
    at org.apache.catalina.connector.http.HttpConnector.initialize(Unknown S
    ource)
    at org.apache.catalina.core.StandardService.initialize(Unknown Source)
    at org.apache.catalina.core.StandardServer.initialize(Unknown Source)
    at org.apache.catalina.startup.Catalina.start(Unknown Source)
    at org.apache.catalina.startup.Catalina.execute(Unknown Source)
    at org.apache.catalina.startup.Catalina.process(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:30)
    at sun.reflect.InflatableMethodAccessorImpl.invoke(InflatableMethodAcces
    sorImpl.java:48)
    at java.lang.reflect.Method.invoke(Method.java:306)
    at org.apache.catalina.startup.Bootstrap.main(Unknown Source)
    ----- Root Cause -----
    java.net.BindException: Address already in use: JVM_Bind
    at java.net.PlainSocketImpl.socketBind(Native Method)
    at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:310)
    at java.net.ServerSocket.bind(ServerSocket.java:305)
    at java.net.ServerSocket.bind(ServerSocket.java:265)
    at java.net.ServerSocket.<init>(ServerSocket.java:201)
    at java.net.ServerSocket.<init>(ServerSocket.java:150)
    at org.apache.catalina.net.DefaultServerSocketFactory.createSocket(Unkno
    wn Source)
    at org.apache.catalina.connector.http.HttpConnector.open(Unknown Source)
    at org.apache.catalina.connector.http.HttpConnector.initialize(Unknown S
    ource)
    at org.apache.catalina.core.StandardService.initialize(Unknown Source)
    at org.apache.catalina.core.StandardServer.initialize(Unknown Source)
    at org.apache.catalina.startup.Catalina.start(Unknown Source)
    at org.apache.catalina.startup.Catalina.execute(Unknown Source)
    at org.apache.catalina.startup.Catalina.process(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:30)
    at sun.reflect.InflatableMethodAccessorImpl.invoke(InflatableMethodAcces
    sorImpl.java:48)
    at java.lang.reflect.Method.invoke(Method.java:306)
    at org.apache.catalina.startup.Bootstrap.main(Unknown Source)
    Thanks a lot
    Yahya

    please do not double post and please post your question to the appropriate forum.

  • Error using Jakarta-tomcat 4.0 beta

    Hi all,
    Could you please help me with a following error?
    I am trying to start Jakarta-tomcat 4.0:
    C:\ Jakarta-tomcat 4.0\bin\startup.bat and I receive the error:
    Catalina.start: LifecycleException: null.open: java.net.BindException: Address
    already in use: JVM_Bind
    LifecycleException: null.open: java.net.BindException: Address already in use:
    JVM_Bind
    at org.apache.catalina.connector.http.HttpConnector.initialize(Unknown S
    ource)
    at org.apache.catalina.core.StandardService.initialize(Unknown Source)
    at org.apache.catalina.core.StandardServer.initialize(Unknown Source)
    at org.apache.catalina.startup.Catalina.start(Unknown Source)
    at org.apache.catalina.startup.Catalina.execute(Unknown Source)
    at org.apache.catalina.startup.Catalina.process(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:30)
    at sun.reflect.InflatableMethodAccessorImpl.invoke(InflatableMethodAcces
    sorImpl.java:48)
    at java.lang.reflect.Method.invoke(Method.java:306)
    at org.apache.catalina.startup.Bootstrap.main(Unknown Source)
    ----- Root Cause -----
    java.net.BindException: Address already in use: JVM_Bind
    at java.net.PlainSocketImpl.socketBind(Native Method)
    at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:310)
    at java.net.ServerSocket.bind(ServerSocket.java:305)
    at java.net.ServerSocket.bind(ServerSocket.java:265)
    at java.net.ServerSocket.<init>(ServerSocket.java:201)
    at java.net.ServerSocket.<init>(ServerSocket.java:150)
    at org.apache.catalina.net.DefaultServerSocketFactory.createSocket(Unkno
    wn Source)
    at org.apache.catalina.connector.http.HttpConnector.open(Unknown Source)
    at org.apache.catalina.connector.http.HttpConnector.initialize(Unknown S
    ource)
    at org.apache.catalina.core.StandardService.initialize(Unknown Source)
    at org.apache.catalina.core.StandardServer.initialize(Unknown Source)
    at org.apache.catalina.startup.Catalina.start(Unknown Source)
    at org.apache.catalina.startup.Catalina.execute(Unknown Source)
    at org.apache.catalina.startup.Catalina.process(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:30)
    at sun.reflect.InflatableMethodAccessorImpl.invoke(InflatableMethodAcces
    sorImpl.java:48)
    at java.lang.reflect.Method.invoke(Method.java:306)
    at org.apache.catalina.startup.Bootstrap.main(Unknown Source)
    Thanks a lot
    Yahya

    I agree with DrClap, that beginning with Tomcat is tough. :) But still, the answer to your problem is right there before you. (But then again, it always is, and I never see the wood either.) :)
    LifecycleException: null.open: java.net.BindException: Address already in use: JVM_Bind
    I am not sure about the null.open part, which is a little bit irritating. But the address you are trying to bind your socket to, is already used by another Service. This might be the case if you have already a tomcat running, or if you have some other service installed that uses one of the ports you are attempting to use.
    Hope that helps
    rh

  • Converting .doc file to PDF using Word 2008 - does not convert as is..

    I am trying to convert a .doc file (Word 2008) to a PDF file.  I have tried using the save as function and the print function.  Both will work however everytime 2 things happen:
    1.  The PDF file splits into 2 files (the document is 20 pages long)
    2.  In one area of text, two words are overlapped (in the PDF version) but are not overlapped in the .doc version.
    How do I convert the .doc to a PDF with out these two items occuring?
    Thanks in advance for your help
    T.

    I do not think this is an app but rather a function of MS-Word, the very function that does not work with high fidelity on Mac.  Any document of substance (greater than 10,000 words, imbedded images, figures, tables, or high formatting) will not convert accurately to PDF on Macbook Pro. 
    Using newest MS Office with updated service pacs, and experienced users. This is a puzzling incompetency on the Apple team's side. And there have been no fixes.  One could argue this is a MS problem since the software is theirs.  Probably true, but the problem occurs on Mac platforms, not PC platforms.  Apple can drive improvements.  Not sure Apple customers can.

  • How to make a Word for Mac 2008 doc into a PDF using Acrobat Macintosh

    Any ideas how to turn a Word for Mac 2008 document into a PDF using Acrobat Pro?
    Thank you if you can help.

    In Word  2008 for Mac:
    go to Save As... from File menu.
    when window open click on Button show the current file type.
    when thi menu drops down you will see the following
    Choose PDF
    save.
    Then open up in Acrobat.

  • Converting Doc files to PDF using command line ?

    Hello,
    I need to automate the process of converting (in command line) word files to pdf.
    Is Acrobat distiller Server the right product ? or is there another product from Adobe that would allow me to reach this goal ?
    NB : currently using pdfcreator in command line but have some stability problems now...
    thanks a lot
    Florent

    Acrobat Distiller Server can only convert Postscript to PDF. You may look at this product:
    http://www.adobe.com/products/livecycle/pdfgenerator/

  • XSQL-003 Error with jakarta-tomcat-4.0.3

    I am trying to set up the XSQLServlet on JBuilder7 using jakarta-tomcat-4.0.3 as the development server.
    I downloaded and carefully follwed the installation instructions for Tomcat 3.1 and 3.2 although the bat files have changed considerably. Set classpath in setclasses.bat and prescribed in instructions. Setup a context in server.xml for /xsql and setup a web.xml file to map oracle-xsql-servlet to *.xsql. Also tried mapping to *.xsql in web.xml for my application, but I continue to get the XSQL-003 error; "failed to find XSQLConfig.xml in the server classpath". I checked the discussion forums and tried jarring the XSQLConfig.xml file and set that in the server CLASSPATH. Still no luck.
    My question: Are there any installation instructions for installing the XSQLServlet on Jakarta Tomcat 4.0.3?
    Tomcat can't find the XSQLConfig.xml file or there is some other problem that is throwing this exception.

    Hey man, i have the same problem, what should I do?
    I can`t define the classpath when I run the server as service, but it works when i run manually starup.bat, because there i have defined the classpath.
    Please, give me an advice
    Thanks...

  • Why when I am converting a word doc into a PDF are some of the pages moving around. It appears to be

    Why when I am converting a 50 page word doc into a PDF using Acrobat XI Pro the pages are moving around.
    It appears to be happening in the places where the previous page is not a complete full page, just a half page.
    It is moving these pages up into the previous half page, but it is only moving them several lines into that page
    Which has totally distored my e-book.
    It is attaching all my pattern sheets at the very end of the file okay, etc.

    Also, to be more sure you get in the PDF what you are seeing in WORD, go to the print menu and select the Adobe PDF printer, then go back to editing. The is a feature of almost all word processors to reflow the document for best results with the attached printer. It is also one of the problems of using WORD forms that such form designers miss. If you don't like the reflow, many the Adobe PDF printer your default and always print to Acrobat. If you want it to go to a printer, then print from Acrobat to that printer and it should remain intact. The other way to avoid the reflow is to use a layout program like Publisher or InDesign.

  • Jakarta-tomcat 4.0.3, web-application throws AccessControlException

    Hello, I'm using jakarta-tomcat-4.0.3 server for jsp. I have an web application wich throws me AccessControlException... If I write this in $CATALINA_HOME/conf/catalina.policy:
    grant {
    permission java.security.AllPermission;
    }; and start the server with -security (security manager option) works OK. With JBuilder 6, tomcat 4 also do (w/o any special setting)!
    How can I fiund out, what exactly permission(s) need my application. I'm using another api's in it (log4j, xerces... etc)
    A fragment from server log looks like this:
    log4j:WARN Caught Exception while in Loader.getResource. This may be innocuous.
    java.security.AccessControlException: access denied (java.lang.RuntimePermission getClassLoader)
    at java.security.AccessControlContext.checkPermission(AccessControlContext.java:267)
    at java.security.AccessController.checkPermission(AccessController.java:394)
    at java.lang.SecurityManager.checkPermission(SecurityManager.java:540)
    at java.lang.ClassLoader.getParent(ClassLoader.java:687)
    at org.apache.catalina.loader.WebappClassLoader.toString(WebappClassLoader.java:877)
    at java.lang.String.valueOf(String.java:1942)
    at java.lang.StringBuffer.append(StringBuffer.java:365)
    at org.apache.log4j.helpers.Loader.getResource(Loader.java:78)
    at org.apache.log4j.Category.<clinit>(Category.java:138)
    regards,
    cri

    Hi, I run into the same problem and wonder if you have found a solution. If so, could you please post it?
    Thanks in adavance.

  • Testing WebDynpro Adobe Interactive forms Using eCATT or any other testing

    Hi All,
    We are testing WebDynpro Adobe forms (Java). is there any methodology to test Interactive forms not normal webdynpro applications. Especially Interactive form with UI fields like dropdwons, datepickers dropdown values are from BAPI/RFC's  in these forms we will perfom actions like send data to backend and display PO created in onther view.
    once we repaly the test script all the drop down values are not updated this test scenario we tested with LR.
    Is there any procedure to test this scenario using eCATT or any other testing Tool.
    Rehards,
    Murali

    Hi Vara,
    You can develop Interactive forms using WD ABAP also.
    [E Learning- Interactive Forms using WD ABAP|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/media/uuid/c766e918-0b01-0010-99b1-c2b78cd059b3]
    WD Java is useful in case, when your ABAP system is less than ECC 6.0. Otherwise you can achieve same functionalities in WD ABAP also.
    Hope this will help you.
    Amit

  • How to run multiple CodedUI Ordered Tests over multiple Test Agents for parallel execution using Test Controller

    we are using VS 2013, I need to run multiple Coded UI Ordered Tests in parallel on different agents.
    My requirement :
    Example:   I have 40 Coded UI Test scripts in single solution/project. i want to run in different OS environments(example 5 OS ).  I have created 5 Ordered tests with the same 40 test cases. 
    I have one Controller machine and 5 test agent machines. Now I want my tests to be distributed in a way that every agent gets 1 Ordered test to execute. 
    Machine_C = Controller (Controls Machine_1,2,3,4,5)
    Machine_1 = Test Agent 1 (Should execute Ordered Test 1 (ex: OS - WIN 7) )
    Machine_2 = Test Agent 2 (Should execute Ordered Test 2 (ex:
    OS - WIN 8) )
    Machine_3 = Test Agent 3 (Should execute Ordered Test 3
    (ex: OS - WIN 2008 server)  )
    Machine_4 = Test Agent 4 (Should execute Ordered Test 4 (ex:
    OS - WIN 2012 server) )
    Machine_5 = Test Agent 5 (Should execute Ordered Test 5 (ex:
    OS - WIN 2003 server) )
    I have changed the  “MinimumTestsPerAgent” app setting value
    as '1' in controller’s configuration file (QTController.exe.config).
    When I run the Ordered tests from the test explorer all Test agent running with each Ordered test and showing the status as running. but with in the 5 Test Agents only 2 Agents executing the test cases remaining all 3 agents not executing the test cases but
    status showing as 'running' still for long time (exp: More then 3 hr) after that all so  its not responding. 
    I need to know how I can configure my controller or how I can tell it to execute these tests in parallel on different test agents. This will help me reducing the script execution time. 
     I am not sure what steps I am missing. 
    It will be of great help if someone can guide me how this can be achieved.
    -- > One more thing Can I Run one Coded UI Ordered Test on One Specific Test Agent?
    ex: Need to run ordered Test 1 in Win 7 OS (Test Agent 1) only.
    Thanks in Advance.

    Hi Divakar,
    Thank you for posting in MSDN forum.
    As far as I know, we cannot specify coded UI ordered test run on specific test agent. And it is mainly that test controller determine which coded UI ordered test assign to which test agent.
    Generally, I know that if we want to run multiple CodedUI Ordered Tests over multiple Test Agents for parallel execution using Test Controller.
    We will need to change the MinimumTestsPerAgent property to 1 in the test controller configuration file (QTControllerConfig.exe.config) as you said.
    And then we will need to change the bucketSize number of tests/number of machines in the test settings.
    For more information about how to set this bucketSize value, please refer the following blog.
    http://blogs.msdn.com/b/aseemb/archive/2010/08/11/how-to-run-automated-tests-on-different-machines-in-parallel.aspx
    You can refer this Jack's suggestion to run your coded UI ordered test in lab Environment or load test.
    https://social.msdn.microsoft.com/Forums/vstudio/en-US/661e73da-5a08-4c9b-8e5a-fc08c5962783/run-different-codedui-tests-simultaneously-on-different-test-agents-from-a-single-test-controller?forum=vstest
    Best Regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Printing to PDF using Chrome, and then save as a Word doc.

    I want to print a webpage using Chrome to PDF, and then save that PDF to a Word document.
    The problem is occurring when saving the PDF to a Word doc, as the Word document is blank.
    Im using Adobe Acrobat X, Chrome version 32.0.1700.107 m.
    (This question may seem a little strange/pointless, however current workflows within my workplace requires documents to be saved from online as PDFs, sent as PDFs, and staff then either save as PDFs or some convert the files to word documents as necessary)
    I can already do this using Firefox, but saving to PDF using Chrome is significantly faster.

    I'm sure you're aware that here you have an Acrobat user-2-user forum. Note a generic Q&A forum for non-Adobe products that, coincidentally, can create PDF.
    The quality of Export from Acrobat or Adobe's online subscription services very much depends upon the "inner quality" of how the PDF was created.
    GIGO is very much operative.
    Good In Good Out -- Garbage In Garbage Out. Sounds like you have the later.
    Regardless what is making the PDF is not Acrobat. Consequently "process support" would be with the software house that is responsible for the process.
    Be well...

  • Can't convert .doc to .pdf using Acrobat 9.4.3.

    Guys,
    Last night for some reason Acrobat 9 suddenly stopped converting any MS Word .docs to .pdfs.  It gives me the following message:
    Acrobat could not open 'XYZ.doc' because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded).
    To create an Adobe PDF document, go to the source application. Then print the document to Adobe PDF or use the Acrobat toolbar found in Microsoft Office applications.
    I swear it was working earlier. So I checked for an update and it gave me 9.4.3 so I updated and it didn't fix the problem.  I also tried several different files and got the same message.
    I'm using OS 10.6.7 Acrobat 9.4.3 and MS Word 11.3.5 (2004).
    Thanks,
    Solan

    What version of Word do you Have?
    Word 2004 if you had Acrobat as well the PDFmaker menu bar was installed by Acrobat you could convert a .doc Document to PDF.  It required the use of VBA and and a Macro which created the PDFMaker menu.  I was Secretary and Treasurer of an association for 30 years and I converted many a 2004 Word Document to PDF using PDFMaker.
    You still had the same problems with word converted to PDF as today. If there are any section Breaks or Page breaks the pdfs were broken up into pieces you have to put back together.
    I still have some .Doc files from early 2006 and with Office 2011, I opened one, and just saved it as a Pdf no trouble. I didn't convert it and didn't save it as a Docx.
    I simply went to Save as and chose  PDF.
    And I also went to Print menu> PDF> adobe quality PDF.  and was able to make a PDF.
    Also I just went to print menu > PDF and just chose PDF which makes an Apple version of PDF.
    I don't know where anyone got the idea you can't make a PDF from a Doc File.  Maybe in a future version That doesn't read doc. but for now

Maybe you are looking for

  • HT4437 streaming .mov to apple-tv via airplay

    Hi, I would like to stream a streaming .mov movie via airplay to my Apple TV3 box. how can I do that, since I cannot place the movie-file into iTunes as suggested in support forums. (streaming movie URL = http://hstreaming.zdf.de/zdf/veryhigh/130107_

  • Discount in invoice

    Dear all, my customer makes usage decision (acceptance with a specific discount) and wants that discount affects the invoice automatically, i suggested to create different U.D codes with all expected discounts (ex. : accepted with 10% disc.), but how

  • Gurus...need URGENT help...Please understand...?

    Gurus, I had written a BDC program for FV50 transaction..As it is an ENJOY transaction once u enter the company code it doesnt ask for the company code again if second time u go to this transaction...so to do this i made changes in the EDITING option

  • Pls release new software version for nokia 5233

    pls release new software version for nokia 5233

  • External Material Group Description

    What is the table  / field for getting External Material Group Description