Skip to Content
author's profile photo Former Member
Former Member

CONVERT_OTF error while opening the file in acrobat professional.

Hi Gurus,

I'm using 'CONVERT_OTF' to convert smartform to PDF and then I'm saving the file to application server (Code shown below). ADOBE Acrobat Viewer can handle this error when you open the PDF file - you don't get an error message.

Adobe Acrobat Professional can also open the corrupted file but you'll get the following message if you close it:

'Do you want to save changes to file before closing?'

Kindly help me why some files can be processed successfully and some files gets corrupted.

call function 'CONVERT_OTF'

exporting

format = 'PDF'

max_linewidth = 132

importing

bin_filesize = v_len_in

  • BIN_FILE = LD_BINFILE

tables

otf = i_otf

lines = i_tline

exceptions

err_max_linewidth = 1

err_format = 2

err_conv_not_possible = 3

others = 4.

if sy-subrc <> 0.

perform protocol_update.

endif.

loop at i_tline.

translate i_tline using '~'.

concatenate wa_buffer i_tline into wa_buffer.

endloop.

translate wa_buffer using '~'.

do.

i_objbin = wa_buffer.

append i_objbin.

shift wa_buffer left by 255 places.

if wa_buffer is initial.

exit.

endif.

enddo.

open dataset v_unix for output in binary mode

message v_message.

if sy-subrc ne 0.

message 'Could not open file for saving' type 'E'.

endif.

loop at i_objbin.

transfer i_objbin to v_unix.

endloop.

close dataset v_unix.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 02, 2011 at 04:23 PM

    Hi

    Try to use binary data:

    CALL FUNCTION 'CONVERT_OTF'
          EXPORTING
            FORMAT                = 'PDF'
          IMPORTING
            BIN_FILESIZE          = BIN_FILESIZE
            BIN_FILE              = BIN_FILE
          TABLES
            OTF                   = OTFDATA
            LINES                 = T_LINES
          EXCEPTIONS
            ERR_MAX_LINEWIDTH     = 1
            ERR_FORMAT            = 2
            ERR_CONV_NOT_POSSIBLE = 3
            ERR_BAD_OTF           = 4
            OTHERS                = 5.
    
    PDF_CONTENT = CL_DOCUMENT_BCS=>XSTRING_TO_SOLIX( BIN_FILE ).
    
        OPEN DATASET FILE_NAME FOR OUTPUT IN BINARY MODE.
        IF SY-SUBRC <> 0.
        ENDIF.
        LOOP AT PDF_CONTENT INTO L_PDF.
          TRANSFER L_PDF TO FILE_NAME.
        ENDLOOP.
        CLOSE DATASET FILE_NAME.

    Max

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 29, 2011 at 01:18 PM

    Thanks very much Max. You solution worked. Points has been rewarded. Thanks again.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.