on 05-17-2005 7:24 AM
Hi
I've managed to create BSP applications that display PDF files. The code is as follows:
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
text = ls_output
IMPORTING
buffer = l_pdf_xstring.
l_pdf_len = XSTRLEN( l_pdf_xstring ).
cached_response->set_data( data = l_pdf_xstring
length = l_pdf_len ).
cached_response->set_header_field( name = if_http_header_fields=>content_type
value = 'application/pdf' ).
cached_response->set_status( code = 200 reason = 'OK' ).
cached_response->server_cache_expire_rel( expires_rel = 180 ).
CALL FUNCTION 'GUID_CREATE'
IMPORTING
ev_guid_32 = guid.
CONCATENATE runtime->application_url '/' guid '.pdf' INTO l_display_url.
cl_http_server=>server_cache_upload( url = l_display_url
response = cached_response ).
Some of these PDF files however are quite big eg 2MB.
1) I would like to know wether there is a way I can compress these files before sending it to the browser?
2) Is there a way, perhaps javascript, I can display the file size to be downloaded (this I can get) and the percentage downloaded to cache?
3) Is there a way I can convert the PDF file into SVG format?
TIA
Faaiez
<i>1) I would like to know wether there is a way I can compress these files before sending</i>
Done by ICM when streaming the content out if (a) browser is willing to accept gzip and (b) you tells ICM to do the needful. See: CL_HTTP_SERVER=>SET_COMPRESSION. That is it.
Hmmm..I see that you are actually writing yourself it into the cache. I have never tried this and compression option. Maybe you could change your logic to generate a URL that points to a BSP page generate.pdf. Only then generate the PDF and then the response is written without the ICM cache. Then definitely you can call set_compression.
<i>2) Is there a way, perhaps javascript, I can display the file size to be downloaded (this I can get) and the percentage downloaded to cache?</i>
This is not possible, as all of this work is done on the ABAP side, at a time when the browser is waiting for the response. You could consider to start some animation in the browser after the request is dispatched. For example, look at <xhtmlb:protectDoubleSubmit>. Other solutions are possible, but complex using batch jobs, polling, etc.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.