简体   繁体   English

我正在尝试使用PDFSharp,但找不到预定义的Font.csHelvetica

[英]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.csHelveticamyDoc.getFontReference("Helvetica")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我正在使用 PdfSharp,但找不到 class BeginBox 它在哪里? - I'm using PdfSharp and can't find the class BeginBox where is it? 如何在PDFsharp中使用等宽字体? - How can I use a monospace font with PDFsharp? 我要使用的单位列表中出现一个奇怪的错误,而我却找不到答案 - I have a weird error for a list in unity I'm trying to use, and I just couldn't find an answer for it 如何使用PDFSharp查找和替换? - How can I do a find & replace using PDFSharp? 我正在尝试向此样式添加验证交互,但找不到该属性。 这里有什么问题? - I'm trying to add validation interaction to this style but it can't find the property. Whats wrong here? PDFsharp无法找到图像(未找到图像) - PDFsharp can't find image (image not found) 我正在使用 MigraDoc 和 PdfSharp(.Net 标准),但是当我尝试创建段落时,出现错误:“找不到合适的字体” - I am using MigraDoc and PdfSharp (.Net Standard), but when I'm trying to create a paragraph,I get an error: “No appropriate font found” 我正在尝试使用backgroundworker但它不起作用 - 为什么? - I'm trying to use backgroundworker but it doesn't work - why? 错误:“; 预期”,找不到我想念的地方 - Error: “; expected”, can't find where I'm missing it 如何在 PDFsharp 中使用资源图像? - How do I use a Resources Image with PDFsharp?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM