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:
parent
3ba1e71b4b
commit
af99b05c2c
@ -722,10 +722,13 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
string fname = selectedChld.value.Substring(0, selectedChld.value.IndexOf('\n'));
|
||||
int thedot = fname.LastIndexOf('.');
|
||||
ROImageInfo tmp = null;
|
||||
if (thedot == -1 || (thedot != (fname.Length - 4)))
|
||||
{
|
||||
tmp = ROImageInfo.GetByROFstID_FileName(MyROFST.ROFstID, fname);
|
||||
fname += string.Format(".{0}", MyROFST.MyRODb.RODbConfig.GetDefaultGraphicExtension());
|
||||
ROImageInfo tmp = ROImageInfo.GetByROFstID_FileName(MyROFST.ROFstID, fname);
|
||||
|
||||
}
|
||||
if (tmp == null) tmp = ROImageInfo.GetByROFstID_FileName(MyROFST.ROFstID, fname);
|
||||
if (tmp !=null)
|
||||
{
|
||||
ROImageConfig rc = new ROImageConfig(tmp);
|
||||
|
@ -57,6 +57,7 @@ namespace Volian.Controls.Library
|
||||
this.nodeConnector1 = new DevComponents.AdvTree.NodeConnector();
|
||||
this.btnPrintReport = new DevComponents.DotNetBar.ButtonX();
|
||||
this.xpSelROs = new DevComponents.DotNetBar.ExpandablePanel();
|
||||
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
|
||||
((System.ComponentModel.ISupportInitialize)(this.tctrlReports)).BeginInit();
|
||||
this.tctrlReports.SuspendLayout();
|
||||
this.tabControlPanel2.SuspendLayout();
|
||||
@ -143,10 +144,10 @@ namespace Volian.Controls.Library
|
||||
this.cbxIncldMissingROs.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
|
||||
this.cbxIncldMissingROs.Location = new System.Drawing.Point(7, 61);
|
||||
this.cbxIncldMissingROs.Name = "cbxIncldMissingROs";
|
||||
this.cbxIncldMissingROs.Size = new System.Drawing.Size(138, 23);
|
||||
this.cbxIncldMissingROs.Size = new System.Drawing.Size(241, 23);
|
||||
this.cbxIncldMissingROs.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
this.cbxIncldMissingROs.TabIndex = 10;
|
||||
this.cbxIncldMissingROs.Text = "Include Missing ROs";
|
||||
this.cbxIncldMissingROs.Text = "Include Missing ROs (a red ? in the editor)";
|
||||
//
|
||||
// cbxSummary
|
||||
//
|
||||
@ -399,7 +400,7 @@ namespace Volian.Controls.Library
|
||||
this.xpSetToReport.TitleStyle.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
|
||||
this.xpSetToReport.TitleStyle.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText;
|
||||
this.xpSetToReport.TitleStyle.GradientAngle = 90;
|
||||
this.xpSetToReport.TitleText = "Select Procedures";
|
||||
this.xpSetToReport.TitleText = "Select Procedure Set";
|
||||
//
|
||||
// advTreeProcSets
|
||||
//
|
||||
@ -545,5 +546,6 @@ namespace Volian.Controls.Library
|
||||
private DevComponents.DotNetBar.ExpandablePanel xpSelROs;
|
||||
private DevComponents.DotNetBar.PanelEx panelEx1;
|
||||
private DevComponents.DotNetBar.Controls.CheckBoxX cbxIncldMissingROs;
|
||||
private System.Windows.Forms.ToolTip toolTip1;
|
||||
}
|
||||
}
|
||||
|
@ -195,10 +195,10 @@ namespace Volian.Controls.Library
|
||||
cbxComplete.Enabled = true;
|
||||
cbxSummary.Enabled = true;
|
||||
if (cbxROUsage.Checked)
|
||||
cbxIncldMissingROs.Text = "Include Missing ROs";
|
||||
cbxIncldMissingROs.Text = "Include Missing ROs (red ? in the editor)";
|
||||
else if (cbxComplete.Checked)
|
||||
cbxIncldMissingROs.Text = "Include Empty RO Fields";
|
||||
cbxIncldMissingROs.Checked = !cbxSummary.Checked;
|
||||
cbxIncldMissingROs.Checked = false;// !cbxSummary.Checked;
|
||||
cbxIncldMissingROs.Visible = cbxROUsage.Checked || cbxComplete.Checked;
|
||||
}
|
||||
|
||||
@ -247,10 +247,10 @@ namespace Volian.Controls.Library
|
||||
break;
|
||||
}
|
||||
if (cbxROUsage.Checked)
|
||||
cbxIncldMissingROs.Text = "Include Missing ROs";
|
||||
cbxIncldMissingROs.Text = "Include Missing ROs (red ? in the editor)";
|
||||
else if (cbxComplete.Checked)
|
||||
cbxIncldMissingROs.Text = "Include Empty RO Fields";
|
||||
cbxIncldMissingROs.Checked = cbxROUsage.Checked || cbxComplete.Checked;
|
||||
//cbxIncldMissingROs.Checked = cbxROUsage.Checked || cbxComplete.Checked;
|
||||
cbxIncldMissingROs.Visible = cbxROUsage.Checked || cbxComplete.Checked;
|
||||
}
|
||||
|
||||
@ -270,6 +270,7 @@ namespace Volian.Controls.Library
|
||||
cmbxROUsageSort.Enabled = cbxROUsage.Checked;
|
||||
xpSelROs.Enabled = true;
|
||||
xpSelROs.Expanded = true;
|
||||
cbxIncldMissingROs.Checked = false;// !cbxSummary.Checked;
|
||||
EnableOrDisablePrintButton();
|
||||
}
|
||||
|
||||
@ -281,6 +282,7 @@ namespace Volian.Controls.Library
|
||||
// reset the RO tree and clear anything that was selected
|
||||
advTreeROFillIn(true);
|
||||
lstCheckedROs.Clear();
|
||||
cbxIncldMissingROs.Checked = false;// !cbxSummary.Checked;
|
||||
EnableOrDisablePrintButton();
|
||||
}
|
||||
#region Procedure List
|
||||
@ -774,6 +776,7 @@ namespace Volian.Controls.Library
|
||||
|
||||
private void cbxComplete_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
cbxIncldMissingROs.Checked = false;// !cbxSummary.Checked;
|
||||
EnableOrDisablePrintButton();
|
||||
}
|
||||
|
||||
@ -827,6 +830,7 @@ namespace Volian.Controls.Library
|
||||
System.Diagnostics.Process p = System.Diagnostics.Process.Start(cmpRptExePath, roloc);
|
||||
// need to wait, sometimes the Print.tmp file that is generated is not available
|
||||
p.WaitForExit(); // without arguments, this will wait indefinately
|
||||
Application.DoEvents();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -117,4 +117,7 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using iTextSharp.text.pdf;
|
||||
using iTextSharp.text;
|
||||
using VEPROMS.CSLA.Library;
|
||||
@ -13,11 +14,13 @@ namespace Volian.Print.Library
|
||||
{
|
||||
class CompleteROReport
|
||||
{
|
||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
//Dictionary<string, PdfDestination> _MyErrorBookMarks = new Dictionary<string, PdfDestination>();
|
||||
Headers Hdrs; // Header stack object.
|
||||
RODataFile RO_df = null;
|
||||
int curheaderlen;
|
||||
string RODataFileName;
|
||||
iTextSharp.text.Document pdfReportDoc = null;
|
||||
iTextSharp.text.Document _pdfReportDoc = null;
|
||||
PdfPTable datatable = null;
|
||||
|
||||
private iTextSharp.text.Font _f14; // = pdf.GetFont("Arial Unicode MS", 14, 1, Color.BLACK);
|
||||
@ -83,7 +86,7 @@ namespace Volian.Print.Library
|
||||
public CompleteROReport(PdfWriter mypdfwriter, iTextSharp.text.Document document, string dataFileName, bool convertCaretToDelta, bool includeEmptyROFields)
|
||||
{
|
||||
Hdrs = new Headers();
|
||||
pdfReportDoc = document;
|
||||
_pdfReportDoc = document;
|
||||
RODataFileName = dataFileName;
|
||||
_ConvertCaretToDelta = convertCaretToDelta;
|
||||
_MyPDFWriter = mypdfwriter;
|
||||
@ -92,7 +95,7 @@ namespace Volian.Print.Library
|
||||
public void StartNewDataTable()
|
||||
{
|
||||
datatable = new PdfPTable(1);
|
||||
datatable.TotalWidth = pdfReportDoc.PageSize.Width - pdfReportDoc.LeftMargin - pdfReportDoc.RightMargin;
|
||||
datatable.TotalWidth = _pdfReportDoc.PageSize.Width - _pdfReportDoc.LeftMargin - _pdfReportDoc.RightMargin;
|
||||
datatable.LockedWidth = true;
|
||||
PdfPCell cell = new PdfPCell(new Phrase(ReportTitle, F14));
|
||||
cell.HorizontalAlignment = Element.ALIGN_CENTER;
|
||||
@ -223,7 +226,39 @@ 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;
|
||||
try
|
||||
{
|
||||
it_image = iTextSharp.text.Image.GetInstance(dcnt);
|
||||
//iTextSharp.text.Image it_image = iTextSharp.text.Image.GetInstance(ROImageInfo.Decompress(roImage.Content, size));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
try
|
||||
{
|
||||
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);
|
||||
it_image = iTextSharp.text.Image.GetInstance(newdcnt);
|
||||
}
|
||||
}
|
||||
catch (Exception ex2)
|
||||
{
|
||||
PdfPCell cell2 = new PdfPCell(new Phrase(string.Format("Bad Image File: {0}", filename)));
|
||||
cell2.BorderColor = Color.WHITE;
|
||||
datatable.AddCell(cell2);
|
||||
GenerateErrorMessage(ex2, "Bad Image File. ", string.Format("Image File: {0}", filename));
|
||||
//_MyErrorBookMarks.Add(filename, pdfDest);
|
||||
return;
|
||||
}
|
||||
}
|
||||
it_image.ScaleToFit(_MyPDFWriter.DirectContent.PdfDocument.PageSize.Width - 144, _MyPDFWriter.DirectContent.PdfDocument.PageSize.Height - 216);
|
||||
PdfPCell cell = new PdfPCell(it_image);
|
||||
cell.BorderColor = Color.WHITE;
|
||||
@ -231,9 +266,11 @@ namespace Volian.Print.Library
|
||||
}
|
||||
else
|
||||
{
|
||||
PdfPCell messageCell = new PdfPCell(new Phrase(string.Format("Image File {0} is missing.",filename)));
|
||||
PdfPCell messageCell = new PdfPCell(new Phrase(string.Format("Image File {0} is missing.", filename)));
|
||||
messageCell.BorderColor = Color.WHITE;
|
||||
datatable.AddCell(messageCell);
|
||||
GenerateErrorMessage(null, "Image File Missing. ", string.Format("Image File: {0}", filename));
|
||||
//_MyErrorBookMarks.Add(filename, pdfDest);
|
||||
}
|
||||
}
|
||||
|
||||
@ -253,11 +290,15 @@ namespace Volian.Print.Library
|
||||
datatable.AddCell(cell);
|
||||
}
|
||||
|
||||
private string processingRO = "";
|
||||
|
||||
public void PrintReport()
|
||||
{
|
||||
bool StopPrinting = false;
|
||||
bool UserTerminate = false;
|
||||
Int16 iRecType = 0;
|
||||
try
|
||||
{
|
||||
if (RO_df.GetFileLength() > 0)
|
||||
{
|
||||
// Loop until either printing is aborted or end of file.
|
||||
@ -280,12 +321,13 @@ namespace Volian.Print.Library
|
||||
break;
|
||||
case 5: // RRO End
|
||||
RROEnd();
|
||||
processingRO = "";
|
||||
break;
|
||||
case 6: // Msg
|
||||
Msg();
|
||||
break;
|
||||
case 7:
|
||||
KeyField();
|
||||
processingRO = KeyField();
|
||||
break;
|
||||
case 100: // Text Field - sometimes also XY Plot
|
||||
Text();
|
||||
@ -306,16 +348,17 @@ namespace Volian.Print.Library
|
||||
NoInformatEntered();
|
||||
break;
|
||||
case 255:
|
||||
pdfReportDoc.Add(datatable);
|
||||
pdfReportDoc.NewPage();
|
||||
_pdfReportDoc.Add(datatable);
|
||||
_pdfReportDoc.NewPage();
|
||||
StartNewDataTable();
|
||||
//Console.WriteLine("Record Type: {0} No Operation", iRecType);
|
||||
//Console.WriteLine("----------------------------------------------");
|
||||
break;
|
||||
default: // Problem
|
||||
//Console.WriteLine("Record Type: {0} Unrecognized record type", iRecType);
|
||||
StopPrinting = true; ;
|
||||
StopPrinting = true;
|
||||
UserTerminate = true;
|
||||
MessageBox.Show(string.Format("Unrecognized record type [{0}]", iRecType), "Error Creating Complete RO Report", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
break;
|
||||
};
|
||||
}
|
||||
@ -327,10 +370,64 @@ namespace Volian.Print.Library
|
||||
AddText("Selected Referenced Object has no data.", F12);
|
||||
}
|
||||
//Console.WriteLine("Record Type: {0}\n** Done **", iRecType);
|
||||
pdfReportDoc.Add(datatable);
|
||||
_pdfReportDoc.Add(datatable);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine("Exception : {0}", e.Message);
|
||||
RO_df.close();
|
||||
_pdfReportDoc.Add(datatable);
|
||||
GenerateErrorMessage(e, "Error Processing Complete RO Report. ", null);
|
||||
}
|
||||
AddErrorBookmarks();
|
||||
return;
|
||||
}
|
||||
|
||||
private void GenerateErrorMessage( Exception e, string erMsg, string erMsg2)
|
||||
{
|
||||
// if there is lenght then we are in the mist of processing an RO
|
||||
string headers = erMsg;
|
||||
for (int iLoop = 0; iLoop < Hdrs.HdrCnt; iLoop++)
|
||||
headers += Hdrs.strHdrs[iLoop] + "\n ";
|
||||
if (processingRO.Length > 0)
|
||||
headers += processingRO;
|
||||
if (erMsg2 != null && erMsg2.Length > 0)
|
||||
headers += "\n" + erMsg2;
|
||||
//MessageBox.Show(headers, erMsg, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
if (e != null)
|
||||
_MyLog.Error(headers, e);
|
||||
else
|
||||
_MyLog.Error(headers);
|
||||
PdfOutline outl = new PdfOutline(MyErrorOutline, MyPdfDestPage, processingRO.Length > 0 ? processingRO : "Problem Reading Header");
|
||||
//DestSample(outl);
|
||||
}
|
||||
|
||||
//private void DestSample(PdfOutline outl)
|
||||
//{
|
||||
// new PdfOutline(outl, new PdfDestination(PdfDestination.FIT), "FIT");
|
||||
// new PdfOutline(outl, new PdfDestination(PdfDestination.FITV, 700), "FITV,700");
|
||||
// new PdfOutline(outl, new PdfDestination(PdfDestination.FITH, 700), "FITH,700");
|
||||
// new PdfOutline(outl, new PdfDestination(PdfDestination.XYZ, 72, 720, 5), "XYZ,72,720,5");
|
||||
// new PdfOutline(outl, new PdfDestination(PdfDestination.FITR, 72, 650, 144, 722), "FITR,72, 650, 144, 722");
|
||||
// new PdfOutline(outl, new PdfDestination(PdfDestination.XYZ, 72, 720, 10), "XYZ,72,720,10");
|
||||
// new PdfOutline(outl, new PdfDestination(PdfDestination.FITR, 0, 500, _pdfReportDoc.PageSize.Width, 720), "FITR,0, 500,_pdfReportDoc.PageSize.Width , 720");
|
||||
// new PdfOutline(outl, new PdfDestination(PdfDestination.XYZ, 0, 792, 1), "XYZ,72,720,10");
|
||||
//}
|
||||
|
||||
public void AddErrorBookmarks()
|
||||
{
|
||||
if (_MyErrorOutline == null) return;
|
||||
//if (_MyErrorBookMarks.Count == 0) return;
|
||||
//PdfOutline outline = null;
|
||||
//foreach (string key in _MyErrorBookMarks.Keys)
|
||||
//{
|
||||
// if (outline == null) outline = new PdfOutline(_MyPDFWriter.DirectContent.RootOutline, _MyErrorBookMarks[key], "Errors");
|
||||
// new PdfOutline(outline, _MyErrorBookMarks[key], key);
|
||||
//}
|
||||
string emsg = "A Bookmark grouping named \"Errors\" was added to the PDF.\n\n Click on the RO in this grouping to jump to the report page which will contain an error message.\n\nThe error were also recorded in the PROMS error log.";
|
||||
MessageBox.Show(emsg, "Errors Found Creating Report", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
|
||||
}
|
||||
public void Multiple()
|
||||
{
|
||||
Int16 typ, i, j, nw = 0;
|
||||
@ -549,16 +646,62 @@ namespace Volian.Print.Library
|
||||
{
|
||||
PdfOutline parentOutline = null;
|
||||
if (iLoop == 0)
|
||||
parentOutline = _MyPDFWriter.DirectContent.RootOutline;
|
||||
parentOutline = MyRootOutline;//_MyPDFWriter.DirectContent.RootOutline;
|
||||
else
|
||||
parentOutline = MyDocOutline[iLoop - 1].MyOutline;
|
||||
PdfDestination pdfDest = new PdfDestination(PdfDestination.FITH, _MyPDFWriter.DirectContent.PdfDocument.PageSize.Height);
|
||||
AddOutlineLevel(parentOutline, iLoop, Hdrs.strHdrs[iLoop], pdfDest);
|
||||
//pdfDest = new PdfDestination(PdfDestination.FITH, _MyPDFWriter.DirectContent.PdfDocument.PageSize.Height);
|
||||
AddOutlineLevel(parentOutline, iLoop, Hdrs.strHdrs[iLoop], MyPdfDestPage);
|
||||
}
|
||||
AddText(Hdrs.strHdrs[iLoop], F12Bold); // should be bold and first header is centered
|
||||
}
|
||||
}
|
||||
static float _Top = 792;
|
||||
public PdfDestination MyPdfDestTop
|
||||
{
|
||||
get
|
||||
{
|
||||
// FITH was acting strange and shifting towards bottom of the page as the number of pages increased
|
||||
//Console.WriteLine("Top = {0}, {1}", _Top, _MyPDFWriter.DirectContent.PdfDocument.PageSize.Height);
|
||||
//return new PdfDestination(PdfDestination.FITH, _Top);//_MyPDFWriter.DirectContent.PdfDocument.PageSize.Height);
|
||||
return new PdfDestination(PdfDestination.XYZ, 0, _MyPDFWriter.DirectContent.PdfDocument.PageSize.Height, 1.5f);
|
||||
}
|
||||
}
|
||||
|
||||
public PdfDestination MyPdfDestPage
|
||||
{
|
||||
get
|
||||
{
|
||||
return new PdfDestination(PdfDestination.FITV,0);
|
||||
}
|
||||
}
|
||||
|
||||
private PdfOutline _MyErrorOutline = null;
|
||||
|
||||
public PdfOutline MyErrorOutline
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_MyErrorOutline == null)
|
||||
{
|
||||
_MyErrorOutline = new PdfOutline(_MyPDFWriter.DirectContent.RootOutline, MyPdfDestPage, "Errors");
|
||||
}
|
||||
return _MyErrorOutline;
|
||||
}
|
||||
}
|
||||
private PdfOutline _MyRootOutline = null;
|
||||
|
||||
public PdfOutline MyRootOutline
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_MyRootOutline == null)
|
||||
{
|
||||
_MyRootOutline = new PdfOutline(_MyPDFWriter.DirectContent.RootOutline, MyPdfDestTop, "Referenced Objects");
|
||||
}
|
||||
return _MyRootOutline;
|
||||
}
|
||||
}
|
||||
private PdfDestination pdfDest = null;
|
||||
private void AddOutlineLevel(PdfOutline parentOutline, int iLoop, string hdr, PdfDestination pdfDest)
|
||||
{
|
||||
if (MyDocOutline.ContainsKey(iLoop))
|
||||
@ -663,12 +806,14 @@ namespace Volian.Print.Library
|
||||
//Console.WriteLine("----------------------------------------------");
|
||||
}
|
||||
|
||||
public void KeyField()
|
||||
public string KeyField()
|
||||
{
|
||||
// use the key field as the PDF bookbark
|
||||
string szStr = RO_df.ReadText();
|
||||
PdfDestination pdfDest = new PdfDestination(PdfDestination.FITH, _MyPDFWriter.DirectContent.PdfDocument.PageSize.Height);
|
||||
new PdfOutline(MyDocOutline[Hdrs.HdrCnt - 1].MyOutline, pdfDest, szStr);
|
||||
//PdfDestination pdfDest = new PdfDestination(PdfDestination.FITH, _MyPDFWriter.DirectContent.PdfDocument.PageSize.Height);
|
||||
PdfOutline outl = new PdfOutline(MyDocOutline[Hdrs.HdrCnt - 1].MyOutline, MyPdfDestTop, szStr);
|
||||
//DestSample(outl);
|
||||
return szStr;
|
||||
//Console.WriteLine("Key Field");
|
||||
//Console.WriteLine("Key Text: {0}", szStr);
|
||||
//Console.WriteLine("----------------------------------------------");
|
||||
|
@ -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"));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user