• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Returning a PDF Document
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Returning a PDF Document


  • Subject: Re: Returning a PDF Document
  • From: Andrew Lindesay <email@hidden>
  • Date: Fri, 22 Apr 2005 12:45:41 +1200

Hello;

However, I'm clicking on a WOHyperlink which is linked to an action. The
action's code will generate an XML file, transform it via xsl-fo to PDF,
and I want to return the PDF. I'm not using ReportMill or anything fancy
here, just vanilla WO, plus the Java tools to do the transformation.

Action methods can return "WOActionResults" and so if you look at the class heirachy you can actually just pass back an instance of "WOResponse". This can carry a PDF document as it's content.


public WOActionResults goGetMePDF()
{

// make PDF document however you are doing it and
// put data into into a "pdfData" instance of NSData.

	WOResponse response = new WOResponse();

response.setHeader("application/pdf", "Content-Type");
response.setHeader(pdfData.length(), "Content-Length");
response.setHeader("inline; filename=file.pdf","Content-Disposition");
response.setContent(pdfData);
response.setStatus(WOMessage.HTTP_STATUS_OK);


	return response;
}

If you are using FO: based on a component that constructs XML then you can do this transformation at the end of the "appendToResponse(...)" cycle, but it depends on your architecture. Hope this helps.

cheers.

___
Andrew Lindesay
www.lindesay.co.nz
+64-21-47-0929

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: Returning a PDF Document
  • Next by Date: Re: Returning a PDF Document
  • Previous by thread: Re: Returning a PDF Document
  • Next by thread: Re: Returning a PDF Document
  • Index(es):
    • Date
    • Thread