如何使用c#打印数据时按文本长度设置页面大小。 [英] How to set page size as per text length while printing data using c#.

查看:234
本文介绍了如何使用c#打印数据时按文本长度设置页面大小。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个HTML模板,我将转换为 PDF。 所有现在正常运行 它转换PDF&只有1-2行在第二页中显示。所以我需要如果只有1-2行 第二页然后它在单页中打印整个数据

任何指导,建议真的很感激。

解决方案

减小字体大小,或修改其他设置以确保所有内容都在一个页面中。


不是一个好主意。我会保持原样,可能会增加一些孤儿控制。用户必须决定使用何种纸张尺寸并处理后果。无论如何,任何用户都可以预览文档并决定更改大小。



自动更改纸张大小的技巧看起来很聪明,但这不是用户想。对于用户来说,纸张尺寸的选择是主要的。如果定义不是由某些特定文本的适用性,而是许多其他的东西:企业标准,用户的纸张文件夹或内阁的大小,毕竟。 :-)



不要试图这样做。



-SA

I have a HTML template which I converted into PDF. All works fine now the issue comes when it converts PDF & only 1-2 lines shows in second page. So what I need if only 1-2 lines comes on second page then it prints entire data in single page.

Any guidance, suggestions really appreciated.

解决方案

Decrease font size,or modify the other settings to make sure all your content in one page.


Not a good idea. I would leave it as is, possibly adding some orphan control. The user must decide what paper size to use and, deal with consequences. Anyway, any user can preview the document and decide to change the size.

The trick with automatic change of the paper size only looks clever, but this is not what user wants. For a user, the choice of the paper size is primary. If is defined not by the fitness of some particular text, but many other things: corporate standards, size of the user's paper folder or cabinet, after all. :-)

Don't try to do it.

—SA


这篇关于如何使用c#打印数据时按文本长度设置页面大小。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆