Mercurial > mercurial > hgweb_xdwtools.cgi
view xdwextpage.cpp @ 12:e07f9f1d1cc5 default tip
add xdw2pdf.
author | pyon@macmini |
---|---|
date | Fri, 02 Aug 2019 20:12:44 +0900 (2019-08-02) |
parents | c1ebc8b218f2 |
children |
line wrap: on
line source
/* xdwapi�̃T���v�� �@�\: DocuWorks��������w�肵���y�[�W�𒊏o */ #include <stdio.h> #include <stdlib.h> #include <io.h> #include <windows.h> #include <xdw_api.h> void print_error(int code) { switch (code) { case XDW_E_NOT_INSTALLED: fprintf(stderr, "DocuWorks���C���X�g�[������Ă��܂���B"); break; case XDW_E_FILE_NOT_FOUND: fprintf(stderr, "�w�肳�ꂽ�t�@�C����������܂���B"); break; case XDW_E_FILE_EXISTS: fprintf(stderr, "�w�肳�ꂽ�t�@�C���͂��łɑ��݂��܂��B"); break; case XDW_E_ACCESSDENIED: case XDW_E_INVALID_NAME: case XDW_E_BAD_NETPATH: fprintf(stderr, "�w�肳�ꂽ�t�@�C�����J�����Ƃ��ł��܂���B"); break; case XDW_E_BAD_FORMAT: fprintf(stderr, "�w�肳�ꂽ�t�@�C���͐������t�H�[�}�b�g�ł͂���܂���B"); break; case XDW_E_INVALID_ACCESS: fprintf(stderr, "�w�肳�ꂽ��������錠��������܂���B"); break; default: fprintf(stderr, "�G���[���������܂����B"); break; } } int main(int argc, char** argv) { int api_result = 0; if (argc != 4 ) { fprintf(stderr, "�g�p���@: xdwextpage �����t�@�C���� ���o�y�[�W �o�̓t�@�C����"); return 0; } int nPage; char in_path[_MAX_PATH], out_path[_MAX_PATH]; nPage = atoi( argv[2] ); _fullpath(in_path, argv[1], _MAX_PATH); _fullpath(out_path, argv[3], _MAX_PATH); // �����n���h�����J�� XDW_DOCUMENT_HANDLE h = NULL; XDW_OPEN_MODE_EX mode = { sizeof(XDW_OPEN_MODE_EX), XDW_OPEN_READONLY, XDW_AUTH_NODIALOGUE }; api_result = XDW_OpenDocumentHandle(in_path, &h, (XDW_OPEN_MODE*)&mode); if (api_result < 0) { print_error(api_result); return 0; } api_result = XDW_GetPage( h, nPage, out_path, NULL ); if (api_result < 0) print_error(api_result); // �����n���h������� XDW_CloseDocumentHandle(h, NULL); return (api_result >= 0); }