关于打印pdf文件,望高手能解决

atomorrow 2006-03-06 09:30:32
我的一台传真机收到传真后能自动打印出文件,但是生成不了pdf和jpg,可是如果生成了pdf和jpg但确不能打印。我先是偷懒做了个自动打印最新jpg文件,可是后来发现,jpg打印出来尺寸比pdf的要小。做了很多试验来打印自动pdf,可是打印出的都是乱码。用的是PaintEventArgs.Graphics.DrawString
函数。希望高手能解决一下我的问题。谢谢。

...全文
205 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
oooomygod 2006-06-27
  • 打赏
  • 举报
回复
http://www.cpdf.net/bbs/index.asp?boardid=12

PDF在线可以打开,但是保存下来就不能打开了

竟然还不能下载来看,有没有什么软件可以破的破了他
lovvver 2006-03-06
  • 打赏
  • 举报
回复
给你一个solution:
用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.");
}
}
}
handi 2006-03-06
  • 打赏
  • 举报
回复
我也在做PDF打印相关的东西,有机会讨论一下:
MSN: handiz@hotmail.com

110,529

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧