2

In my App I need render a dynamic pdf. I have an ajax function that call a php function that return a pdf (string format).

Now I render this pdf using data-uri in this way:

window.open('data:application/pdf;base64, ' + response);

...but this works only on chrome. How can I get that also on firefox?

keepyourweb
  • 664
  • 4
  • 10
  • 19
  • Tried this http://andreasgal.com/2011/06/15/pdf-js/ ? Also, refer http://support.mozilla.com/en-US/questions/784207 – Sandeep G B Nov 28 '11 at 10:12

1 Answers1

0

Hmm how about having your PHP create a temporary local file on the server, and opening that one in your window.open()?

Base64 if very verbose and I am sure you'd get better performance out of just loading it directly from the server (where it actually gets created). Same number of requests, better performance, what could you ask more? ;-)

Leon
  • 4,532
  • 1
  • 19
  • 24
  • I don't create physical file, for this reason I need render the pdf with javascript. – keepyourweb Nov 29 '11 at 13:50
  • is the file created on the server side? You could still directly stream to the output without actually saving it anywhere - [last example](http://www.w3schools.com/php/func_http_header.asp). Hope this helps – Leon Nov 30 '11 at 08:41