Exemplo n.º 1
0
void hpdf_doc::place_image(int x0, int y0, int x1, int y1, int ev, wstring filename)
{
	string filepath = WstringToString(filename);

	HPDF_Image img = HPDF_LoadJpegImageFromFile(h_pdf, filepath.c_str());
	if (img == NULL) return;

	HPDF_REAL fpx = ((HPDF_REAL)x0 * 72.0 / 1000.0);
	HPDF_REAL fpy = ((HPDF_REAL)y0 * 72.0 / 1000.0);
	HPDF_REAL fwidth = ev * ((HPDF_REAL)(x1 - x0) * 72.0 / 1000.0);
	HPDF_REAL fheight = ev * ((HPDF_REAL)(y1 - y0) * 72.0 / 1000.0);
	HPDF_REAL f_ypos = f_length - fpy - fheight;

	HPDF_Page_DrawImage(h_current_page, img, fpx, f_ypos, fwidth, fheight);

}
Exemplo n.º 2
0
bool LineConfigDataManager::Persistent()
{
	//std::ofstream ofs(PERSISTENT_FILE);
    //assert(ofs.good());

    //boost::archive::xml_oarchive oa(ofs);
	//boost::archive::text_oarchive oa(ofs);

	acutPrintf(L"开始保存管线类型\n");

	CFile archiveFile(PERSISTENT_FILE,CFile::modeCreate|CFile::modeWrite);

	typedef vector<LineCategoryItemData*>::const_iterator DataIterator;

	//遍历所有的类型定义
	for( DataIterator iter = mLineConfigData->begin(); 
			iter != mLineConfigData->end(); 
			iter++)
	{
		LineCategoryItemData* data = *iter;

		if( data )
		{
			//得到消息的宽字符序列化
			wstring wData = data->toString();

			//转为窄字符
			string dataStr = WstringToString(wData);

			//acutPrintf(L"管线类型数据 [%s] [%d]\n",wData.c_str(),(UINT)dataStr.length());

			//使用 virtual void Write( const void* lpBuf, UINT nCount ); 将窄字符写入文件
			archiveFile.Write(dataStr.c_str(),dataStr.size());

			//oa << BOOST_SERIALIZATION_NVP(*data);
			//oa << *data;
		}
	}

	acutPrintf(L"管线类型保存完成\n");
	archiveFile.Close();

	return true;
}
int NASCToolBox::TimeToInt( wstring Time ) const
{
	return TimeToInt( WstringToString( 936, Time ) );
}
int NASCToolBox::StringToInt( wstring wstr ) const
{
	return StringToInt( WstringToString( 936, wstr ) );
}
Exemplo n.º 5
0
 bool WstringToUTF8String(const wstring& wstr, string& strUTF8)
 {
     return WstringToString(CP_UTF8, wstr, strUTF8);
 }