开发者

convert linq code to dotnet 2.0

开发者 https://www.devze.com 2023-02-17 17:27 出处:网络
string pdfpath = Server.MapPath(\"images\"); string imagepath = Server.MapPath(\"Images\"); using (Stream inputPdfStream = new FileStream(pdfpath + \"\\\\NLI_Filled_out.pdf\", FileMode.Open, FileAcce
    string pdfpath = Server.MapPath("images");
    string imagepath = Server.MapPath("Images");

    using (Stream inputPdfStream = new FileStream(pdfpath + "\\NLI_Filled_out.pdf", FileMode.Open, FileAccess.Read, FileShare.Read))
    using (Stream inputImageStream = new FileStream(imagepath + "\\sign2.gif", FileMode.Open, FileAccess.Read, FileShare.Read))
    using (Stream outputPdfStream = new FileStream(pdfpath + "\\NLI_Filled_output.pdf", FileMode.Create, FileAccess.Write, FileShare.None))
    {
        var reader = new PdfReader(inputPdfStream);

        var stamper = new PdfStamper(reader, outputPdfStream);

        var pdfContentByte = stamper.GetOverContent(3);

        iTextSharp.text.Image image = iTextSharp.text.Image.GetInstance(inputImageStream);

        image.ScalePercent(24f);

        image.SetAbsolutePosition(100, 130);

        pdfContentByte.AddImage(image);

        stamper.Close();
    }

I have the above code i开发者_JS百科n 3.5 using linq..i want to convert it into dotnet 2.0...can anyone pls help...


There's no LINQ there. Your problem is that (if you're targeting C# 2.0 for whatever reason) the var keyword isn't supported in versions earlier than 3.5. Just change the var instances to the explicit appropriate class (PdfReader, PdfStamper, and whatever the return type of GetOverContent is).

0

精彩评论

暂无评论...
验证码 换一张
取 消