2014-04-11 1 views
0

왜이 이미지를로드 할 수 없습니까? 나는 C#에서 JPG 이미지를 검색하려고 미쳐 가고 있어요

이 내 클래스 :

namespace PdfReport 
{ 
    // Classe base che rappresenta un PDF: 
    public class iTextDocumentBase : MyManagerCSharp.ManagerDB 
    { 
     // Oggetto MemoryStream che contiene il PDF: 
     protected System.IO.MemoryStream _risultatoMemoryStream = new System.IO.MemoryStream(); 

     protected iTextSharp.text.Document _document; // Generico documento di iText valido per qualsiasi formato di output 
     protected iTextSharp.text.Chapter _capitolo; // Contenitore per un insieme di Section opportunamente sequenziate 
     protected iTextSharp.text.Section _section;  // Parte del Document costituita da un insieme di Paragraph opportunamente disposti 

     protected System.Drawing.Image _backgroundImg = System.Drawing.Image.(Server.MapPath("~/Path/Relative/To/Root.jpg")); 

     .......................................................... 
     .......................................................... 
     .......................................................... 
} 

당신은 내가이 선으로 이미지를 얻기 위해 노력하고 볼 수 있듯이 :

protected System.Drawing.Image _backgroundImg = System.Drawing.Image.(Server.MapPath("~/Path/Relative/To/Root.jpg")); 

Error 78 The name 'Server' does not exist in the current context C:\Develop\EarlyWarning\public\Implementazione\Ver2\PdfReport\iTextDocumentBase.cs 43 79 PdfReport 
Error 77 Identifier expected C:\Develop\EarlyWarning\public\Implementazione\Ver2\PdfReport\iTextDocumentBase.cs 43 78 PdfReport 
:

문제는 내가 다음과 같은 오류 메시지를 얻을 수 있다는 것입니다

왜? 무엇을 해결할 수 있습니까?

답변

0

이 문제는 이미지와 관련이없는 것으로 보입니다.

System.Drawing.Image.(Server.MapPath("~/Path/Relative/To/Root.jpg")); 

당신은 단지 .(을 넣을 수 없습니다 : 우선,이 유효한 C의 # 구문이 아닙니다. 거기에 메서드 이름을 제공해야합니다 (이 경우 아마도 FromFile).

"이름 '서버'가 현재 컨텍스트에 존재하지 않습니다. '오류에 대해서는 Server 클래스에 대한 어셈블리 참조 또는 using 문이 누락 되었기 때문에 이러한 현상이 발생합니다. Server.MapPath()은 ASP.NET 프로젝트를위한 방법입니다. ASP.NET 프로젝트에서 작업하고 있습니까?

관련 문제