Ray Smilgius

Ranch Hand
+ Follow
since Jan 29, 2001
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ray Smilgius

HI Dave,
PrintWriter pw = new PrintWriter(new FileOutputStream("c:\\" + sSessionID + ".pdf"));
pw.write(decode(sPDFImage));
pw.close();
I used this but and I try to open it opens correctly but it is a blank pdf no contents but I know the contents are there becasue it works in the browser.
Thanks Ray
Any Suggestions?
16 years ago
Think of it, that can't handle the load. So they will be outsourcing back to USA.
Ray
[ December 03, 2002: Message edited by: Ray Smilgius ]
16 years ago
I have a function called decode(sPDFImage);
Here is part of the function:
<%! public static char[] decode(String text) {
return decode(text.toCharArray());
}
%>
The sPDFImage is the actual pdf base64 which needs to be converted to binary.
Basically, I have the pdf displaying properly in the browser but now I need to write the PDF to a file. I have the code doing this, but it won't open because it is not properly decoded.
This call:
out.print(decode(sPDFImage));
out.flush(); //added flush to ensure buffer is flushed for subsquent requests
out.close();
This works when it opens in the browser but I need to write it to a file then open it.
Here is my code which I am using:
DataOutputStream output_stream;
output_stream = new DataOutputStream(new FileOutputStream("c:\\" + sSessionID + ".pdf"));
char[] ray = new char[decode(sPDFImage).length];
int x = 0;
ray = decode(sPDFImage); //put the return array into ray[]
for(x = 0; x < ray.length; ++x){
System.out.print(ray[x]);
output_stream.writeUTF(ray[x]);
}
output_stream.close();
My machine starts beeping when I run this code
I do get stuff in the file but it is garbage, I need what is displayed in the browser as a PDF.
Anyways is there another way I can get the char array written to a pdf file that I can open?
Thanks Ray
[ December 03, 2002: Message edited by: Ray Smilgius ]
[ December 04, 2002: Message edited by: Ray Smilgius ]
16 years ago
JSP
I have a function called decode(sPDFImage);
Here is part of the function:
<%!public static char[] decode(String text) {

return decode(text.toCharArray());

}
%>

The sPDFImage is the actual pdf base64 which needs to be converted to binary.
Basically, I have the pdf displaying properly in the browser but now I need to write the PDF to a file. I have the code doing this, but it won't open because it is not properly decoded.
This call:
out.print(decode(sPDFImage));
out.flush(); //added flush to ensure buffer is flushed for subsquent requests
out.close();
This works when it opens in the browser but I need to write it to a file then open it.
Here is my code which I am using:
DataOutputStream output_stream;
output_stream = new DataOutputStream(new FileOutputStream("c:\\" + sSessionID + ".pdf"));
char[] ray = new char[decode(sPDFImage).length];
int x = 0;
ray = decode(sPDFImage); //put the return array into ray[]
for(x = 0; x < ray.length; ++x){
System.out.print(ray[x]);
output_stream.writeUTF(ray[x]);
}
output_stream.close();
I do get stuff in the file but it is garbage, I need what is displayed in the browser as a PDF.
My machine starts beeping when I run this code
Anyways is there another way I can get the char array written to a pdf file that I can open?
Thanks Ray
[ December 03, 2002: Message edited by: Ray Smilgius ]
[ December 03, 2002: Message edited by: Ray Smilgius ]
16 years ago
I ran this and it worked fine check your path the code is right, you are getting a malformed URL check the path.
Good Luck I am using tomcat 4.0
Ray
Thank you, Every one , I owe alot of thanks to Java Ranch and to all the ranchers who have contributed.
Next on the list is XML test 141 IBM then on to the MCSD .net cert then what ever comes next.
P.S I worked on certifications during grad school Masters in Computer Science. I love education, and certifications have become a hobby *-)
Good Luck Ray
[ June 04, 2002: Message edited by: Ray Smilgius ]
Congrats Sir,
Any suggestions and/or links too hit.
Ray
I studied about 2 months off and on. I have worked with JSP at work for about 6 months. I used whiz and JwebPlus these 2 helped alot. I suggest you really study the tags well. Do all the mock exams and study the api servlets and jsp closely. Alot of questions on what method belongs to what interface etc. On to IBM xml.
Good Luck Ray
[ June 03, 2002: Message edited by: Ray Smilgius ]
When my jsp page gets invoked a second time it is using the same pdf file in internet temp files if I delete the file from internet temp files it is ok it makes a new request for the new file.
Is there a way to get rid of cache in the header I do set the no cache I use the setHeader(expires etc). Problem it is still going after the temp file and redisplaying the old pdf file.
Any Help Thanks
[ April 25, 2002: Message edited by: Ray Smilgius ]
16 years ago
JSP
Dont forget to terminate the end of the jsp:setproperty
<jsp:setProperty name="test" property="*"/>
peace
I have a javabean that deals with connections to a backend server. On the web site, every jsp page hits the bean if i implement Serializable will this improve performance?
16 years ago
Thanks James,
That did the trick.

Ray
16 years ago
JSP
I can parse a file or an InputStream without no problems, but I call a function which returns an xml string and I need to parse this
String strMe = "localhost";
Document doc;
DocumentBuilderFactory dbf=DocumentBuilderFactory.newInstance();
DocumentBuilder db=dbf.newDocumentBuilder();
String parseme = hostLookup.LookupAddress(strMe);
doc=db.parse(parseme);
I get a SAXException not found the string is returning ok but I need to parse the string not a file I dont want to put it in a file if I did it would work but is there a way to build an InputStream with this strMe string
Thanks in Advance
Ray