I all as anybody tried, passing a pdf tha is in memory stream and so it directly on a div, without the creatio od a file??
Alright I am going to sound stupid, but what exactly is a "DIV"?
Oh so you mean you want toe document HTML formatted? You know I feel there is a way, I had a co-worker of mine convert a word document over to HMTL, but I don't know how. I'll try and remember to ask her she did it today if I can
What i want its a documente created in a memory stream to be shown in the html div, without creating in the harddrive
PDF is not HTML. If you want to display the PDF inside a DIV element you'll probably need to convert it to HTML.
Alternatively you might use an IFrame. Let the browser request the resource from your server - you can set headers in the response stream to tell the client it's a PDF and whether to cache it or not. How the PDF is displayed depends on the browser and typically requires an appropriate plug-in.
Another option, you could render the PDF to a bitmap format such as PNG or JPEG, which practically all browsers support.
Are you hoping to avoid creating the PDF on the client or server harddrive?
i know that pdf its not html, i use or embembed or object to put the pdf in the page, what i want to do i pick the memory stream tant im using to donwload pdf's and use it to insert de embenbed pdf in a div.i dont want to create pdf on the hardrive
Nobody has any idea how to do that??
Did you set the HTTP response headers for caching? If not, try setting Cache-control to something like "max-age=0, no-cache, no-store", and Pragma to "no-cache". Does it make a difference?
While HTTP headers allow you to specify what should and should not be cached, I suspect there are no guarantees here. A resource might get cached by a bad client, or perhaps cached by a proxy, or end up in page file on the client's system.
What's your reason for not storing the PDF on disk?
the reason is space, and outorizations, and i have no problem in getting the file only showing in the div
Well, your two options are (to achieve what you want);
1. Decode the PDF server side and parse into HTML format. Insert that between your div
2. Run some kind of Java Applet that requests the file from your database. That file would still need to download to the client machine, but would only exist in the applet's memory. You could then stream that to wherever you want. If you want it in your div, then you need to parse it to HTML again.
Another option might be to convert it to Flash. There are software components available that will do that for you.
Regarding authorization, the PDF format allows you to restrict certain rights, such as the ability to view, print or modify. I'm wondering if there may be another way to achieve what you want to do. What exactly are you trying to restrict?
Could you show us an example of the code you have so far?
de PDF is created on a memorystream, i only dont want to create files in the server, for future autentication problem, and thhe only thing missing its passing the stream to html using the pdf plugin existing in the webrowsers.
I think is possible, but couldnt do it yet. I never though i would try t odo something impossible. Any more Ideas
It would be easier if your could provide us with the code you have already, but here goes.
To get your code to return the MemoryStream as a PDF you'll need server-side code that looks something like...
Response.Clear(); Response.ContentType = "application/pdf"; Response.AddHeader("content-disposition", "inline; filename=dummy.pdf"); Response.AddHeader("content-length", myMemoryStream.Length.ToString()); Response.BinaryWrite(myMemoryStream.ToArray()); Response.Flush(); Response.End();
where 'myMemoryStream' is the stream holding your PDF document. The document needs to be well-formed, otherwise the browser's PDF plug-in will complain. If you have any doubts, try saving the stream to a binary file and opening it directly into Acrobat.
On the HTML page that is to display the PDF, you'll can use something like...
<object data="myPdfScript.aspx" type="application/pdf" width="420" height="594"> <span>Hey, a plug-in is required to view PDFs!</span> </object>
Where 'myPdfScript.aspx' is the name of the resource that generates your PDF documents, the one containing the aforementioned server-side code.
See if it works for you. If not, post back your own code and I'll take another look at it.