Just a thought but could gzip be turned on? i’ve had some weird issues with gziping on the web server level and coldfusion/railo/coldbox dealing with binary content.
Well I think the problem is that I am trying to render data from ajax. So I am using jquery ajax and calling the page which supposed to render data in pdf format. Will that caused an issue?
So your intent is for an Ajax call to return a PDF file? What do you plan on doing with that data once it’s received? What is your goal for this code to accomplish on the user’s behalf?
can you see how the data is being rendered via google chrome’s network analyzer? i bet its not a content-type of pdf. its probably some text or text/plain type.
What I have is dialog box where I have set of checkboxes, Once the check box(s) are selected and review button is clicked i want to build a pdf. but I am loding this pdf in the same div. I think I may need to launch it in the separate window?
Browsers cannot natively render a PDF file-- especially not in an HTML document. You could try putting it in an iframe but I’m not sure that would even work. I would offer the PDF as a download link or in a new window.
Apart from Chrome the others can’t without having Adobe Reader installed, but who these days doesn’t have it installed. Anyway you can send the content type via coldfusion in the header and place it a div without any issues. I have done this many times in the past, but you must use ContentType from renderData.
try writing the PDF to disk and using the sendFile command in the utilities that Luis built. I believe that will solve the problem. Just make sure you set the sendFile command to dispose as attachment.
i think that would work without an iframe or anything special.