• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

open a pdf inline using MIME in ie7

 
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is a third party product, if it was in house I'd be poking around in it. Really, I was told that we have "no control". I did find that if I use the hex editor and remove the crap before the %PDF, the pdf renders fine. I might try to see if I can somehow remove the stuff, I think it is dirty but my options are looking limited. Anyway, do you think I have set a record for the longest post? Thank you for all of your help.
 
Katie Doody
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello there, I see that my post has been moved back to struts. I have a question. I do think that there is a problem with the code that makes the request to get this pdf. There was a .dll that used to make the call and it was rewritten in java.
I noticed that there are 8 funky characters before the %PDF and I am pretty sure this is why it is not being rendered properly since when I take them out, the code works properly.
I do not know anything about socket programming. Would anyone be able to interpet the following code or point me in the right direction? I thought it was interesting that the header was playing with an amount of eight but I may be way off.

//Preparing Header
int totalRequestLength = sRequest.length()+8;
byte[] utf8BytesTotalLength = (String.valueOf((char)totalRequestLength)).getBytes("UTF8");
utf8BytesFormattedReqHeader[0] = utf8BytesTotalLength[0];
byte[] utf8BytesRequestLength = (String.valueOf((char)(totalRequestLength-8))).getBytes("UTF8");
utf8BytesFormattedReqHeader[6]=utf8BytesRequestLength[0];
printBytes(utf8BytesFormattedReqHeader, "a1");


Thanks.
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There's more to this code on Katie's post of January 14, 2008 6:12 PM on the first page.
As near as I can tell from the way your request is written, your third party application expects a request to consist of a number indicating the total length of the data you are sending it (sRequest.length()+8), then an integer indicating the length of the request without the header (sRequest.length()) followed by the account information (sbRequest).
There's nothing obviously wrong with the request on this side. Of course, we don't know what your third party app expects.
Does the old DLL produce the same file for the same request?
Does a bare-java request (i.e. without Struts) produce the same file?
 
Katie Doody
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not sure what the old .dll produces, it was 6 months ago that it was re-written. No one seems to know where the code was. I was going to try to run it and see what the pdf looked like but can't get a hold of the source code.

I will have to try it without struts...thanks.
 
Katie Doody
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just to update this with the fix. I am not happy with the fix but I changed the code to ignore the first eight bytes of the outputstream so that that first bytes written are %PDF since this is what IE7 is looking for to render the pdf in the browser. This means I could not use the struts 2 solution.

Also, just a side note for all who were helping me. The packet for the request from the existing system that generates the pdf's and the packet from my request are exactly the same. I guess the only thing I can think of is that there is some kind of handshake and the system recognizes that my call is an outside call and puts those extra bytes in the return string?

Thanks for all of your help.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic