This project is read-only.

One step xsl:fo transformation / pdf render

May 20, 2009 at 9:55 AM

C# .net 2.0


I'm struggling to get my code working and would appreciate any help you can give me.

I have a .fo file which I can render to pdf no problem when I use the actual file from the file system and change the content type to 'Application/pdf', however, when I use the output from an xsl transformation within the code, and use that to generate an in-memory .fo, I get a .net error: "System.SystemException: Unknown formatting object^root".

The thing is, when I write the in-memory .fo to the screen, and compare with the .fo from the file system, they're identical, so really stumped how to fix this.


Many thanks for any tips,



May 20, 2009 at 10:33 AM


I realised that I had two xmlns for fo in the xsl stylesheet.  Once I removed that, I moved on a step.

My issue now is that whilst the pdf data is written to the screen, I've changed the content type to pdf so it should be opening _as_ a pdf, but it isn't.  If I save the page asa .pdf and open in a pdf reader, it's a perfectly valid pdf document, so I'm obviously missing something fundamental...



May 20, 2009 at 11:14 AM

Okay, after a bit of googling, I've found the correct syntax to write it to the screen...:


Response.BinaryWrite([memorystream of pdf].ToArray());