WfrLib.PdfServer wfrPdf;

//PDF Serverのオブジェクトを作成(この処理で発生するエラーは常に例外となります)
try
{
    wfrPdf = WfrLib.PdfServer.CreateObject();
}
catch (Exception ex)
{
    MessageBox.Show(ex.Message);
    return;
}

//戻り値でエラー処理を行うように設定
wfrPdf.SetErrorMode(0)
;

do {
    //帳票定義ファイル(*.wfr)のオープン
    if (wfrPdf.Open("c:\\sample\\sample.wfr") != 0)
    {
        break;
    }

    //データの入力
    if (wfrPdf.Import("Data1", 0, "c:\\sample\\sample.csv") != 0)
    {
        break;
    }

    //出力イメージの作成とPDFへの出力
    if (wfrPdf.PdfOut("c:\\out\\sample.pdf") != 0)
    {
        break;
    }
} while ( false );

//エラーメッセージの表示
if (wfrPdf.GetLastErrorCode() != 0) {
    MessageBox.Show(wfrPdf.GetLastErrorMsg());
}

//オブジェクトの破棄
wfrPdf.Dispose();