on 08-04-2008 7:04 AM
Hi All,
We are working for a requirement where in we need to create a PDF file as an attachment in the mail using smartform and send it across to the vendor.
We are successfull in creating the PDF attachment but since the size of PDF is high (>300 KB) we are facing issues.
For your information we are using logo and digital signature in the PDF. We dont know if this is creating the issue.
Can anyone help us how to reduce the size of the PDF (we need it to be <50KB).
Helpful answers will surely be rewarded.
Thanks in advance,
Asif Ali Khan
check SAPnote 843480...
Regards,
Anand.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This snippet will be used for size conversion while sending a pdf file as an attachment/&------------------------------------------------------------------------*
Changing the pdf file size into the sixe reqd to send it as an attachment
&----
*"Declaring Local Constants............................................
CONSTANTS:
cnv_hexconst_zero TYPE x VALUE '00'.
"----
Internal table to hold 255 Char's Single Line. *
"----
DATA:
lv_big_lines(268) TYPE c
OCCURS 0 WITH HEADER LINE,
wa_objcont TYPE soli, " Work Area to store data upto 255 Lines.
t_objcont TYPE TABLE OF soli.
*"Local Work Variables.................................................
DATA:
lfl_flag TYPE c,
lv_left_t(268) TYPE c,
lv_left_i TYPE i,
tv_left_i TYPE i,
lv_curr_i TYPE i.
FIELD-SYMBOLS: <f>.
Get the lines into a table of 268 char as the first step to put it in
the pdf file of 255 chars
CLEAR lfl_flag.
LOOP AT pdf_tab INTO pdf_tab. " Pdftab will have the pdf data
IF lfl_flag EQ ' '.
CLEAR lv_big_lines .
ASSIGN lv_big_lines(134) TO <f>.
<f> = pdf_tab.
lfl_flag = 'X'.
ELSE.
lv_big_lines+134 = pdf_tab.
APPEND lv_big_lines.
CLEAR: lfl_flag.
ENDIF. " If lfl_flag = ''..
ENDLOOP. " Loop at t_pdf
IF lfl_flag EQ 'X'.
APPEND lv_big_lines.
ENDIF. " If lflf_flag eq 'X'..
Next fill it into a 255 char table
CLEAR: lv_left_t, lv_left_i, tv_left_i.
lv_curr_i = 255.
LOOP AT lv_big_lines.
IF lv_left_i NE 0.
IF lv_curr_i NE 0.
wa_objcont(lv_left_i) = lv_left_t(lv_left_i).
wa_objcont+lv_left_i(lv_curr_i) = lv_big_lines(lv_curr_i).
ELSE.
wa_objcont = lv_left_t(lv_left_i).
ENDIF. " IF lv_curr_i NE 0
ELSE.
wa_objcont = lv_big_lines(lv_curr_i).
ENDIF. " IF lv_left_i NE 0
APPEND wa_objcont TO t_objcont.
tv_left_i = 268 - lv_curr_i.
IF tv_left_i > 255.
wa_objcont = lv_big_lines+lv_curr_i(255).
APPEND wa_objcont TO t_objcont.
lv_left_i = tv_left_i - 255.
tv_left_i = 255 + lv_curr_i.
lv_curr_i = 255 - lv_left_i.
lv_left_t = lv_big_lines+tv_left_i.
ELSE.
lv_left_t = lv_big_lines+lv_curr_i.
lv_left_i = 268 - lv_curr_i.
lv_curr_i = 255 - lv_left_i.
ENDIF. " IF tv_left_i > 255
ENDLOOP. " LOOP AT lv_big_lines.
CLEAR wa_objcont .
ASSIGN wa_objcont(lv_left_i) TO <f>.
<f> = lv_left_t(lv_left_i).
APPEND wa_objcont TO t_objcont.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
May be the photo and digital signature is creating issue. Please check this document. This document may be useful to you.
http://www.webmasterworld.com/forum10/8898.htm
Thanks,
Phani Diwakar.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Asif,
https://www.sdn.sap.com/irj/sdn/wiki
Go into the code gallery , in search tab provide this
Snippet for size conversion sending pdf as an attachment via email
I think this will be useful to you.
Regards,
Nisrin.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.