私は一生、作成しているクラスをクライアントに表示する方法を理解できません。私は次のクラスを持っています:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IO;
using iTextSharp.text;
using iTextSharp.text.pdf;
using System.ServiceModel.DomainServices.Hosting;
using System.ServiceModel.DomainServices.EntityFramework;
using System.ServiceModel.DomainServices.Server;
using System.ServiceModel;
namespace Test1.Web
{
[EnableClientAccess]
public class CreatePDF
{
public string paragraph { get; set; }
public CreatePDF()
{ }
public void GoGoGadgetPDF()
{
var document = new Document();
string path = HttpContext.Current.Server.MapPath("PDFs");
PdfWriter.GetInstance(document, new FileStream(path + "/document.pdf", FileMode.Create));
document.Open();
document.Add(new Paragraph(paragraph));
document.Close();
}
}
}
フォルダー構造の Web プロジェクトの直下にクラスを配置します。
- Test1.Web
- 参考文献
- ClientBin (フォルダ)
- モデル(フォルダ)
- 作成したPDF.cs
- Authentication.cs
models フォルダー内の DomainService クラスと Authentication.cs クラスにアクセスできます。ただし、CreatePDF ではありません。
どんな助けでも大歓迎です!!