wafuの技術

技術習得の努力メモです。

C++でlibharu(1)文字(Shift-JIS)のPDF

今度は、C++とlibharuで、文字(Shift-JISを出力します。

 

ソース

    HPDF_Doc pdf;
    HPDF_Font font;
    HPDF_Page page;

    pdf = HPDF_New(NULL, NULL);

    HPDF_UseJPFonts (pdf);
    HPDF_UseJPEncodings (pdf);

    font = HPDF_GetFont (pdf,  "MS-Gothic", "90ms-RKSJ-H");

 

    page = HPDF_AddPage(pdf);

    HPDF_Page_SetHeight (page, 600);
    HPDF_Page_SetWidth (page, 400);

 

    HPDF_Page_BeginText(page);
    HPDF_Page_SetFontAndSize(page, font, 20.0);

 

    HPDF_Page_MoveTextPos(page, 10, 190);

    HPDF_Page_ShowText(page, "show text");

 

    HPDF_SaveToFile(pdf, "output_shift_jis.pdf");

    HPDF_Free (pdf);