views:

21

answers:

1

I have a project which needs to generate PDF documents. I am using iTextSharp. I have a pdf which needs to be read and then appended to.

To read the pdf document, I'm using PdfReader(), which accepts many forms, but I can't figure out how to reference a pdf in my webapplication to PdfReader.

My host does not allow Binary Serialization (apparently that's bad), so I don't think I can load from an embedded resource. I've tried just using PdfReader("report.pdf"), but it keeps throwing an exception telling me that the file isn't found. I've tried putting the file in the bin directory, root directory, in the same directory as the class, but this still doesn't work.

It works if I use a fully qualified path to the pdf document, but I can't use that when I upload it to my hosting provider.

Does anyone have any suggestions on how I should do this?

Thanks

A: 

It works if I used a fully qualified path to the pdf document, but I can't use that when I upload it to my hosting provider.

You should still be able to get the fully-qualified path to your application via Request.PhysicalApplicationPath (which should still be available, even in medium trust).

In addition, embedded resources should still work as well, since they don't actually involve binary serialisation. You should be able to copy the embedded resource to a temporary file and then pass that file to PdfReader.

Dean Harding
thanks mate thats working
Mike