pdf generation - Read the PDF response and display the PDF though ajax -
issue displaying pdf response pdf in new tab. trying this: trying hit url\ gives reponse in %pdf-1.4 1 0......%%eof
code wrote is
$.ajax({ type: 'get', url: url, headers: { 'content-type': 'application/pdf' }, success: function(data, status, xhr){ var newwindow = window.open("", "new window", "width=200, height=100"); newwindow.document.write(data); // displays result in new window }, }
but output expecting view pdf in new tab. not result of call in new tab.
that's quite difficult, because of browser configuration. browsers (most of them), when try open pdf in current tab or in new 1 download automatically, so, first should take browser settings. once browser settings correctly configurated suggest open pdf result of form action , not ajax. form action target="_blank" open pdf in new tab.
if doesn't work because browser still download pdf , need display on new tab, create view in html/css passing data want display , visually styled pdf. include "download" flat button or icon, calls creation , download real pdf.
hope helps you.
Comments
Post a Comment