English 中文(简体)
哪一种最容易的办法将BMP转换为ASP.net的PDF。
原标题:What s the easiest way to convert a BMP to a PDF in ASP.net

采用ASP.net将BMP档案转换成一个一页的PDF的最容易的方法是什么? I m将产生8.5”×11“BMP”闪电(这意味着我可以操纵它,使其尽可能方便),然后使用POST将其上载到ASP网页上,该网页将转换为PDF,并将用户转至PDF。 我不想增加任何幅度或其它任何东西,而是将适当列入《巴厘岛行动计划》。

在闪电中将其转换成国防军,然后上载,是否容易?

感谢!

问题回答

您可使用iTextSharp创建PDF,并将图像插入该文件。 这一切都可以在人民国防军最终向客户生产的情况下进行。

下面是MVC方法,被 stripped光显示,但应当了解如何做到这一点。

[HttpGet]
public FileStreamResult Export(int? ID)
{        
    MemoryStream stream = new MemoryStream();
    Document pdf = new Document();
    PdfWriter writer = PdfWriter.GetInstance(pdf, stream);

    pdf.Open();

    PdfPTable tblImage = new PdfPTable(1);
    tblImage.AddCell(Image.GetInstance(LogChart())); //The LogChart method returns image
    pdf.Add(Image);

    pdf.Close();

    Response.ContentType = "application/pdf";
    Response.AddHeader("content-disposition", "attachment;filename=Log.pdf");
    Response.Buffer = true;
    Response.Clear();
    Response.OutputStream.Write(stream.GetBuffer(), 0, stream.GetBuffer().Length);
    Response.OutputStream.Flush();
    Response.End();

    return new FileStreamResult(Response.OutputStream, "application/pdf");
}




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签