Skip to Content
0
May 17, 2005 at 06:24 AM

PDF Size

19 Views

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