本文介绍了使用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..

推荐答案


这篇关于使用wkhtmltopdf.exe将html转换为PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-22 22:29