on 10-29-2012 4:33 PM
Hello.
I have extension class "cl_bsp_wd_view_controller" to "Zcl_bsp_wd_view_controller", where implemented "PrintForm.htm".
Into "PrintForm.htm"(Pic. 1*) I create smartform(Pic. 1*), convert otf = (Pic. 2*) and fill data "if_http_response" (Pic. 3*).
If installed "Acrobat.Reader" or earlier, it's not working - picture isn't displayed
If installed "FoxitReader" - all work. But, I need, than work tith "Acrobat Reader".
How to solve this problem?
thanks.
P.S. CRM 7.0
and
Sorry for my English
Can you please elaborate the problem, when you are using Acrobat Reader the PDF file is displayed but picture in the PDF is not displayed. Is that correct?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No, sorry.
If installed Acrobat Reader on my computer,
and try print from WEBUI, document not opening(Pic 4 error Adobe Reader.jpg).
If look in smartforms - all good (Pic. 5 logo smartforms.jpg),
and if Install FoxitReader all good too (Pic. 6 logo FoxitReader.jpg)
Pic 4 error Adobe Reader.jpg
Pic. 5 logo smartforms.jpg
Pic. 6 logo FoxitReader.jpg
Hi
You need to convert the otf returned from the smartform call to xstring and send this to the page that is rendering the smartform
<pre>
call function 'CONVERT_OTF'
exporting
format = 'PDF'
* MAX_LINEWIDTH = 132
* ARCHIVE_INDEX = ' '
* COPYNUMBER = 0
importing
bin_filesize = l_pdf_len
bin_file = l_pdf_xstring " binary file
tables
otf = ls_output_data-otfdata
lines = lt_lines
exceptions
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
err_bad_otf = 4
others = 5
you also need to set the the content header of the page to render pdf
_m_response->set_header_field( name = 'content-type'
value = '
application/pdf
' ).
_m_response->set_header_field( name = 'content-type'
value = 'application/pdf' ).
* some Browsers have caching problems when loading PDF format
_m_response->set_header_field(
name = 'cache-control'
value = 'max-age=0' ).
* start PDF viewer either in the Browser or as a separate window
pdf_in_browser = abap_true.
if pdf_in_browser is initial.
_m_response->set_header_field(
name = 'content-disposition'
value = 'attachment; filename=adobe.pdf' ).
endif.
navigation->use_auto_submit_form( ).
* finally display PDF format in Browser
l_pdf_len = xstrlen( l_pdf_xstring ).
_m_response->set_data( data = l_pdf_xstring
length = l_pdf_len ).
navigation->response_complete( ).
</pre>
Thanks, but all this I already have.
I attached 3 pictures In my first post, where I showed code the same as you have.
http://scn.sap.com/servlet/JiveServlet/download/13624370-73091/1%20PrintForm.jpg
http://scn.sap.com/servlet/JiveServlet/download/13624370-73092/2%20Convert_Otf.jpg
http://scn.sap.com/servlet/JiveServlet/download/13624370-73093/3%20fill%20data.jpg
OMG. What should I do? 😕
Sourav Bhaduri Oct 30, 2012 1:49 PM (in response to Chekalov Nikolya)
This looks more like problem with Adobe Acrobat reader. Have tried any other version of Acrobat Reader or any other machine.
I have tried on some more computer, and used Acrobat Reader from 8 to 10 version - anywhere doesn't work.
Darren Bambrick Oct 30, 2012 1:55 PM
Sorry, I can't access the images.
have you set your control parameters correctly ?
e.g.
ls_control_parameters-no_dialog = abap_true.
ls_control_parameters-getotf = abap_true
Yes, I have this too.
Use program RSTXPDFT4 to download the Spool Request as PDF to your desktop. Check if that is opening with acrobat reader.
You can also use the given program to download the Smartform as PDF directly.
http://wiki.sdn.sap.com/wiki/display/Snippets/Convert+Smartform+to+PDF+format
I show you my part code.
I can not understand why it not work.
*----------------------------------------------------------------*
DATA:
l_function_module_name TYPE rs38l_fnam,
lv_blank TYPE tdsfname.
lv_blank = 'ZTEST_PICTURE'.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = lv_blank
IMPORTING
fm_name = l_function_module_name
EXCEPTIONS
no_form = 1
no_function_module = 2
others = 3.
*----------------------------------------------------------------*
DATA:
l_devtype TYPE rspoptype.
CALL FUNCTION 'SSF_GET_DEVICE_TYPE'
EXPORTING
i_language = sy-langu
IMPORTING
e_devtype = l_devtype
EXCEPTIONS
no_language = 1
language_not_installed = 2
no_devtype_found = 3
system_error = 4
others = 5.
*----------------------------------------------------------------*
DATA:
ls_control_parameters TYPE ssfctrlop,
ls_output_options TYPE ssfcompop,
ls_output_data TYPE ssfcrescl.
ls_control_parameters-langu = sy-langu.
ls_control_parameters-no_dialog = abap_true.
ls_control_parameters-getotf = abap_true.
ls_output_options-tdprinter = l_devtype.
CALL FUNCTION l_function_module_name
EXPORTING
control_parameters = ls_control_parameters
output_options = ls_output_options
user_settings = space
IMPORTING
job_output_info = ls_output_data
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
others = 5.
*----------------------------------------------------------------*
DATA:
l_pdf_len TYPE i,
l_pdf_xstring TYPE xstring,
lt_otfdata TYPE tsfotf,
lt_lines TYPE TABLE OF tline.
lt_otfdata = ls_output_data-otfdata.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
IMPORTING
bin_filesize = l_pdf_len
bin_file = l_pdf_xstring " binary file
TABLES
otf = lt_otfdata
lines = lt_lines
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
err_bad_otf = 4
others = 5 .
*----------------------------------------------------------------*
response->set_header_field( name = 'content-type'
value = 'application/pdf' ).
response->set_header_field( name = 'cache-control'
value = 'max-age=0' ).
response->set_header_field( name = 'content-disposition'
value = 'attachment; filename=somename.pdf' ).
l_pdf_len = xstrlen( l_pdf_xstring ).
response->set_data( data = l_pdf_xstring
length = l_pdf_len ).
_m_navigation->response_complete( ).
*----------------------------------------------------------------*
Hi
I copied the code into my system CRM 7 and it works.
I have a smartform that displays an image of a graph and the code worked perfectly. I am using adobe reader 10.1.4, but I have been doing this sort of stuff for years and never had a problem with adobe reader versions.
It seems that Sourav Bhaduri is correct in saying that it is an adobe issue. Can you re-install adobe ?
User | Count |
---|---|
7 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.