0

I have a requirement to print all the rtf documents(around 100), present in an IFS folder of an as400 system. The documents have embedded tables within them.

Could some one please guide me on how to proceed on this?

Any help would be deeply appreciated.

Thanks in Advance

Buck Calabro
  • 7,558
  • 22
  • 25
Neerocks
  • 43
  • 1
  • 1
  • 6
  • Can you describe the problem a little more? Why won't WordPad or OpenOffice work for you? – Buck Calabro Jan 11 '13 at 15:42
  • I have no clue what Open office is...& word pad?i need to print through each documents present in an AS400 folder using java.Since, these documents have embedded tables, when i tried to read it through Rtf Api'(RTFRenderKit),it was throwing error.Is there some other way where i can print all these documents through java? – Neerocks Jan 14 '13 at 04:54
  • im using pdfrenderer for printing pdf but for rtf , i didnt find any.If some one can point me to some code samples(i searched through google,but couldnt find any),it would be really grateful. – Neerocks Jan 14 '13 at 05:52
  • I re-tagged your question with Java so that people will know what language you are using. – Buck Calabro Jan 14 '13 at 14:35

1 Answers1

0

Your question looks similar to this one and this one.

.rtf is a proprietary Microsoft format, which makes free and open solutions hard to come by. Which is why it might be easier for your Java program to call WordPad to do the printing.

"C:\Program Files\Windows NT\Accessories\wordpad.exe" /pt "whatever.rtf"
Community
  • 1
  • 1
Buck Calabro
  • 7,558
  • 22
  • 25
  • @Buck..I tried the above option.My requirement is to print around 100 rtfs present in an AS400 folder(silently).Using the above option, each time a wordpad window is opened & some how it is not connecting to the file present in th AS400 folder. – Neerocks Jan 15 '13 at 11:58
  • See if you can print from Windows Explorer. Navigate to the folder, right click one of the .rtf files and choose Print. If this works, you know that the folder is mapped properly and that you have permission to open the .rtf file. If this is a one-time process, you can print them all from Explorer by using Ctrl-A to select them all, then right click, Print. – Buck Calabro Jan 15 '13 at 14:13
  • @Buck..i need to do this in java & this is not a one time process. – Neerocks Jan 16 '13 at 04:47
  • @neerajrajagopal Please post some code and the error message you're getting. – Buck Calabro Jan 16 '13 at 14:40
  • @Buck..I am using the below logic now to print the rtf document.Im reading the document line by line & then printing it using jtext."scan = new Scanner(new IFSFileReader(files[i])); fr = new IFSFileReader(files[i]); StringBuffer str = new StringBuffer(); while (scan.hasNextLine()) { String line = scan.nextLine(); if (line != null) { str.append(line); } }" – Neerocks Jan 17 '13 at 05:47
  • Printing it after setting the text type as "text/rtf"..BUt since my folder contains around 100rtf documents, this process would be time consuming & would finally lead to transaction time out. – Neerocks Jan 17 '13 at 05:49
  • Since Java won't throw timeouts, there's some other part to the problem you haven't revealed yet. Assuming it's some sort of web service, have a look at [these ideas](http://stackoverflow.com/questions/3378756/how-to-handle-long-running-web-service-operations) – Buck Calabro Jan 17 '13 at 16:11
  • @Buck.This is not a webservice.I am interacting with AS400(Iseries).I can increase the time out value at my server end but that would just be a workaround of not throwing timeouts. – Neerocks Jan 18 '13 at 07:23
  • What is throwing timeouts? Edit the question to describe your environment. Where is the Java code running, on the IBM i, on a Windows PC, on Linux? How are you connecting to the i - is there a mapped folder, some server program, JT400? – Buck Calabro Jan 18 '13 at 14:07