Skip to Content
avatar image
Former Member

Smartforms (OTF) converted in PDF, but BOLD dosen't work

Hello SAP masters,

I'm generating a PDF by a Smartform.

The font taht i'm using in the form is TIMES.

When doing the preview, or even printing the form the bold text appears correctly, but when generating the PDF, it just don't work.

I used both functions CONVERT_OTF_2_PDF and CONVERT_OTF, and they failed to generate the bold text.

Here's the code:

.........................CONVERTE OTF PARA PDF.......................

CALL FUNCTION 'CONVERT_OTF_2_PDF'

IMPORTING

bin_filesize = v_bin_filesize

TABLES

otf = st_job_output_info-otfdata

doctab_archive = it_docs

lines = it_lines

EXCEPTIONS

err_conv_not_possible = 1

err_otf_mc_noendmarker = 2

OTHERS = 3.

IF sy-subrc NE 0.

WRITE:/ 'A conversão do arquivo OTF para PDF falhou.'.

EXIT.

ENDIF.

........................ADQUIRI O NOME DO ARQUIVO....................

CONCATENATE v_delegado '-' v_delegacia '-' v_endereco1 ', ' v_endereco2 INTO v_namef.

CREATE OBJECT v_guiobj.

CALL METHOD v_guiobj->file_save_dialog

EXPORTING

default_extension = 'pdf'

default_file_name = v_namef

file_filter = v_filter

CHANGING

filename = v_namef

path = v_path

fullpath = v_fullpath

user_action = v_uact.

IF v_uact = v_guiobj->action_cancel.

EXIT.

ENDIF.

..................................DOWNLOAD COMO ARQUIVO....................

MOVE v_fullpath TO v_filename.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

bin_filesize = v_bin_filesize

filename = v_filename

filetype = 'BIN'

confirm_overwrite = 'X'

TABLES

data_tab = it_lines

EXCEPTIONS

file_write_error = 1

no_batch = 2

gui_refuse_filetransfer = 3

invalid_type = 4

no_authority = 5

unknown_error = 6

header_not_allowed = 7

separator_not_allowed = 8

filesize_not_allowed = 9

header_too_long = 10

dp_error_create = 11

dp_error_send = 12

dp_error_write = 13

unknown_dp_error = 14

access_denied = 15

dp_out_of_memory = 16

disk_full = 17

dp_timeout = 18

file_not_found = 19

dataprovider_exception = 20

control_flush_error = 21

OTHERS = 22.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Dec 21, 2011 at 03:49 AM

    Hi ,

    I think below sample code will give you some idea to solve your issue.

    DATA : lt_otf TYPE tsfotf,

    lt_pdf_tab TYPE TABLE OF tline,

    lv_bin_filesize TYPE sy-tabix.

    CALL FUNCTION 'CONVERT_OTF'

    EXPORTING

    format = 'PDF'

    max_linewidth = 132

    IMPORTING

    bin_filesize = lv_bin_filesize

    TABLES

    otf = lt_otf

    lines = lt_pdf_tab

    EXCEPTIONS

    err_max_linewidth = 1

    err_format = 2

    err_conv_not_possible = 3

    err_bad_otf = 4

    OTHERS = 5.

    .

    IF sy-subrc <> 0.

    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

    ENDIF.

    CALL FUNCTION 'WS_FILENAME_GET'

    EXPORTING

    def_filename = '*.pdf'

    • mask = ',Text files (.txt),.txt.'

    mode = 'O'

    title = 'Down load file'

    IMPORTING

    filename = lv_file

    EXCEPTIONS

    inv_winsys = 1

    no_batch = 2

    selection_cancel = 3

    selection_error = 4

    OTHERS = 5.

    lv_full_path = lv_file .

    CALL FUNCTION 'GUI_DOWNLOAD'

    EXPORTING

    bin_filesize = lv_bin_filesize

    filename = lv_full_path

    filetype = 'BIN'

    confirm_overwrite = 'X'

    TABLES

    data_tab = lt_pdf_tab

    EXCEPTIONS

    file_write_error = 1

    no_batch = 2

    gui_refuse_filetransfer = 3

    invalid_type = 4

    no_authority = 5

    unknown_error = 6

    header_not_allowed = 7

    separator_not_allowed = 8

    filesize_not_allowed = 9

    header_too_long = 10

    dp_error_create = 11

    dp_error_send = 12

    dp_error_write = 13

    unknown_dp_error = 14

    access_denied = 15

    dp_out_of_memory = 16

    disk_full = 17

    dp_timeout = 18

    file_not_found = 19

    dataprovider_exception = 20

    control_flush_error = 21

    OTHERS = 22.

    IF sy-subrc NE 0.

    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

    ENDIF.

    ENDIF.

    I hope this will be helpful for you to solve this issue.

    Thanks & Regards,

    Kumaran Duraiswamy.

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 21, 2011 at 06:35 AM

    Hi ,

    Check if TIMES font is present and active in SAP in SE73.

    Thanks and Regards,

    Sriranjani Chimakurthy.

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 21, 2011 at 09:54 AM

    Hi

    Please refer the following link then you will get idea about printing smart form in PDF format..

    [http://wiki.sdn.sap.com/wiki/display/Snippets/ConvertSmartformtoPDFformat]

    in addition you can check the system fonts for that go to se73 then there you can adjust the times font properties...

    Thanks&Regards

    Sreenivas Pachva

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 22, 2011 at 08:43 AM

    Check the font times is available in se73. R u using smartstyles if not use that that will solve ur problem

    Add comment
    10|10000 characters needed characters exceeded