【问题标题】:Unable to resize image inserted into pdf from SQL server ASP.Net via iTextSharp无法通过 iTextSharp 调整从 SQL Server ASP.Net 插入 pdf 的图像大小
【发布时间】:2013-06-24 01:36:23
【问题描述】:

代码准确地显示了我如何从数据库中检索我的图像并插入到 pdf 中。但是,我的图片大小不符合我的要求。我如何调整它们的大小?我尝试使用 ScaleToFit 和 scaleabsolute 但它不起作用:/

我从here得到了绝对比例的方法

            phrase.Add(new Chunk("Image1 :\u00a0", normalFont));
            Byte[] bytes1 = (Byte[])dr[8];
            iTextSharp.text.Image image1 = iTextSharp.text.Image.GetInstance(bytes1);
            Chunk imageChunk1 = new Chunk(image1, 0, 0);
            image1.ScaleToFit(50f, 50f);
            //image1.ScaleAbsolute(159f, 159f);
            phrase.Add(imageChunk1);

            phrase.Add(new Chunk("Image2 :\u00a0", normalFont));
            Byte[] bytes2 = (Byte[])dr[9];
            iTextSharp.text.Image image2 = iTextSharp.text.Image.GetInstance(bytes2);
            Chunk imageChunk2 = new Chunk(image2, 0, 0);
            image2.ScaleToFit(50f, 50f);
            //image2.ScaleAbsolute(159f, 159f);
            phrase.Add(imageChunk2);

【问题讨论】:

    标签: c# asp.net pdf itextsharp


    【解决方案1】:

    在将其添加到“块”之前,您是否尝试过缩小?

    【讨论】:

      猜你喜欢
      • 2011-04-01
      • 2013-06-03
      • 1970-01-01
      • 2013-06-01
      • 2012-02-01
      • 2021-10-20
      • 1970-01-01
      • 2013-07-04
      • 2012-12-18
      相关资源
      最近更新 更多