Thanks for the hint.

I use now WebResource, but i couldn't find a class implementing
IResourceStream (which you need to use WebResource) that could get my
byte[] and use it directly.

There is a StringResourceStream, but then i ended up creating a String and
then the class internally asks for its byte[]. I'm not sure if this can
cause memory consumption. Normally i wouldn't care too much, but being
full PDFs involved, it could be an issue.

I ended up creating a ByteArrayResourceStream that takes my byte[] and
uses it directly when needed.

Bye,

German

It seems that Eelco Hillenius wrote:
>> To cut the problem from the source... Do you need to have a file in the
>> file system?
>>
>> We are using a DynamicWebResource that answers a PDF directly from
>> memory.
>> Here some code:
>>
>>    // we have a method that generates the PDF as a byte[]
>>    final byte[] thePDFInBytes = generatePDF();
>>
>>    Resource cResource = new DynamicWebResource() {
>>       protected ResourceState getResourceState() {
>>          return new ResourceState() {
>>                public String getContentType() {
>>                   return "application/pdf";
>>                }
>>                public byte[] getData() {
>>                   return thePDFInBytes;
>>                }
>>             };
>>       }
>>    };
>>
>
> Looks like a fine approach to me. Though it would probably even be
> better if you could just stream it (use WebResource directly).
> ResourceState is a construct that allows for caching, but you probably
> don't need that in this case.
>
> Eelco
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to