Skip to Content
0
Sep 05, 2023 at 08:45 AM

#COE KKS01 Issue with Print Queue

152 Views

Hello everyone,

We are developing an application for printing adobeform directly in public cloud

Before 23.08 update, Our pdf file was sent to the print queue and printed directly.

However, after the 23.08 update, our file is sent to the print queue, but we need to click the "Create Test Page" button to print the file.

We want to print the file directly. Any help would be appreciated.

We are using post method for send necessary data to adobe service and using create method to send it.

We are parsing the returning binary data to iv_print_data,

name of queue to iv_qname,

and file name to iv_name_of_main_doc parameters.

METHOD pdf_to_print.

    TYPES: BEGIN OF ty_pdf,
             fileName(120) ,
             fileContent   TYPE xstring,
             qname(32),
           END OF ty_pdf. 
    DATA ls_pdf TYPE ty_pdf.

    DATA:lv_buffer       TYPE xstring.

    DATA(lo_client) = NEW zcl_fp_client(
          iv_name = *********
        ).

    DATA(lv_x_xml) = xco_cp=>string( iv_xml_raw )->as_xstring( io_conversion = xco_cp_character=>code_page->utf_8  )->value.

    DATA(lv_xml_encode) = cl_web_http_utility=>encode_x_base64( lv_x_xml ).

    DATA(lv_rendered_pdf) = lo_client->reder_pdf( iv_xml = lv_xml_encode
                                                  iv_form_name      = iv_form_name
                                                  iv_template_name  = iv_template_name    ).
    /ui2/cl_json=>deserialize(
          EXPORTING
          json = lv_rendered_pdf
          CHANGING
          data = ls_pdf
          ).

    IF  ls_pdf IS NOT INITIAL.

      IF iv_pdf_name IS NOT INITIAL.
        ls_pdf-filename = iv_pdf_name.
      ENDIF.
      DATA(lv_qitem_id) = cl_print_queue_utils=>create_queue_itemid(   ).

      cl_print_queue_utils=>create_queue_item_by_data(
                            EXPORTING
                               iv_qname = iv_printer_name
                               iv_print_data = ls_pdf-filecontent"
                               iv_name_of_main_doc = ls_pdf-filename
                               iv_itemid = lv_qitem_id
                            IMPORTING
                              ev_err_msg          = rv_error
                            RECEIVING
                              rv_itemid           = lv_qitem_id  ).

    ELSE.

      rv_error = 'Adobe servisinin ' && iv_form_name && ' formunun ' && iv_template_name && ' templatinden PDF oluşturulamamıştır.' ##NO_TEXT .


    ENDIF.

  ENDMETHOD.