Sending smartform output as PDF attachment, Error opening PDF attachment
I am using the code form the following link to send a smartform output as PDF attachment. I can able to see the message, but can not open PDF document.
The information should be on my smartform are some text, company logo and a barcode.
With all of these received error: "There was an error opening this document. The file is damaged and could not be repaired."
I tried different ways like only text, text with company logo, text with barcode. I got the following errors:
An unrecognized token 'Td0' was found
There was problem reading this document(16).
There was problem reading this document(111).
Does anyone have idea of these ? Your help is greatly appreciated.
After calling FM Convert_OTF use FM SCMS_XSTRING_TO_BINARY ,you will got the binary file to send . Look at the code below ( it works fine ) .
Let me know.
data : file_to_send TYPE xstring ,
pdf_document TYPE solix_tab .
*Convert Smartforms into PDF
CALL FUNCTION 'CONVERT_OTF'
format = 'PDF'
max_linewidth = 132
bin_filesize = file_size
bin_file = file_to_send
otf = tab_otf
lines = i_tline
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
OTHERS = 4.
add attachment to document
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
buffer = file_to_send
binary_tab = pdf_document.
CALL METHOD document->add_attachment
i_attachment_type = 'PDF'
i_attachment_subject = att_subject
i_att_content_hex = pdf_document.