Sending PDF directly to Browser using Form.Save()


I have my Aspose.Pdf.Form object working quite well, and have it running in an application in such a way that SQL data store material is used to fill in the PDF form fields. I also do this ‘on the fly,’ sending the file over the web using the output streaming overload in Form().

Basically, I simply set the stream to Response.OutputStream.

However, I don’t seem to have much control over the HTTP headers, and some (Macintosh) browsers seem to have troubles. In PC browsers, an ‘Open/Save’ dialog opens, but the file name is set to my ASPX page but with ‘.PDF’ appended. I’d like to be able to control the file name, but setting the HTTP headers doesn’t seem to change anything. I got a report from a Mac person that they were getting an error that the ‘text/html’ format was not supported. Hmm… I set the HTTP header to Content-Type ‘application/pdf’, but I’m suspecting that my headers might be being overridden by the Save() in Aspose.

How would I go about getting the PDF to be sent in a response the same way that the server usually responds to a file get request?

[8-|] Comments?


Dear Budsy,

Thanks for considering Aspose.Pdf.Form.

Did you have two questions like these, is that right?
1) You want to specify the pdf stream’s name in your Response.OutputStream?
Even if you set the header, it didn’t work either.
2) In Mac platform, it seems an error of “‘text/html’ format was not supported”.

OK, I will check the problem and give you replies soon.

Best regards.


Dear Budsy,

1)I have tested my .net asp demo. The stream’s file name is specified by the aspx file name which created the stream. Changing the header of the html is not useful.
So what you can do is to set the “aspx” file’s name as you want. This is my suggestion, perhaps there are better solutions.

2)Because I am not very familiar with the html programming, and the different explorers of the clients (such as IE and Netscape are quitely different in details) have much effect on the html program, so about the “Mac” platform error I have no suggestions. Maybe you should ask other professionals on html program.

Best regards.


I see. Well, changing the file name would be ok on PC, which appends ‘.pdf’ to the file name and then properly displays the PDF in Acrobat or in the browser window. On Macintosh the ‘.pdf’ is not appended, and the file comes in with the original file name complete with ‘.aspx’ appended. The Mac only lets you save that file, and unwitting users click it later and it wants to load into another application (e.g. Dreamweaver), where it crashes the application.

My second issue appears to have perhaps nothing to do with the Aspose.Pdf.Form system, but I’ll describe it anyway:

If a Pdf form file that is on the client’s machine is run in Acrobat Reader, upon hitting the ‘Submit’ button, an error of message "Content-Type text/html not allowed; utf-8’. This happens on both PC and Mac platforms. If that same PDF is loaded by the browser, the submit buttons work correctly. I’m looking for settings now in Acrobat Pro that might have an affect on this.


Ok, I think I fixed it.

I CAN set the http headers before sending the Form.Pdf.Form.Save(). However, the header has to be:

Content-Type: inline; <filename.pdf>

This results in the browser recognizing the file as a .pdf with the name given, and opens it correctly.

As for the Error when hitting the Acrobat form Submit button, that might be an error caused by GoLive! and I’m looking into that.