• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 519
  • Last Modified:

Writing RTF/PSW in Java

I need to create an rtf file using very basic java code. The reason the code needs to be basic is that it needs to run on a very cut down jdk and therefore will not be able to leverage the swing classes like the RTFEditorKit or any third party libraries like the one offered by Apache et al.

I seem to be able to create the text that is in an rtf but there seems to be a binary code at the end of the file that appears to be very important and I can't figure out how to write that code into the file.

Lastly, I am really talking about a .psw file that is used for PocketPC Pocket Word and PrintBoy (all PDA). The .psw file looks exactly like an rtf so I believe that if I can crack that nut, I will solve the .psw problem too.

Any help is greatly appreciated.
0
gdrnec
Asked:
gdrnec
  • 5
  • 3
  • 3
1 Solution
 
CEHJCommented:
I think if you use the lowagie package for pdf, you can write as rtf
0
 
CEHJCommented:
e.g.

itext.sourceforge.net/examples/com/lowagie/examples/general/HelloWorldMultiple.java
0
 
Mayank SAssociate Director - Product EngineeringCommented:
>>  I need to create an rtf file using very basic java code.

I'm afraid you can't do that completely using the proper APIs for that, and problems like this will probably persist - >>but there seems to be a binary code at the end of the file that appears to be very important.

>> it needs to run on a very cut down jdk and therefore will not be able to leverage the swing classes like the RTFEditorKit or
>> any third party libraries like the one offered by Apache et al

Can we know the details why?
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

 
Mayank SAssociate Director - Product EngineeringCommented:
BTW, if possible, you can try this: http://api.openoffice.org
0
 
gdrnecAuthor Commented:
Here's the why:

I have a PDA based application written in SW (a java based library for pda) that I need to print from. Unfortunately, the only way I can print from that application is to go through a third party app called PrintBoy (they make wireless adapters for printers to print from a pda). The PrintBoy application will only print a .psw file.

To test that .psw and .rtf are the same thing, I created an rtf on my desktop, changed its extension to .psw, transfered it to my pda and printed successfully. However, when I try to programatically create the .psw/.rtf, PrintBoy throws an error and I believe that the error is the binary code that I am missing from the end of a rtf document.

Does this clarify at all?
0
 
gdrnecAuthor Commented:
Hi all,

I just tried using the lowagie library and created a quick example rtf. It turns out that there are differences between the .rtf type and the .psw because the lowagie libraries created an rtf that works without any binary codes in it. The binary must be something to do with the .psw file type.

Although I am now abit off topic, does any one know how to write Pocket Word files (.psw). There are extremely close to a rtf but with obviously some differences.

Any help is appreciated
0
 
CEHJCommented:
I think you're right as there doesn't seem to be an obvious binary in my simple rtfs
0
 
CEHJCommented:
You really need to find the pocket word format. Can't find it myself
0
 
gdrnecAuthor Commented:
I can't seem to find it either. Maybe I'll have a trawl through MSDN. If you can think of anything else I might check, let me know.

Thanks
0
 
CEHJCommented:
Well if that file format is not secret (as far as MS is concerned) i'll be very surprised ;-)
0
 
Mayank SAssociate Director - Product EngineeringCommented:
Did you try the open-office API which I posted? It might work. Also see this:

http://encyclopedia.lockergnome.com/s/b/OpenOffice
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 5
  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now