02-03-2015 5:52 AM
Hi experts,
We have multipage Tiff images stored in SAPArchiv table. I get tiff image in Binary format.
I want to convert it to PDF or any other image format and display it in browser.I used class CL_IGS_IMAGE_CONVERTER but it converts only 1st page.
Have you converted tiff image into PDF?
If not PDF, anyhow I want to convert in browser supported format.
How to handle such scenarios?
Thanks.
02-03-2015 7:01 AM
Dear Anjor,
Please refer the link.
https://pdfbox.apache.org/1.8/commandline.html
Here is an example of using PDFBox to Encrypt PDF file.
Change Command to meet your requirement.
Regards
Sreekanth
02-03-2015 9:59 AM
Hi Sreekanth,
Thanks for quick reply.
I have checked pdfbox link. I dont think it has provision for converting image to pdf.
Secondly, I need to install jar on application server - dev,qa,pd.
Is their any other solution?
I have tried the follwoing approach.
DATA: 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 TIFF file to SE78
perform graphic_import_bds
IN PROGRAM saplstxbitmaps
using 'C:\Documents and Settings\satyajit.mohapatra\Desktop\sample.TIF'
'YSM_TEST'
'GRAPHICS'
'BMAP'
'BCOL'
'TEST'
space
'X'
space
changing 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.
CALL FUNCTION 'SAPSCRIPT_DELETE_GRAPHIC_BDS'
EXPORTING
i_name = 'YSM_TEST'
i_id = 'BMAP'
i_btype = 'BCOL'
dialog = ' '.
Inside perform graphic_import_bds,
there is 1 fm call to SAPSCRIPT_CONVERT_BITMAP_BDS FM. which gives error: erraraneous tiff file.
i tried 2 3 tiff files, it gives same error.
Have you tried similar thing?
Thanks,
Anjor
02-04-2015 5:17 AM
02-04-2015 6:17 AM
I have used the code specified in the above link. It converts simple tiff image (single page) into jpeg format. when we pass multipage tiff image as input, the class converts only 1st page into jpeg and rest 2 pages are ignored.