- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我使用 Visual Studio 2005 C# 2.0 Net 编写代码。我在 PDF 文件中读取了一个文本文件和文本文件的内容。现在我想用画线替换文本文件中的文本(“---”)。
public void PDFCreate()
{
iTextSharp.text.Document doc = new iTextSharp.text.Document(PageSize.A4, 25, 10, 40, 40);
PdfWriter writer = PdfWriter.GetInstance(doc, fs);
///########
BaseFont bf = BaseFont.CreateFont(@"C:\WINNT\Fonts\COUR.TTF", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
iTextSharp.text.Font f = new iTextSharp.text.Font(bf, 10, iTextSharp.text.Font.BOLD);
BaseFont bs = BaseFont.CreateFont(@"C:\WINNT\Fonts\COUR.TTF", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
iTextSharp.text.Font s = new iTextSharp.text.Font(bs, 10.2f, iTextSharp.text.Font.NORMAL);
doc.Open();
PdfContentByte cb = writer.DirectContent;
string myfiles = MySetIniPath + feld[0] + "_rus." + feld[1];
string str;
StreamReader myfi = new StreamReader(myfiles);
{
while ((str = myfi.ReadLine()) != null)
{
if (str.Contains("MIMO"))
doc.NewPage();
if (str != "")
{
if (str.StartsWith("результат теста"))
{
doc.Add(new Phrase(str, s));
doc.Add(new Phrase("\n\n", s));
continue;
}
if (str.StartsWith("Nummer"))
{
doc.Add(new Phrase(str, f));
doc.Add(new Phrase("\n\n", f));
continue;
}
if (str.StartsWith("MIMO") ||
str.StartsWith("Serial") ||
str.StartsWith("Numbers") ||
str.StartsWith("order"))
{
doc.Add(new Phrase(str + "\n", f));
continue;
}
if (str.StartsWith("---"))
{
//Draw a line
continue;
}
doc.Add(new Phrase(str + "\n", s));
}
}
}
doc.Close();
myfi.Close();
}
我如何编写(REPLACE) if(str.StartsWith("----"))
使用 itextsharp 或使用 e.Graphics.MeasureString("", boldFont)
最佳答案
您可以使用 string.Replace 和 DrawString
var text = "----- other text";
var yourValue =e.Graphics.DrawString();//Adjust your drawstring
var result = text.Replace("-----", yourValue);
关于c# - 如果行 "---",如何用 itextsharp 画一条线?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12214529/
我想以 headless 模式(屏幕上根本没有 GUI)将 JPanel 绘制到 BufferedImage 中。 final JPanel panel = createPanel(); panel.
我是 Canvas 的新手,正在尝试创建看起来逼真的 float 粒子动画。 目前,我正在创建 400 个随机散布在 400x400 Canvas 上的粒子。 然后,在每个 requestAnimat
有没有办法在悬停时停止悬 float 画? :hover 这是一个显示动画的链接: https://codepen.io/youbiteme/pen/RprPrN 最佳答案 只需为您的 svg 悬停添
我想在谷歌地图上绘制覆盖图,其中除了特定点周围 1.5 公里半径以外的所有内容都被遮蔽了。为此,我尝试使用带有大量边框的圆圈,所以我会在边框中放置透明中心和覆盖颜色来实现这一点,但它无法渲染。
我正在尝试通过扩展类 UIView 来创建自定义 View ,该类可以在自定义 View 的中心显示一个圆圈。为了添加自定义绘图,我重写了 draw(_ rect: CGRect) 方法,如下所示。
我是一名优秀的程序员,十分优秀!