本文整理汇总了C#中iTextSharp.ScalePercent方法的典型用法代码示例。如果您正苦于以下问题:C# iTextSharp.ScalePercent方法的具体用法?C# iTextSharp.ScalePercent怎么用?C# iTextSharp.ScalePercent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iTextSharp
的用法示例。
在下文中一共展示了iTextSharp.ScalePercent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ScaleIfNessarry
/// <summary>
/// Scales the pdf image if nessarry by percent.
/// </summary>
/// <param name="img">The img.</param>
/// <param name="frame">The frame.</param>
/// <returns>The scaled image.</returns>
private iTextSharp.text.Image ScaleIfNessarry(iTextSharp.text.Image img, Frame frame)
{
try
{
double scalingPrescision = 0.25;
double scaledWidthPercent = 0;
double scaledHeightPercent = 0;
double odfScaledWidth = AODL.Document.Helper.SizeConverter.GetDoubleFromAnOfficeSizeValue(frame.SvgWidth);
double odfScaledHeight = AODL.Document.Helper.SizeConverter.GetDoubleFromAnOfficeSizeValue(frame.SvgHeight);
if((frame.Height - odfScaledHeight) > scalingPrescision
|| (frame.Height - odfScaledHeight) < scalingPrescision)
{
scaledHeightPercent = ((100.0/frame.Height) * odfScaledHeight);
Console.WriteLine("ScaledHeightPerc {0} , frame {1}, odfScaledHeight {2}", scaledHeightPercent, frame.Height, odfScaledHeight);
}
if((frame.Width - odfScaledWidth) > scalingPrescision
|| (frame.Width - odfScaledWidth) < scalingPrescision)
{
scaledWidthPercent = ((100.0/frame.Width) * odfScaledWidth);
}
if(scaledHeightPercent != 0 || scaledWidthPercent != 0)
{
img.ScalePercent((float) scaledWidthPercent, (float) scaledHeightPercent);
}
return img;
}
catch(Exception)
{
throw;
}
}