[英]I'm trying to use PDFSharp but I can't find predefinedFont.csHelvetica
This is the code: 这是代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using sharpPDF;
namespace Lightnings_Extractor
{
class PDF
{
pdfDocument myDoc = new pdfDocument("Lightnings-Graphs", "Daniel");
public PDF()
{
pdfPage myPage = myDoc.addPage();
myPage.addText("Hello World!", 200, 450, predefinedFont.csHelvetica, 20);
myDoc.createPDF(@"d:\mypdf.pdf");
myPage = null;
myDoc = null;
}
}
}
predefinedFont
does not exist. predefinedFont
字体不存在。
So I tried to write: 所以我试图写:
sharpPDF.Fonts.pdfAbstractFont font;
But then when I tried to create font, there is no csHelvetica
但是当我尝试创建字体时,没有csHelvetica
What am I missing here ? 我在这里想念什么?
I used sharpPDF in mistake. 我错误地使用了SharpPDF。 I have downloaded now PDFsharp. 我现在已经下载了PDFsharp。
Thanks. 谢谢。
Replace the following line by 将以下行替换为
myPage.addText("Hello World!", 200, 450, predefinedFont.csHelvetica, 20);
by 通过
myPage.addText("Hello World!", 200, 450, myDoc.getFontReference(predefinedFont.csHelvetica), 20);
It works for me. 这个对我有用。
尝试用myDoc.getFontReference("Helvetica")
替换predefinedFont.csHelvetica
的myDoc.getFontReference("Helvetica")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.