Added “(red ? in the editor)” to the Include Missing ROs checkbox label. Default the checkbox to be unchecked, and added anApplication.DoEvents()

Fixed the preview of images containing more than one sample layer (iTextSharp error)
Fixed the printing of images containing more than one sample layer (iTextSharp error), added better error handling, added an Error bookmark group.
This commit is contained in:
2015-01-30 20:14:46 +00:00
parent 3ba1e71b4b
commit af99b05c2c
6 changed files with 272 additions and 86 deletions

View File

@@ -973,7 +973,36 @@ namespace Volian.Print.Library
{
ROImageConfig rc = new ROImageConfig(roImage);
int size = Convert.ToInt32(rc.Image_Size);
iTextSharp.text.Image it_image = iTextSharp.text.Image.GetInstance(ROImageInfo.Decompress(roImage.Content, size));
byte[] cnt = roImage.Content;
byte[] dcnt = ROImageInfo.Decompress(cnt, size);
iTextSharp.text.Image it_image=null;
try
{
it_image = iTextSharp.text.Image.GetInstance(dcnt);
//iTextSharp.text.Image it_image = iTextSharp.text.Image.GetInstance(ROImageInfo.Decompress(roImage.Content, size));
}
catch
{
MemoryStream ms = new MemoryStream(dcnt);
System.Drawing.Bitmap bm = new System.Drawing.Bitmap(ms);
using (MemoryStream ms2 = new MemoryStream())
{
bm.Save(ms2, System.Drawing.Imaging.ImageFormat.Png);
ms2.Seek(0, SeekOrigin.Begin);
byte[] newdcnt = new byte[ms2.Length];
ms2.Read(newdcnt, 0, (int)ms2.Length);
try
{
it_image = iTextSharp.text.Image.GetInstance(newdcnt);
}
catch (Exception ex)
{
_MyLog.Error(string.Format("{0}",roImage.FileName),ex);
return yLocation;
}
}
}
//iTextSharp.text.Image it_image = iTextSharp.text.Image.GetInstance(ROImageInfo.Decompress(roImage.Content, size));
retval = Rtf2Pdf.FigureAt(cb, it_image, XOffset + MyItemInfo.FormatStepData.Font.CharsToTwips, yLocation, Width * MyPageHelper.YMultiplier, Height * MyPageHelper.YMultiplier, DebugInfo, yBottomMargin, !MyItemInfo.FormatStepData.Type.Contains("Borderless"));
}
}