Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Need to download image to PDF

Former Member
0 Kudos
1,676

Hi All,

We have a requirement to download the charts to PDF for which we have used the code from IGS, however IGS does not support PDF as output format.

It just gives BMP/JPEG/PNG.

We are able to show the charts in Portal thru webdynpro.In our screen we have placed download button,

whenever the user clicks the Download button the charts needs to be downloaded in PDF file.

Currently we have tried to convert the content to XTRING usin SCMS_BINARY_TO_XSTRING then we have used GUI_DOWNLOAD.

File is getting downloaded, but when we are unable to open the file but the file can be viewed with the help of Open with/Paint option..

So which means the content is not converted to PDF binary, its still in BMP.Please suggest how we can achieve this requirement.

Thanks in Advance

1 ACCEPTED SOLUTION

sravya_ch
Participant
0 Kudos
437

Hi Vijay

if possible u can down load cute PDF on to u r desk top .run and install it .as well u need to do few configurations in sap .so that when ever u down load .it will give an option for u.

Regards

Sravya

13 REPLIES 13

satyajit_mohapatra
Active Contributor
0 Kudos
437

Check this link....Hope it helps....

0 Kudos
437

Thanks for your quick reply..

I have already gone through that thread which you sent...

I have my content in XSTRING format..i wanted to know...how i can convert this to OTF or some other format...

In order to use the std FM to convert the OTF to PDF...

In that thread you have suggested some program to upload the image...bu that can be used fir tiff format i suppose...

However user will be viewing the charts thru portal and he will be clicking the download button to have the charts in PDF...

Can anyone throw some light on this?

Edited by: abhi_vijay on May 24, 2010 12:26 PM

sravya_ch
Participant
0 Kudos
438

Hi Vijay

if possible u can down load cute PDF on to u r desk top .run and install it .as well u need to do few configurations in sap .so that when ever u down load .it will give an option for u.

Regards

Sravya

Former Member
0 Kudos
437

Thanks for your response..

Can you please tell me those steps which i need to perform....?

Give me some steps or links which would suffice my requirement

Edited by: abhi_vijay on May 24, 2010 1:00 PM

Former Member
0 Kudos
437

Can anyone help me on this?

Thanks in Advance

0 Kudos
437

we also have same issue...

Any inputs please?

0 Kudos
437

I was working on a work around. Check this code.....



DATA:  wf_id          TYPE stxbitmaps-docid,
       wf_res         TYPE stxbitmaps-resolution,
       int_command    TYPE TABLE OF tline,
       wa_command     TYPE tline,
       wa_thead       TYPE thead,
       wa_options     TYPE itcpo,
       int_otf        TYPE TABLE OF itcoo,
       int_pdf        TYPE TABLE OF tline.


* Upload picture to SE78
PERFORM import_bitmap_bds
        IN PROGRAM saplstxbitmaps
        USING  'C:\Documents and Settings\satyajit.mohapatra\Desktop\New Folder\photo.bmp'
               'YSM_TEST'
               'GRAPHICS'
               'BMAP'
               'BCOL'
               'BMP'
               'TEST'
               space
               'X'
               space
        CHANGING wf_id
                 wf_res.

* Get OTF
CALL FUNCTION 'SAPSCRIPT_GENERATE_BMP_COMMAND'
  EXPORTING
    bm_name    = 'YSM_TEST'
    bm_object  = 'GRAPHICS'
    bm_id      = 'BMAP'
    bm_type    = 'BCOL'
  IMPORTING
    bm_command = wa_command.

APPEND wa_command TO int_command.
wa_options-tdgetotf = 'X'.

CALL FUNCTION 'PRINT_TEXT'
  EXPORTING
    dialog  = ' '
    header  = wa_thead
    OPTIONS = wa_options
  TABLES
    lines   = int_command
    otfdata = int_otf.

* Get PDF
CALL FUNCTION 'CONVERT_OTF'
  EXPORTING
    format = 'PDF'
  TABLES
    otf    = int_otf
    lines  = int_pdf.

CALL FUNCTION 'GUI_DOWNLOAD'
  EXPORTING
    filename = 'C:\Documents and Settings\satyajit.mohapatra\Desktop\New Folder\photo.pdf'
    filetype = 'BIN'
  TABLES
    data_tab = int_pdf.

It uploads the file to SE78 and converts it to OTF and then PDF.

Here, I'm uploading the file from desktop using subroutine import_bitmap_bds in program saplstxbitmaps. You can directly use the binary content of the image by copying the code of this subroutine to a new one and removing GUI_UPLOAD. You have to convert your XSTRING to binary using FM SCMS_XSTRING_TO_BINARY.

Also, to upload the content in SE78, the file format should be in BMP. You need to convert the content to BMP before uploading.

Please try it out and let me know in case of any issues.

0 Kudos
437

Hi Satyajit...

Thanks very much for your help...

Now iam getting PDF....But am getting print options as a popup..however we are passing space for Dialog parameter in PRINT_TEXT.

I just want to supress this..how can i do this?

And one more query...

After generating PDF i want to delete the image from se78 in backgroung...How can i achieve this?

0 Kudos
437

I'm not getting the pop up in my system. Are you running the same code given above?

0 Kudos
437

May be no default output device is configured for your user profile. Goto SYSTEM->USER PROFILE->OWN DATA and maintain the output device in the default tab.

Otherwise add this line to your code before calling FM PRINT_TEXT.



wa_options-tddest = 'LP01'.

0 Kudos
437

Missed it in my previous post. You can delete the content fron SE78 using FM 'SAPSCRIPT_DELETE_GRAPHIC_BDS' as shown below...



CALL FUNCTION 'SAPSCRIPT_DELETE_GRAPHIC_BDS'
  EXPORTING
    i_name  = 'YSM_TEST'
    i_id    = 'BMAP'
    i_btype = 'BCOL'
    dialog  = ' '.

Former Member
0 Kudos
437

Hi Satyajit...

You are rocking...

I will test my development and i will come back to you...

Thanks a lot

satyajit_mohapatra
Active Contributor
0 Kudos
437

Hello Abhi,

Did it resolve your problem?