2013-05-31 5 views
1

MVC2 응용 프로그램에서 사용자가 PDF 문서를 만들 수 있도록 CKEditor를 사용합니다. 먼저 CKEditor 콘텐츠가 HTML 파일로 변환되고 나중에 PDF 문서로 변환됩니다. 화살표 아이콘을 클릭하면 해당 아이콘이 삽입되어야합니다. 편집기 이미지가 성공적으로 표시되지만 HTML 및 PDF 파일 이미지는 그 위치에 표시되지 않고 alt 콘텐츠가 표시됩니다. 화살표 버튼HTML 파일에 이미지를 표시하는 중 오류가 발생했습니다.

코드 :

<input type="button" class="green_button" id="arrow" name="Arrow" value="Arrow" style="width: 110px; height: 30px; background-color: #FFFFFF;" onclick="return arrow_onclick()" /> 

function arrow_onclick() { 
    var editor = CKEDITOR.instances.message; 
    editor.insertHtml(' <input type="image" alt="arrow" src="../../PDFimages/arrow-left-up.jpg" style="height:100px; width:100px" />'); 
} 

컨트롤러 코드 :

public ActionResult CreateFile(FormCollection data) 
    { 
     var filename = data["filename"]; 
     var htmlContent = data["content"]; 
     string sFilePath = Server.MapPath(_createdPDF + filename + ".html"); 
     htmlContent = htmlContent.Trim(); 
     if (!System.IO.File.Exists(sFilePath)) 
     { 
      using (FileStream fs = new FileStream(sFilePath, FileMode.Create)) 
      { 
       using (StreamWriter w = new StreamWriter(fs, Encoding.UTF8)) 
       { 
        w.Write(htmlContent); 
       } 
      } 
      string filename1 = Path.GetFileNameWithoutExtension(sFilePath); 
      string name = Server.MapPath(_createdPDF + filename1 + ".pdf"); 
      HTML2PDF.SetModulePath(@"C:\Documents and Settings\shubham\My Documents\visdatemplatemanger\visdatemplatemanger\bin"); 
      using (PDFDoc doc = new PDFDoc()) 
      { 
       if (HTML2PDF.Convert(doc, sFilePath)) 

        doc.Save(name, pdftron.SDF.SDFDoc.SaveOptions.e_linearized); 
      } 
      System.IO.File.Delete(sFilePath); 
      UploadURL(name); 
     } 
     return View(); 
    } 

답변

0
전에

양식을 제출, 당신은 CkEditor에서 텍스트 영역 값을 설정하고 게시물을 수락 할 행동을이 주석을가한다 적용됨 [HttpPost, ValidateInput(false)]

$("#content").val(CKEDITOR.instances.message.getData()); 

그리고 src 값을 확인하십시오. 아마 사용한다 : PDFimages 폴더 Project/Content

에 포함

src="@(Url.Content("~/PDFimages/arrow-left-up.jpg"))" 

경우

관련 문제