This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Websphere and the fly likes sending pdf files to IBM MQ Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "sending pdf files to IBM MQ" Watch "sending pdf files to IBM MQ" New topic
Author

sending pdf files to IBM MQ

Joseph Siao
Ranch Hand

Joined: Feb 26, 2004
Posts: 32
I need to convert a pdf file to its binary contents so I can send it as a message to an IBM MQ Series. How can i convert pdf to its binary contents in java?
Is there other alternatives besides converting pdf to binary representation? String? Array of Strings?
Anyone? Thanks
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
The easiest way to do this is probably to read the contents of the file with a FileInputStream and then write the contents into a ByteArrayOutputStream. You can then put the ByteArray into your message.
Kyle


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
Joseph Siao
Ranch Hand

Joined: Feb 26, 2004
Posts: 32
Thanks for the reply. =) can i convert the byte array to string? because i need to append control numbers before and after the pdf file.
Rufus BugleWeed
Ranch Hand

Joined: Feb 22, 2002
Posts: 1551
What prevents -
1) write contol codes to byte array
2) write file inputstream to byte array
3) write control codes to byte array
4) send byte array
?
C. Nimo
Ranch Hand

Joined: Mar 23, 2004
Posts: 82
Additionally -
You could write your Strings with Message.setStringProperty() calls.
Nimo.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: sending pdf files to IBM MQ
 
Similar Threads
how to read pdf file with help of Pure Java
View stored blob image in the UI using java
how to save a webpage with struts code as pdf in java?
how to save a jsp page as pdf in java?
Cleared IBM test 252 and 994 with 90%+