KDK_PRINTER_GET_JOB_STATUS(3)

NAME
kdk_printer_get_job_status - 获取当前打印任务状态（发送打印任务之后下需要等待一会再获取状态,状态不是实时更新）

SYNOPSIS
#include <libkyprinter.h>

extern int kdk_printer_get_job_status(const char *printername, int jobid);

Link with -lkyprinter.

Detailed Description
The main function of the interface is to obtain the current print task status (after sending the print task, you need to wait for a while to get the status, the status is not updated in real time).

The argument printername is printer name, kdk_printer_get_list returned value. The argument jobid is the id of the print job.

RETURN VALUE
On success, returns status code of type int.

On error, return 0.

EXAMPLES
    #include "libkyprinter.h"
    #include <stdio.h>
    int main()
    {
        int index = 0;
        //获取打印机列表
        char **printers = kdk_printer_get_available_list();
        while (printers[index])
        {
            printf("%zd: %s, index + 1, printers[index]);
            //取消当前打印机所有打印任务
            kdk_printer_cancel_all_jobs(printers[index]);
            //获取url对应的文件名
            char *url = "http://www.cztouch.com/upfiles/soft/testpdf.pdf";
            int res = -1;
            char *filename = kdk_printer_get_filename(url); //从完整路径名中解析出文件名称，例如：/home/test/abc.txt,解析完成后为abc.txt
            printf("filename = %s, filename);
            //设置打印参数
            kdk_printer_set_options(2, "A4", "lrtb", "two-sided-long-edge");
            //下载
            res = kdk_printer_print_download_remote_file(url, filename);
            printf("[%s] res = %d, __FUNCTION__, res);
            printf("[%s] filepath = %s, __FUNCTION__, filename);
            //打印
            int job_id = kdk_printer_print_local_file(printers[index], filename);
            if (job_id == 0)
            {
                //打印失败
                printf("[%s] create print job fail, __FUNCTION__);
            }
            else
            {
                //打印成功，等待一会获取任务状态
                sleep(10);
                int status = kdk_printer_get_job_status(printers[index], job_id);
            }
            index++;
            free(filename);
        }
        kdk_printer_freeall(printers);
        return 0;
    }

CONFORMING TO
These functions are as per the withdrawn POSIX.1e draft specification. The following functions are Linux extensions: kdk_printer_get_list(), kdk_printer_get_available_list(), kdk_printer_set_options(), kdk_printer_print_download_remote_file(), kdk_printer_print_local_file(), kdk_printer_cancel_all_jobs(), kdk_printer_get_status(), kdk_printer_get_filename() and kdk_printer_freeall().

SEE ALSO
kdk_printer_get_list(3), kdk_printer_get_available_list(3), kdk_printer_set_options(3), kdk_printer_print_download_remote_file(3), kdk_printer_print_local_file(3), kdk_printer_cancel_all_jobs(3), kdk_printer_get_status(3), kdk_printer_get_filename(3) and kdk_printer_freeall(3).