Creating PDF on UTF-8

I run the following program in COBOL_CHARACTER_SET 950 environment is OK but in COBOL_CHARACTER_SET UTF-8 return error 48,02.

 

       identification division.
       program-id. TESTPDF.
       ENVIRONMENT DIVISION.
       CONFIGURATION SECTION.
       SPECIAL-NAMES.
       input-output section.
       file-control.
           select file-output
           ASSIGN TO ws-printer
           organization is LINE SEQUENTIAL
           FILE STATUS IS FILE-STATUS.
   
       data division.
       file section.             
       FD file-output.
       01 file-output-rec.
           05 file-record           PIC  X(132).
   
   
       working-storage section.
       77 FILE-STATUS          pic XX.
   
       01 WS-PRINTER           PIC X(51) VALUE spaces.
   
       procedure division.
       main-logic.

           move "-p pdf c:\test\PRINT1.PDF" to ws-printer

           open output file-output.
           move "Test Print" to file-record
                   write file-output-rec
           close file-output.

           stop run.

  • When attempting to use UTF-8, you need to specify a font, a truetype font.
    The configuration file when using a TrueType .ttf file should look something like this:
    cobol-character-set utf-8
    pdf_font_type truetype
    pdf_font_truetype_ttf cambriab.ttf
    When using a TrueType .ttc file the configuration should look something like this:
    cobol-character-set utf-8
    pdf_font_type truetype
    pdf_font_truetype_ttc cambria.ttc
    pdf_font_truetype_ttc_index 1
  • Same error occurs.

    Never mind. We already have export report to PDF function using pdf printer driver. We are just looking for simpliest way to do it.