Skip to Content

PDF Size

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on May 24, 2005 at 08:08 PM

    <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.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.