Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

How to generate a PDF using a webservice?

Avatar

Not applicable
Hi all,



I've got the following code in a webservice that generates a PDF:



// Create a ServletOutputStream object

ServletOutputStream oOutput = objResponse.getOutputStream();

// Set the HTTPResponse objects content type

objResponse.setContentType(objMyOutputContext.getContentType());

// Get the length of the output stream

int outLength = objMyOutputContext.getOutputContent().length;

// Create a byte array and allocate outLength bytes

byte[] cContent = new byte[outLength];

// Populate the byte array by invoking getOutputContext

cContent = objMyOutputContext.getOutputContent();

// Write a byte stream back to the web browser. Pass the byte array

oOutput.write(cContent);



The problem is that I don't know how to pass the HttpServletResponse object (objResponse) to the WebService so I can obtain the ServletOutputStream which is needed to create the PDF form in a web browser. When I pass this object there's an error because this type of parameter is not serializable.



Can anyone help? Does anyone know how to serialize this object? Is there any other possibility to generate a PDF form using a webservice with a serializable parameter?



Thanks
1 Reply

Avatar

Not applicable
Hi,



It sounds good, maybe you can get more info at http://www.adobe.com/devnet/



Good luck and regards