cancel
Showing results for 
Search instead for 
Did you mean: 

Display .tif file

bjorn-henrik_zink
Active Participant
0 Kudos

Hi,

I have searched the forum for an answer on how to display a .tif file in my Web Dynpro ABAP. However, I could not find a suitable answer. Therefore, I will try again ...

My current solution is opening a browser window with a link to the .tif file, but that requires that the user download/opens the file via a pop-up before viewing it. Now I would like the file to be displayed directly without further user action. How can I achieve this?

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

SergioFerrari
Active Contributor
0 Kudos

I simple suggest to use the image UI control specifying the tiff file name in the source attribute.

It could be that you'll not find the .tiff file in the Component images list of the popup that you use to select the file but if you type the file name directly in the source attribute it works fine at runtime.

Sergio

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

I'm with Sergio; why not just use the Image UI element. Tiff can be a bit of strange file format and isn't always recognized the same way as JPG or GIF on the desktop. You could also consider using the IGS to convert the file to another format.

data: l_igs_imgconv type ref to cl_igs_image_converter,
        l_img_blob    type w3mimetabtype,
        l_img_size    type w3param-cont_len,
        l_bmp_xstream type xstring.
  create object l_igs_imgconv.

  l_img_size = xstrlen( gx_content ).  "The binary string with your TIFF Image Data
  call function 'SCMS_XSTRING_TO_BINARY'
    exporting
      buffer     = gx_content
    tables
      binary_tab = l_img_blob.
  call method l_igs_imgconv->set_image
    exporting
      blob      = l_img_blob
      blob_size = l_img_size.

  l_igs_imgconv->input = 'image/tiff'.
l_igs_imgconv->output  = 'image/jpeg'.
 call method l_igs_imgconv->execute
    exceptions
      others = 1.

  if sy-subrc is initial.
    call method l_igs_imgconv->get_image
      importing
        blob      = l_img_blob
        blob_size = l_img_size.

    call function 'SCMS_BINARY_TO_XSTRING'
      exporting
        input_length = l_img_size
      importing
        buffer       = e_xstream
      tables
        binary_tab   = l_img_blob
      exceptions
        failed       = 1
        others       = 2.
  endif.

bjorn-henrik_zink
Active Participant
0 Kudos

My favorite geeks answered the question - great!

Will try it out both of your suggestions and let you know the result.

Thanks.

bjorn-henrik_zink
Active Participant
0 Kudos

Hi Sergio,

I imported the .tif file and added the name manually to the source. It does not work at runtime. I will try to convert the image with IGS as suggested by Thomas Jung.

SergioFerrari
Active Contributor
0 Kudos

With FireFox and Google Chrome I had no problem with .tiff file but you're right with IE there are problems. I forgot IE, sorry.

Testing now with IE 8.0 I confirm that I can see the .tiff image but looking better I discovered that it is quicktime plug-in that takes care of the visualization.

I think this is a general IE behavior; do you think is it a specific issue related to Web Dynpro ABAP instead?

For sure Thomas suggested a great approach....

Sergio

bjorn-henrik_zink
Active Participant
0 Kudos

Everything is working now that I send the xstring to the server cache and retrieved the URL as a string to the image source.

Thanks Thomas and Sergio for helping me out.

Edited by: Elvez on Feb 15, 2010 9:19 AM

Former Member
0 Kudos

Hi Thomas, I have used your code successfully thanks for that. However have hot an issue with multi pages on a tiff where the code appears to only deal with a single page tiff image converting to JPG.

Looks like link Converting multi pages tiff image into PDF in ABAP | SCN has a similar issue.

Have you experienced this? Can we use the same converter class for multi page tiff to jpg?

Many thanks

Daniel

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

I'm just using the standard IGS service (Internet Graphics Server) to do the conversion. If it isn't converting correctly then that would be up to the IGS to fix/support.

Former Member
0 Kudos

Ok thanks Thomas appreciate your time.

Answers (2)

Answers (2)

Former Member
0 Kudos

I suggest creating a BSP with the content type of the .TIF file. Embed your BSP in a frame inside your webdynpro then when it comes time to view the file, send the content to your bsp.

bjorn-henrik_zink
Active Participant
0 Kudos

HI Joshua,

that sounds like a great idea. Any concrete hints (SCN links) where I can find information of making such a BSP?

Thanks.

Former Member
0 Kudos

As i think it is not possible. we can not stop that popup to come.

This is provided basically for security purpose, so that any file do not get uploaded in ur system or gets open by default.

This is a browser function.

bjorn-henrik_zink
Active Participant
0 Kudos

Hi Pankaj,

thanks for your quick response. What about IGS is that an option?