LCSOFT技术论坛
一个由 LCSOFT组织维护的技术论坛。
首页 搜索 用户列表 FAQ 注册 登录  
LCSOFT技术论坛 » 技术专区 » C++Builder天地 » Re: 怎么用BCB打印prn文件?
  Re: 怎么用BCB打印prn文件?
帖子发起人: bzqcdd   发起时间: 2008-07-11 04:59 下午   回复数: 2
« 上一主题 下一主题 »
楼主
  2008-07-11, 04:59 下午
bzqcdd 离线,最后访问时间: 2008-7-15 11:04:04 bzqcdd

发帖数前75位

士兵
等级: 士兵
注册: 2008年7月11日
积分: 3
精华: 0
发贴: 2
怎么用BCB打印prn文件?
 
用打印到文件生成.prn,把.prn送到打印机打印。用BCB如何实现?
IP 地址: 已登录   来自: 已登录    返回顶部
第 2 楼
  2008-07-11, 11:11 下午
小林子 离线,最后访问时间: 2008-7-11 23:11:33 小林子



发帖数前10位
男

版主
职务: 版主
排长
等级: 排长
注册: 2005年11月10日
积分: 99
精华: 0
发贴: 84
Re: 怎么用BCB打印prn文件?
 
//////////////////////////////////////////////////////////////////////////////
//方法:InnerPrint
//功能:打印报表
//参数:无
//返回:无
//备注:无
//////////////////////////////////////////////////////////////////////////////

void __fastcall TPrintXImpl::InnerPrint()
{
FILE *prn = NULL;

//初始化打印设备
if (this->printerName == NULL || this->printerName.IsEmpty())
{
prn = fopen("prn", "w");
}
else
{
prn = fopen(this->printerName.c_str(), "w");
}

//检测打印设备
Check(prn);

TStringList *dataLines = P***DataSource(this->dataSourceString);
if (dataLines == NULL)
{
throw Exception("数据源为空!");
}

//打印
for (int i=0; i<dataLines->Count; i++)
{
/*
if (i == 0)
{
PrintOptions printOptions;

printOptions.Center = true;
printOptions.FontSize = -1;

InnerPrintLine(prn, dataLines->StringsIdea, printOptions);
}
else
{
InnerPrintLine(prn, dataLines->StringsIdea);
}
*/

InnerPrintLine(prn, dataLines->StringsIdea);
}

//切纸操作
if (bCutPaper)
{
this->InnerCutPaper(prn);
}
else
{
this->InnerEndPrint(prn);
}

if (dataLines != NULL)
{
delete dataLines;
dataLines = NULL;
}

if (prn != NULL)
{
//关闭打印设备
fclose(prn);
prn = NULL;
}
}
IP 地址: 已登录   来自: 已登录    返回顶部
第 3 楼
  2008-07-14, 04:43 下午
bzqcdd 离线,最后访问时间: 2008-7-15 11:04:04 bzqcdd

发帖数前75位

士兵
等级: 士兵
注册: 2008年7月11日
积分: 3
精华: 0
发贴: 2
Re: 怎么用BCB打印prn文件?
 
谢谢楼上,上面一段代码不太懂。我想要实现的就像http://www.china-askpro.com/download/Spool.zip这个软件的功能。就是指定.prn文件的路径,送到指定打印机,执行打印。FastPrint也能实现此功能,我就是想在我的程序中嵌入这个功能,不需要再打开另外的软件。请帮帮忙,谢谢!
IP 地址: 已登录   来自: 已登录    返回顶部
 第 1 页 总共 1 页 [共有 3 条记录]
LCSOFT技术论坛 » 技术专区 » C++Builder天地 » Re: 怎么用BCB打印prn文件?
版权所有 © LCSOFT  粤ICP备06035424号