Forum Bugs

Prince streaming issues with Asp.net 2.0 RTE with 2005 IDE

jwjohnson
:) I am able to pass threads into the prince dll interface and the conversion of HTML/XML files via CSS is great from physical file to physical file!

:roll: My gripe comes that your streaming support is via the Stream class. According to my ASP.net C# 2005 Pro install (ASP 2.0 Framework), th class is now abstract. Inheriting this class creates a new data type and the complier is not satisfied with the input. I tried the StreamReader and StreamWriter classes and they are not the right type. I even tried to use a Stream class pointer as a base class pointer to the 2 previously mentioned current stream classes and that didn't work either.
====================================

C#
SerializableAttribute
ComVisibleAttribute(true)
public abstract class Stream : MarshalByRefObject, IDisposable

====================================

I am not even going to touch the issue of encryption and info security without having streaming.

I am guessing that you have some refactoring in the works intended for future releases of your software and I look forward to this.

Nevertheless, I need some short term solution to help me and the developers I work with meet our deadlines. HELP!!
mikeday
What is it you are trying to do? Typically the Stream conversion method is used by ASP.NET applications, that pass in HttpResponse.OutputStream or a MemoryStream object to collect the PDF output.
jwjohnson
I am trying to allow my clinical users to produce pdf files of html or xml with css in real time. It will have to be secure and printable locally to the user (e.g. displayed and printable from Internet Explorer or Firefox within the context of an ASP.Net ongoing session) as we are in the field of counseling and deal in a lot of very private and very prosecutable handling of information.

Collecting pdf output to an http stream is not useful if I can't satisfy the function call requirements. I can't use the streaming functions in your API if I can't feed it the arguments the function requires.




Given that I am working in an enterprise web server environment shared by many users concurrently this creates a host of problems for me that I now have to handle.
1.) File System Management--I have to be sure that no file exists with name that I am trying to use and delete my files when I leave)
2.) Concurrency--I have to be sure that concurrent users don't try to use the same name on the file system at the same time
3.) Security--I have to get the pdf files to be able to allow my users to print these pdf files without threats to security or signs of security weakness that lawyers may attack in the future.

I really need some help in finding a secure short term solution that helps me meet my deadline.
mikeday
So do you want to return a PDF file to the browser in response to a HTTP request made to an ASP.NET page? If so, is there any reason you can't just pass HttpResponse.OutputStream to the convert method? For example, if your input document is assembled in a string, you should be able to do something like this:
myDoc = "<html>...</html>"
prince.ConvertString(myDoc, response.OutputStream)

Is the problem that you don't have the OutputStream available, or you don't have the input document available in a string, or you want to do something else entirely?
jwjohnson
Stream functions not working, convert with file paths does for the same html written to file. :?

I am trying to convert a file to pdf and securely display pdf file in browser.


mikeday
Try calling SetLog to specify a log file to see if there are any error messages. Also, you probably need to call SetHTML if you are converting HTML and not well-formed XML.
jwjohnson
This was done via Prince.convert(htmlPath, pdfPath) and it works great!
Shown below in my local browser fresh from the Prince API.


Unless there is a different html w/css standard enforced for this function as opposed to the functions that take streaming objects as arguments, the problem is not malformed xml/html.

Are there preliminary steps required above and beyond the Prince.Convert(htmlPath, pdfPath) prep to support streaming from the Prince API?

I am searching the web for workarounds outside the Prince object that may provide more secure support than file to file conversion. I found one that loads the PDF into a binary stream object.

Nevertheless, because Prince requires me to write to the file system, I still have to worry about exposed info to hackers (html is plain text exposure of very private info) it is difficult to defend this flaw against crystal reports when I am criticized. I will have to stay on our support staff to monitor this weakness and cleaup files.

Your html/css engine is legendary for our forms and packets as pdf files. :D I am just at a loss for taking your app to an enterprise environment. :?
mikeday
Please try calling SetLog before ConvertString to specify a log file, so that when ConvertString fails you can check the log file and see any error messages that have been produced.