!!!!!!!!!!!silverlight打印,各位看官请进来给点意见

jin20000 2012-07-30 03:34:09
首先,说一下我这的情况,
项目是silverlight+webservice(c#)
原来silverlight4的时候,打印的都是位图的,位图打印太大了,打印一页很简单的page,都100来MB(打印机状态那能看到),就升级到silverlight5,但发现5的打印也是要打印机和驱动都支持postScript的才是矢量打印,否则还是位图打印,但现在的打印机基本上都是支持PCL的(HP针对postScript推出的一个打印机语言,postscript是要收费的),所以悲剧了,
初步有2个想法,不知道可行不可行,请大家帮忙考虑一下,
1.打印的page转换成pdf,做预览,利用pdf的打印,问题在于silverlight里的pdf生成还有是否有pdf的打印可以调用,
2.利用webservice(c#)这个后台打印,问题在于webserivce调用的是服务器的打印机,也不太好设置一些打印设置,

欢迎其他的思路,顺便鄙视一下MS,silverlight组



ps:受等级所限,分只能这么多,真有好方法,可以另开贴加分,

...全文
442 19 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
19 条回复
切换为时间正序
请发表友善的回复…
发表回复
huajian2008 2012-08-26
  • 打赏
  • 举报
回复
不支持矢量打印的打印机,只能调低打印机的分辨率了。
对打印研究不多,我主要是用:http://www.cnblogs.com/slmk/archive/2012/07/18/2570303.html 提供的解决方案。
jin20000 2012-08-09
  • 打赏
  • 举报
回复
算鸟,没人,结了
liouhaixiang5644 2012-08-09
  • 打赏
  • 举报
回复
求大侠帮忙...
liouhaixiang5644 2012-08-09
  • 打赏
  • 举报
回复
http://topic.csdn.net/u/20120809/17/bce4cc60-a681-4274-9704-3e7b5fe59212.html
jin20000 2012-08-01
  • 打赏
  • 举报
回复
各位有在OOB下处理过打印的么,sl4和5都行
jin20000 2012-07-31
  • 打赏
  • 举报
回复
比较悲催的是用的是oob模式,用pdf来做预览并使用pdf的打印,
通过外部dll来调用外部打印,

@bushiyundeyu,有处理过oob的打印的么?
Architecture Net 2012-07-31
  • 打赏
  • 举报
回复
[Quote=引用 11 楼 的回复:]

[/Quote]

遇到过这种情况,最后项目中是使用Silverlight弹出一个ASPX页面,然后调用JS方法打印的。没有必要直接在SL中进行打印~~~
jin20000 2012-07-31
  • 打赏
  • 举报
回复
额,上传图片,好难
jin20000 2012-07-31
  • 打赏
  • 举报
回复
jin20000 2012-07-31
  • 打赏
  • 举报
回复

上面是打印机状态的图片,
说明一下,我的打印是,打印机是局域网共享的,
silverlight是OOB模式,

@wwwljh,单页打印也是一样的.

@zwbking,你说的这个lodop有silverlight的么?oob不能调用js的呃,其实你说的这个方法有点类似,改用web了
zwbking 2012-07-31
  • 打赏
  • 举报
回复
silverlight打印输出的是位图,打印文件都会很大。你可以看下lodop这个web的打印控件,定义一个web页面,从silverlight中把数据传给web,然后进行web打印。lodop控件中有很多设置,你可以研究下。我是这么做的
wwwljh 2012-07-30
  • 打赏
  • 举报
回复
只做过单据的打印。数量量不大。没有注意到生成的打印数据是那么大。反正你也是分页打印。你不一次性PrintDocument.Print。你分页一页一页PrintDocument.Print也会出现这种问题?
jin20000 2012-07-30
  • 打赏
  • 举报
回复
"If your content or your printer doesn't support PostScript printing, Silverlight automatically falls back to sending an uncompressed bitmap to the printer."
-----------------------------------
So, for the most efficient printing of multi-page reports, you'll want to make sure you do the following:

Have a PostScript-compatible printer with an appropriate PostScript driver (typically ends with " PS")
Avoid Opacity other than 1.0 in your elements to be printed (or use the appropriate fallback settings)
Leave out perspective transforms, 3d, and other things not compatible with PostScript printing.
-----------------------------
This might be due to the driver. If the driver of the printer is not able to translate the Silverlight graphics into vectors, all it can do is print it as a bitmap.

I tried to force Silverlight into using Vectors but my printer didn't support PostScript. So I switched to a printer that does and suddenly it's just kilobytes.

I see only two ways to avoid bitmap printing:

Get a PostScript printer or

Create a printer friendly document (PDF, Word, text) on the server and allow the client to download and print it by hand.
jin20000 2012-07-30
  • 打赏
  • 举报
回复
我也找了一些国外论坛,但基本上没有发现有什么好的方法,不知道,大家有没有遇到过,或者说在silverlight打印多页时是怎么处理的?
jin20000 2012-07-30
  • 打赏
  • 举报
回复
是这样,其实就是在silverlight客户端这边定义了一个PrintDocument,然后丢了几个page页进去,也做了分页,基本上一页在100MB左右,页面里其实就是一个datagrid显示数据,加几行表头而已,
在我设置完打印页内容,调用PrintDocument.Print方法后,
但是在我的打印机看到了如下图:

我的打印机不是连在我的机器上的,是局域网内的另外一台机器上的.
但在传输的时候发现,传输大小一页基本上100MB左右,太大了,
wwwljh 2012-07-30
  • 打赏
  • 举报
回复
什么位图会这么大。silverlight在客户端打印。这么大的位图是哪来的?怎么传到客户端的?
jin20000 2012-07-30
  • 打赏
  • 举报
回复
额,补充一下,说还打印机的就算了
jin20000 2012-07-30
  • 打赏
  • 举报
回复
据说沙发不能说自________沙,要说自己的沙发

8,756

社区成员

发帖
与我相关
我的任务
社区描述
WPF/Silverlight相关讨论
社区管理员
  • WPF/Silverlight社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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