找不到itextsharp颜色对象 [英] itextsharp Color Object Could not found

查看:79
本文介绍了找不到itextsharp颜色对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是我在另一个Code Project帖子中找到的代码片段。



使用System; 
使用System.Collections.Generic;
使用System.Text;

使用iTextSharp.text;
使用iTextSharp.text.pdf;


namespace pdf
{
class program
{
static void Main(string [] args)
{

Rectangle pageSize = new Rectangle(144,720);
pageSize.BackgroundColor = new Color(0xFF,0xFF,0xDE);
文件文件=新文件(pageSize);

}
}
}



 pageSize.BackgroundColor =  new 颜色(0xFF,0xFF,0xDE); 





生成以下构建错误消息

无法找到类型或命名空间名称'Color'(您是否缺少using指令或汇编参考?)



我添加了itextsharp.dll作为参考,并包含使用指令

 使用 iTextSharp.text ; 
使用 iTextSharp.text.pdf;





可以有人请告诉我这些问题是什么?

解决方案

颜色类 [ ^ ]驻留在Sytem.Drawing命名空间中。


尝试使用BaseColor而不是Color


将颜色更改为BaseColor它将工作

Here is a snippet of code which I found on another Code Project post.

using System;
using System.Collections.Generic;
using System.Text;

using iTextSharp.text; 
using iTextSharp.text.pdf; 


namespace pdf
{
    class Program
    {
        static void Main(string[] args)
        {

            Rectangle pageSize = new Rectangle(144, 720); 
             pageSize.BackgroundColor = new Color(0xFF, 0xFF, 0xDE); 
             Document document = new Document(pageSize); 

        }
    }
}


The line

pageSize.BackgroundColor = new Color(0xFF, 0xFF, 0xDE);



generates the following Build error message
The type or namespace name 'Color' could not be found (are you missing a using directive or an assemble reference?)

I have added the itextsharp.dll as a reference and have included the using directives

using iTextSharp.text;
using iTextSharp.text.pdf;



Can someone please tell me what the problems is?

解决方案

The Color class[^] resides in Sytem.Drawing namespace.


Try BaseColor instead of Color


Change color to BaseColor it will work


这篇关于找不到itextsharp颜色对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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