Saving PDF to Servlet Response

I can’t seem to figure out how to save to a servlet output stream from a pdf using aspose.pdf for Java.
Also, I tried creating a byte array to write to my output stream, but that also did not seem to work.

This:

public void save(java.lang.String fileName,
SaveType saveType,
aspose.pdf.HttpResponse response)

seemed promising, but there was no way to create the HttpResponse object.

Any help would be appreciated.

Hi,

I have tested the scenario and I am able to reproduce the same problem. For the sake of correction, I have logged it in our issue tracking system as PDFJAVA-16582. We will investigate this issue in details and will keep you updated on the status of a correction. <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

We are sorry for your inconvenience.

Hello,


To generate pdf to servlet container as output stream you
can use pdf.getBuffer() method to get your .pdf as byte array. Note,
this method returns pdf w/o embedded fonts. If you want pdf file with
embedded fonts, you can use
pdf.save("");
byte[]
res = pdf.getBuffer();