private iTextSharp.text.Image SetImageProperties(iTextSharp.text.Image image, Frame frame)
{
try
{
if (frame.Style is FrameStyle)
{
if (((FrameStyle)frame.Style).GraphicProperties != null)
{
if (((FrameStyle)frame.Style).GraphicProperties.HorizontalPosition != null)
{
string pos = ((FrameStyle)frame.Style).GraphicProperties.HorizontalPosition;
switch(pos)
{
case "center":
image.Alignment = iTextSharp.text.Image.TEXTWRAP | iTextSharp.text.Image.ALIGN_CENTER;
break;
case "left":
image.Alignment = iTextSharp.text.Image.TEXTWRAP | iTextSharp.text.Image.ALIGN_LEFT;
break;
case "right":
image.Alignment = iTextSharp.text.Image.TEXTWRAP | iTextSharp.text.Image.ALIGN_RIGHT;
break;
default:
break;
}
}
if (((FrameStyle)frame.Style).GraphicProperties.MarginLeft != null)
{
string marginLeft = ((FrameStyle)frame.Style).GraphicProperties.MarginLeft;
if (marginLeft != null)
{
double mLeft = AODL.Document.Helper.SizeConverter.GetDoubleFromAnOfficeSizeValue(marginLeft);
if (AODL.Document.Helper.SizeConverter.IsCm(marginLeft))
{
int pLeft = MeasurementHelper.CmToPoints(mLeft);
image.IndentationLeft = (float) pLeft;
}
else
{
int pLeft = MeasurementHelper.CmToPoints(mLeft);
image.IndentationLeft = (float) pLeft;
}
}
}
if (((FrameStyle)frame.Style).GraphicProperties.MarginRight != null)
{
string marginRight = ((FrameStyle)frame.Style).GraphicProperties.MarginRight;
if (marginRight != null)
{
double mRight = AODL.Document.Helper.SizeConverter.GetDoubleFromAnOfficeSizeValue(marginRight);
if (AODL.Document.Helper.SizeConverter.IsCm(marginRight))
{
int pRight = MeasurementHelper.CmToPoints(mRight);
image.IndentationRight = (float) pRight;
}
else
{
int pRight = MeasurementHelper.InchToPoints(mRight);
image.IndentationRight = (float) pRight;
}
}
}
}
}
return image;
}
catch(Exception)
{
throw;
}
}
}