请问高手有什么办法直接将PDF文件输出到打印机,当然我得自定义纸张
用printDocument能不能做?
图片是能用printed事件设置Graphi,不知道PDF怎么弄,
我用PDF带的控件使用axAcroPDF1.print()没用反应
用axAcroPDF1.printAll()就弹出有对话框,都不是我想要的,请大家帮帮我
用printDocument能不能做?
图片是能用printed事件设置Graphi,不知道PDF怎么弄,
我用PDF带的控件使用axAcroPDF1.print()没用反应
用axAcroPDF1.printAll()就弹出有对话框,都不是我想要的,请大家帮帮我
{
ProcessStartInfo startInfo = new ProcessStartInfo() ;
startInfo.UseShellExecute = true;
startInfo.Verb = "Print";
startInfo.CreateNoWindow = true;
startInfo.WindowStyle = ProcessWindowStyle.Minimized;
startInfo.FileName = filename;
processInstance.StartInfo =startInfo;
processInstance.Start();
}
catch (Win32Exception ex)
{
if (ex.NativeErrorCode == ERROR_FILE_NOT_FOUND )
{
throw new Exception("File not found in your personal folder.") ;
}
if (ex.NativeErrorCode == ERROR_ACCESS_DENIED )
{
throw new Exception("You do not have permission to print this file.");
}
}
7楼的朋友能说详细点iTextSharp怎么用么
谢谢各位了
修改下,虚拟打印机叫SmartPrinter,你可以去下载
另外也还有其它的
用Process处理对pdf文件的打印。
你在程序里直接调用执行就可以了。
using System.Drawing.Printing;
using System.Management;
...
public static void PrintDoc(string filename)
{
//检测当前打印的文档数,当超过2个时,就开始等待
PrintDocument pd = new PrintDocument() ;
StringCollection sc = GetPrintJobsCollection(pd.PrinterSettings.PrinterName);
while(sc.Count > 2)
{
Thread.Sleep(1000) ;
sc = GetPrintJobsCollection(pd.PrinterSettings.PrinterName);
}
try
{
ProcessStartInfo startInfo = new ProcessStartInfo() ;
startInfo.UseShellExecute = true;
startInfo.Verb = "Print";
startInfo.CreateNoWindow = true;
startInfo.WindowStyle = ProcessWindowStyle.Minimized;
startInfo.FileName = filename;
processInstance.StartInfo =startInfo;
processInstance.Start();
}
catch (Win32Exception ex)
{
if (ex.NativeErrorCode == ERROR_FILE_NOT_FOUND )
{
throw new Exception("File not found in your personal folder.") ;
}
if (ex.NativeErrorCode == ERROR_ACCESS_DENIED )
{
throw new Exception("You do not have permission to print this file.");
}
}
}
还有ERROR_FILE_NOT_FOUND,ERROR_ACCESS_DENIED是什么东西?
我用进程打试了,可以打
但是有个问题不知道是什么原因,就是在电脑刚开机的时候打印,打印机闪了一下,但是不打印,也没队列,
然后打开PDF,用它选择打印机来打印一张,然后再用进程打印就可以了,这个是什么原因,真的郁闷啊!
你们有没有碰到这样的问题