使用wkhtmltopdf.exe将html转换为PDF

使用wkhtmltopdf.exe将html转换为PDF

问题描述:



我正在尝试使用以下代码在我的应用程序中将HTML文件转换为PDF

Hi,

i am trying to convert a HTML file to PDF in my application using the below code

csHTMLToPDFCommand.Format( _T( "wkhtmltopdf.exe %s %s", _T( "TempPrint.htm"), _T( "D:\\Temp" ) );
STARTUPINFO sInfo; 
ZeroMemory( &sInfo, sizeof( sInfo ));
PROCESS_INFORMATION pInfo; 
ZeroMemory( &pInfo, sizeof( pInfo ));
sInfo.cb = sizeof( sInfo );
sInfo.dwFlags = STARTF_USESTDHANDLES;
sInfo.hStdInput = NULL; 
if( !::CreateProcess( 0, csHTMLToPDFCommand.GetBuffer(), 0, 0, TRUE, NORMAL_PRIORITY_CLASS|CREATE_NO_WINDOW, 0, 0, &sInfo, &pInfo ))
                {
                    DWORD dwError;
                    dwError = GetLastError();
                }



在指定的路径中未创建PDF文件.但是create Process也不会返回任何错误.

谁能帮助我解决可能出现的问题..



The PDF file is not created in the path specified. but create Process doesnt return any error either.

can anyone help me with what could be the problem..

问题已解决.
我必须先运行exe的安装程序,然后才能运行它. :)
Issue got fixed.
i had to run an installer for the exe before running it Smile | :)