的基础上计算可用宽度和字体文字高度? [英] Calculate text height based on available width and font?

查看:146
本文介绍了的基础上计算可用宽度和字体文字高度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们都在从数据库中动态创建PDF文档使用 PDFsharp

我需要知道计算文本区域的基于高度的最佳方式 所用的字体和可用宽度

我需要知道的高度,以便在需要时我可以处理分页符。

解决方案
  

在.NET中你可以调用   Graphics.MeasureString找出如何   大绘制的文本将是。

右,但使用PDFsharp当你调用XGraphics.MeasureString。

We are creating PDF documents on the fly from the database using PDFsharp.

I need to know the best way to calculate the height of the text area based on the font used and the available width.

I need to know the height so I can process page breaks when required.

解决方案

In .NET you can call Graphics.MeasureString to find out how large the drawn text is going to be.

Right, but when using PDFsharp you call XGraphics.MeasureString.

这篇关于的基础上计算可用宽度和字体文字高度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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