This commit is contained in:
parent
2bf01da344
commit
ebd566dcb2
122
PROMS/VEPROMS/PrintMSWord/frmPrintMsWord.Designer.cs
generated
122
PROMS/VEPROMS/PrintMSWord/frmPrintMsWord.Designer.cs
generated
@ -32,13 +32,11 @@ namespace PrintMSWord
|
|||||||
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.pDFToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.pDFToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.analyzeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
|
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
|
||||||
this.tsslStatus = new System.Windows.Forms.ToolStripStatusLabel();
|
this.tsslStatus = new System.Windows.Forms.ToolStripStatusLabel();
|
||||||
this.panel1 = new System.Windows.Forms.Panel();
|
this.panel1 = new System.Windows.Forms.Panel();
|
||||||
|
this.cbDebugOutput = new DevComponents.DotNetBar.Controls.CheckBoxX();
|
||||||
this.tbTimings = new System.Windows.Forms.TextBox();
|
this.tbTimings = new System.Windows.Forms.TextBox();
|
||||||
this.tbPageCount = new System.Windows.Forms.TextBox();
|
|
||||||
this.label4 = new System.Windows.Forms.Label();
|
|
||||||
this.label3 = new System.Windows.Forms.Label();
|
this.label3 = new System.Windows.Forms.Label();
|
||||||
this.cbWatermark = new System.Windows.Forms.ComboBox();
|
this.cbWatermark = new System.Windows.Forms.ComboBox();
|
||||||
this.tbRevDate = new System.Windows.Forms.TextBox();
|
this.tbRevDate = new System.Windows.Forms.TextBox();
|
||||||
@ -55,11 +53,11 @@ namespace PrintMSWord
|
|||||||
//
|
//
|
||||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.fileToolStripMenuItem,
|
this.fileToolStripMenuItem,
|
||||||
this.pDFToolStripMenuItem,
|
this.pDFToolStripMenuItem});
|
||||||
this.analyzeToolStripMenuItem});
|
|
||||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||||
this.menuStrip1.Name = "menuStrip1";
|
this.menuStrip1.Name = "menuStrip1";
|
||||||
this.menuStrip1.Size = new System.Drawing.Size(844, 24);
|
this.menuStrip1.Padding = new System.Windows.Forms.Padding(8, 2, 0, 2);
|
||||||
|
this.menuStrip1.Size = new System.Drawing.Size(1125, 28);
|
||||||
this.menuStrip1.TabIndex = 0;
|
this.menuStrip1.TabIndex = 0;
|
||||||
this.menuStrip1.Text = "menuStrip1";
|
this.menuStrip1.Text = "menuStrip1";
|
||||||
//
|
//
|
||||||
@ -68,50 +66,43 @@ namespace PrintMSWord
|
|||||||
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.exitToolStripMenuItem});
|
this.exitToolStripMenuItem});
|
||||||
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
|
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
|
||||||
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
|
this.fileToolStripMenuItem.Size = new System.Drawing.Size(44, 24);
|
||||||
this.fileToolStripMenuItem.Text = "&File";
|
this.fileToolStripMenuItem.Text = "&File";
|
||||||
//
|
//
|
||||||
// exitToolStripMenuItem
|
// exitToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
|
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
|
||||||
this.exitToolStripMenuItem.Size = new System.Drawing.Size(92, 22);
|
this.exitToolStripMenuItem.Size = new System.Drawing.Size(102, 24);
|
||||||
this.exitToolStripMenuItem.Text = "E&xit";
|
this.exitToolStripMenuItem.Text = "E&xit";
|
||||||
//
|
//
|
||||||
// pDFToolStripMenuItem
|
// pDFToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.pDFToolStripMenuItem.Name = "pDFToolStripMenuItem";
|
this.pDFToolStripMenuItem.Name = "pDFToolStripMenuItem";
|
||||||
this.pDFToolStripMenuItem.Size = new System.Drawing.Size(40, 20);
|
this.pDFToolStripMenuItem.Size = new System.Drawing.Size(47, 24);
|
||||||
this.pDFToolStripMenuItem.Text = "PDF";
|
this.pDFToolStripMenuItem.Text = "PDF";
|
||||||
this.pDFToolStripMenuItem.Click += new System.EventHandler(this.pDFToolStripMenuItem_Click);
|
this.pDFToolStripMenuItem.Click += new System.EventHandler(this.pDFToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
// analyzeToolStripMenuItem
|
|
||||||
//
|
|
||||||
this.analyzeToolStripMenuItem.Name = "analyzeToolStripMenuItem";
|
|
||||||
this.analyzeToolStripMenuItem.Size = new System.Drawing.Size(60, 20);
|
|
||||||
this.analyzeToolStripMenuItem.Text = "Analyze";
|
|
||||||
this.analyzeToolStripMenuItem.Click += new System.EventHandler(this.analyzeToolStripMenuItem_Click);
|
|
||||||
//
|
|
||||||
// statusStrip1
|
// statusStrip1
|
||||||
//
|
//
|
||||||
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.tsslStatus});
|
this.tsslStatus});
|
||||||
this.statusStrip1.Location = new System.Drawing.Point(0, 315);
|
this.statusStrip1.Location = new System.Drawing.Point(0, 390);
|
||||||
this.statusStrip1.Name = "statusStrip1";
|
this.statusStrip1.Name = "statusStrip1";
|
||||||
this.statusStrip1.Size = new System.Drawing.Size(844, 22);
|
this.statusStrip1.Padding = new System.Windows.Forms.Padding(1, 0, 19, 0);
|
||||||
|
this.statusStrip1.Size = new System.Drawing.Size(1125, 25);
|
||||||
this.statusStrip1.TabIndex = 1;
|
this.statusStrip1.TabIndex = 1;
|
||||||
this.statusStrip1.Text = "statusStrip1";
|
this.statusStrip1.Text = "statusStrip1";
|
||||||
//
|
//
|
||||||
// tsslStatus
|
// tsslStatus
|
||||||
//
|
//
|
||||||
this.tsslStatus.Name = "tsslStatus";
|
this.tsslStatus.Name = "tsslStatus";
|
||||||
this.tsslStatus.Size = new System.Drawing.Size(39, 17);
|
this.tsslStatus.Size = new System.Drawing.Size(50, 20);
|
||||||
this.tsslStatus.Text = "Ready";
|
this.tsslStatus.Text = "Ready";
|
||||||
//
|
//
|
||||||
// panel1
|
// panel1
|
||||||
//
|
//
|
||||||
|
this.panel1.Controls.Add(this.cbDebugOutput);
|
||||||
this.panel1.Controls.Add(this.tbTimings);
|
this.panel1.Controls.Add(this.tbTimings);
|
||||||
this.panel1.Controls.Add(this.tbPageCount);
|
|
||||||
this.panel1.Controls.Add(this.label4);
|
|
||||||
this.panel1.Controls.Add(this.label3);
|
this.panel1.Controls.Add(this.label3);
|
||||||
this.panel1.Controls.Add(this.cbWatermark);
|
this.panel1.Controls.Add(this.cbWatermark);
|
||||||
this.panel1.Controls.Add(this.tbRevDate);
|
this.panel1.Controls.Add(this.tbRevDate);
|
||||||
@ -119,47 +110,47 @@ namespace PrintMSWord
|
|||||||
this.panel1.Controls.Add(this.tbRev);
|
this.panel1.Controls.Add(this.tbRev);
|
||||||
this.panel1.Controls.Add(this.label1);
|
this.panel1.Controls.Add(this.label1);
|
||||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Right;
|
this.panel1.Dock = System.Windows.Forms.DockStyle.Right;
|
||||||
this.panel1.Location = new System.Drawing.Point(485, 24);
|
this.panel1.Location = new System.Drawing.Point(646, 28);
|
||||||
|
this.panel1.Margin = new System.Windows.Forms.Padding(4);
|
||||||
this.panel1.Name = "panel1";
|
this.panel1.Name = "panel1";
|
||||||
this.panel1.Size = new System.Drawing.Size(359, 291);
|
this.panel1.Size = new System.Drawing.Size(479, 362);
|
||||||
this.panel1.TabIndex = 2;
|
this.panel1.TabIndex = 2;
|
||||||
//
|
//
|
||||||
|
// cbDebugOutput
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
this.cbDebugOutput.BackgroundStyle.Class = "";
|
||||||
|
this.cbDebugOutput.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
|
||||||
|
this.cbDebugOutput.Location = new System.Drawing.Point(11, 39);
|
||||||
|
this.cbDebugOutput.Name = "cbDebugOutput";
|
||||||
|
this.cbDebugOutput.Size = new System.Drawing.Size(147, 23);
|
||||||
|
this.cbDebugOutput.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||||
|
this.cbDebugOutput.TabIndex = 9;
|
||||||
|
this.cbDebugOutput.Text = "Debug Output";
|
||||||
|
//
|
||||||
// tbTimings
|
// tbTimings
|
||||||
//
|
//
|
||||||
this.tbTimings.AcceptsReturn = true;
|
this.tbTimings.AcceptsReturn = true;
|
||||||
this.tbTimings.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
this.tbTimings.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||||
| System.Windows.Forms.AnchorStyles.Left)
|
| System.Windows.Forms.AnchorStyles.Left)
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.tbTimings.Location = new System.Drawing.Point(0, 56);
|
this.tbTimings.Location = new System.Drawing.Point(0, 69);
|
||||||
|
this.tbTimings.Margin = new System.Windows.Forms.Padding(4);
|
||||||
this.tbTimings.Multiline = true;
|
this.tbTimings.Multiline = true;
|
||||||
this.tbTimings.Name = "tbTimings";
|
this.tbTimings.Name = "tbTimings";
|
||||||
this.tbTimings.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
this.tbTimings.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||||
this.tbTimings.Size = new System.Drawing.Size(359, 235);
|
this.tbTimings.Size = new System.Drawing.Size(477, 292);
|
||||||
this.tbTimings.TabIndex = 8;
|
this.tbTimings.TabIndex = 8;
|
||||||
//
|
//
|
||||||
// tbPageCount
|
|
||||||
//
|
|
||||||
this.tbPageCount.AcceptsReturn = true;
|
|
||||||
this.tbPageCount.Location = new System.Drawing.Point(71, 29);
|
|
||||||
this.tbPageCount.Name = "tbPageCount";
|
|
||||||
this.tbPageCount.Size = new System.Drawing.Size(100, 20);
|
|
||||||
this.tbPageCount.TabIndex = 7;
|
|
||||||
//
|
|
||||||
// label4
|
|
||||||
//
|
|
||||||
this.label4.AutoSize = true;
|
|
||||||
this.label4.Location = new System.Drawing.Point(6, 32);
|
|
||||||
this.label4.Name = "label4";
|
|
||||||
this.label4.Size = new System.Drawing.Size(63, 13);
|
|
||||||
this.label4.TabIndex = 6;
|
|
||||||
this.label4.Text = "Page Count";
|
|
||||||
//
|
|
||||||
// label3
|
// label3
|
||||||
//
|
//
|
||||||
this.label3.AutoSize = true;
|
this.label3.AutoSize = true;
|
||||||
this.label3.Location = new System.Drawing.Point(180, 32);
|
this.label3.Location = new System.Drawing.Point(240, 39);
|
||||||
|
this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||||
this.label3.Name = "label3";
|
this.label3.Name = "label3";
|
||||||
this.label3.Size = new System.Drawing.Size(59, 13);
|
this.label3.Size = new System.Drawing.Size(77, 17);
|
||||||
this.label3.TabIndex = 5;
|
this.label3.TabIndex = 5;
|
||||||
this.label3.Text = "Watermark";
|
this.label3.Text = "Watermark";
|
||||||
//
|
//
|
||||||
@ -173,42 +164,47 @@ namespace PrintMSWord
|
|||||||
"Sample",
|
"Sample",
|
||||||
"Reference",
|
"Reference",
|
||||||
"Information Only"});
|
"Information Only"});
|
||||||
this.cbWatermark.Location = new System.Drawing.Point(245, 29);
|
this.cbWatermark.Location = new System.Drawing.Point(327, 36);
|
||||||
|
this.cbWatermark.Margin = new System.Windows.Forms.Padding(4);
|
||||||
this.cbWatermark.Name = "cbWatermark";
|
this.cbWatermark.Name = "cbWatermark";
|
||||||
this.cbWatermark.Size = new System.Drawing.Size(100, 21);
|
this.cbWatermark.Size = new System.Drawing.Size(132, 24);
|
||||||
this.cbWatermark.TabIndex = 4;
|
this.cbWatermark.TabIndex = 4;
|
||||||
this.cbWatermark.Text = "(none)";
|
this.cbWatermark.Text = "(None)";
|
||||||
//
|
//
|
||||||
// tbRevDate
|
// tbRevDate
|
||||||
//
|
//
|
||||||
this.tbRevDate.AcceptsReturn = true;
|
this.tbRevDate.AcceptsReturn = true;
|
||||||
this.tbRevDate.Location = new System.Drawing.Point(245, 3);
|
this.tbRevDate.Location = new System.Drawing.Point(327, 4);
|
||||||
|
this.tbRevDate.Margin = new System.Windows.Forms.Padding(4);
|
||||||
this.tbRevDate.Name = "tbRevDate";
|
this.tbRevDate.Name = "tbRevDate";
|
||||||
this.tbRevDate.Size = new System.Drawing.Size(100, 20);
|
this.tbRevDate.Size = new System.Drawing.Size(132, 22);
|
||||||
this.tbRevDate.TabIndex = 3;
|
this.tbRevDate.TabIndex = 3;
|
||||||
//
|
//
|
||||||
// label2
|
// label2
|
||||||
//
|
//
|
||||||
this.label2.AutoSize = true;
|
this.label2.AutoSize = true;
|
||||||
this.label2.Location = new System.Drawing.Point(180, 6);
|
this.label2.Location = new System.Drawing.Point(240, 7);
|
||||||
|
this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||||
this.label2.Name = "label2";
|
this.label2.Name = "label2";
|
||||||
this.label2.Size = new System.Drawing.Size(30, 13);
|
this.label2.Size = new System.Drawing.Size(38, 17);
|
||||||
this.label2.TabIndex = 2;
|
this.label2.TabIndex = 2;
|
||||||
this.label2.Text = "Date";
|
this.label2.Text = "Date";
|
||||||
//
|
//
|
||||||
// tbRev
|
// tbRev
|
||||||
//
|
//
|
||||||
this.tbRev.Location = new System.Drawing.Point(71, 3);
|
this.tbRev.Location = new System.Drawing.Point(95, 4);
|
||||||
|
this.tbRev.Margin = new System.Windows.Forms.Padding(4);
|
||||||
this.tbRev.Name = "tbRev";
|
this.tbRev.Name = "tbRev";
|
||||||
this.tbRev.Size = new System.Drawing.Size(100, 20);
|
this.tbRev.Size = new System.Drawing.Size(132, 22);
|
||||||
this.tbRev.TabIndex = 1;
|
this.tbRev.TabIndex = 1;
|
||||||
//
|
//
|
||||||
// label1
|
// label1
|
||||||
//
|
//
|
||||||
this.label1.AutoSize = true;
|
this.label1.AutoSize = true;
|
||||||
this.label1.Location = new System.Drawing.Point(6, 6);
|
this.label1.Location = new System.Drawing.Point(8, 7);
|
||||||
|
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||||
this.label1.Name = "label1";
|
this.label1.Name = "label1";
|
||||||
this.label1.Size = new System.Drawing.Size(27, 13);
|
this.label1.Size = new System.Drawing.Size(33, 17);
|
||||||
this.label1.TabIndex = 0;
|
this.label1.TabIndex = 0;
|
||||||
this.label1.Text = "Rev";
|
this.label1.Text = "Rev";
|
||||||
//
|
//
|
||||||
@ -216,23 +212,25 @@ namespace PrintMSWord
|
|||||||
//
|
//
|
||||||
this.lbProcs.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.lbProcs.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.lbProcs.FormattingEnabled = true;
|
this.lbProcs.FormattingEnabled = true;
|
||||||
this.lbProcs.Location = new System.Drawing.Point(0, 24);
|
this.lbProcs.ItemHeight = 16;
|
||||||
|
this.lbProcs.Location = new System.Drawing.Point(0, 28);
|
||||||
|
this.lbProcs.Margin = new System.Windows.Forms.Padding(4);
|
||||||
this.lbProcs.Name = "lbProcs";
|
this.lbProcs.Name = "lbProcs";
|
||||||
this.lbProcs.Size = new System.Drawing.Size(485, 290);
|
this.lbProcs.Size = new System.Drawing.Size(646, 356);
|
||||||
this.lbProcs.TabIndex = 3;
|
this.lbProcs.TabIndex = 3;
|
||||||
this.lbProcs.DoubleClick += new System.EventHandler(this.lbProcs_DoubleClick);
|
this.lbProcs.DoubleClick += new System.EventHandler(this.lbProcs_DoubleClick);
|
||||||
this.lbProcs.SelectedValueChanged += new System.EventHandler(this.lbProcs_SelectedValueChanged);
|
|
||||||
//
|
//
|
||||||
// frmPrintMSWord
|
// frmPrintMSWord
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(844, 337);
|
this.ClientSize = new System.Drawing.Size(1125, 415);
|
||||||
this.Controls.Add(this.lbProcs);
|
this.Controls.Add(this.lbProcs);
|
||||||
this.Controls.Add(this.panel1);
|
this.Controls.Add(this.panel1);
|
||||||
this.Controls.Add(this.statusStrip1);
|
this.Controls.Add(this.statusStrip1);
|
||||||
this.Controls.Add(this.menuStrip1);
|
this.Controls.Add(this.menuStrip1);
|
||||||
this.MainMenuStrip = this.menuStrip1;
|
this.MainMenuStrip = this.menuStrip1;
|
||||||
|
this.Margin = new System.Windows.Forms.Padding(4);
|
||||||
this.Name = "frmPrintMSWord";
|
this.Name = "frmPrintMSWord";
|
||||||
this.Text = "PrintMSWord";
|
this.Text = "PrintMSWord";
|
||||||
this.Load += new System.EventHandler(this.frmPrintMSWord_Load);
|
this.Load += new System.EventHandler(this.frmPrintMSWord_Load);
|
||||||
@ -253,7 +251,6 @@ namespace PrintMSWord
|
|||||||
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem pDFToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem pDFToolStripMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem analyzeToolStripMenuItem;
|
|
||||||
private System.Windows.Forms.StatusStrip statusStrip1;
|
private System.Windows.Forms.StatusStrip statusStrip1;
|
||||||
private System.Windows.Forms.ToolStripStatusLabel tsslStatus;
|
private System.Windows.Forms.ToolStripStatusLabel tsslStatus;
|
||||||
private System.Windows.Forms.Panel panel1;
|
private System.Windows.Forms.Panel panel1;
|
||||||
@ -264,8 +261,7 @@ namespace PrintMSWord
|
|||||||
private System.Windows.Forms.Label label2;
|
private System.Windows.Forms.Label label2;
|
||||||
private System.Windows.Forms.TextBox tbRev;
|
private System.Windows.Forms.TextBox tbRev;
|
||||||
private System.Windows.Forms.Label label1;
|
private System.Windows.Forms.Label label1;
|
||||||
private System.Windows.Forms.TextBox tbPageCount;
|
|
||||||
private System.Windows.Forms.Label label4;
|
|
||||||
private System.Windows.Forms.TextBox tbTimings;
|
private System.Windows.Forms.TextBox tbTimings;
|
||||||
|
private DevComponents.DotNetBar.Controls.CheckBoxX cbDebugOutput;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -8,6 +8,7 @@ using System.Windows.Forms;
|
|||||||
using VEPROMS.CSLA.Library;
|
using VEPROMS.CSLA.Library;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Volian.Svg.Library;
|
using Volian.Svg.Library;
|
||||||
|
using Volian.Print.Library;
|
||||||
|
|
||||||
namespace PrintMSWord
|
namespace PrintMSWord
|
||||||
{
|
{
|
||||||
@ -22,30 +23,6 @@ namespace PrintMSWord
|
|||||||
get { return tsslStatus.Text; }
|
get { return tsslStatus.Text; }
|
||||||
set { tsslStatus.Text = value; Application.DoEvents(); }
|
set { tsslStatus.Text = value; Application.DoEvents(); }
|
||||||
}
|
}
|
||||||
private frmAnalyze _MyAnalyze;
|
|
||||||
public frmAnalyze MyAnalyze
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (_MyAnalyze == null)
|
|
||||||
_MyAnalyze = new frmAnalyze();
|
|
||||||
return _MyAnalyze;
|
|
||||||
}
|
|
||||||
set { _MyAnalyze = value; }
|
|
||||||
}
|
|
||||||
private void analyzeToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
MyAnalyze.Show();
|
|
||||||
}
|
|
||||||
private void frmPrintMSWord_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
FileInfo xmlFile = new FileInfo("Proms2010Print.xml");
|
|
||||||
if (xmlFile.Exists)
|
|
||||||
_MyProms2010Print = SvgSerializer<Proms2010Print>.ReadFile(xmlFile.FullName);
|
|
||||||
DocVersionInfo docVersion = GetDocVersionWithContent();
|
|
||||||
lbProcs.DataSource = docVersion.Procedures;
|
|
||||||
}
|
|
||||||
Proms2010Print _MyProms2010Print;
|
|
||||||
private DocVersionInfo GetDocVersionWithContent()
|
private DocVersionInfo GetDocVersionWithContent()
|
||||||
{
|
{
|
||||||
DocVersionInfoList dvList = DocVersionInfoList.Get();
|
DocVersionInfoList dvList = DocVersionInfoList.Get();
|
||||||
@ -63,18 +40,18 @@ namespace PrintMSWord
|
|||||||
{
|
{
|
||||||
CreatePDF();
|
CreatePDF();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CreatePDF()
|
private void CreatePDF()
|
||||||
{
|
{
|
||||||
|
Volian.Print.Library.Rtf2Pdf.PdfDebug = true;
|
||||||
tbTimings.Text = "";
|
tbTimings.Text = "";
|
||||||
Cursor saveCursor = this.Cursor;
|
Cursor saveCursor = this.Cursor;
|
||||||
this.Cursor = Cursors.WaitCursor;
|
this.Cursor = Cursors.WaitCursor;
|
||||||
Proms2010Procedure prProc = _MyProms2010Print.GetProcedure(MyProcedure);
|
ProcedureConfig.PrintWatermark pw = MyProcedure.ProcedureConfig.Print_Watermark;
|
||||||
PromsPrinter pp = new PromsPrinter(MyProcedure, prProc.Rev, prProc.RevDate, cbWatermark.Text);
|
PromsPrinter pp = new PromsPrinter(MyProcedure, tbRev.Text, tbRevDate.Text, pw.ToString(),cbDebugOutput.Checked, @"C:\TEMP\16Bit");
|
||||||
pp.StatusChanged += new PromsPrinterStatusEvent(pp_StatusChanged);
|
pp.StatusChanged += new PromsPrinterStatusEvent(pp_StatusChanged);
|
||||||
_ElapsedTime = new Dictionary<PromsPrinterStatusType, TimeSpan>();
|
_ElapsedTime = new Dictionary<PromsPrinterStatusType, TimeSpan>();
|
||||||
DateTime tStart = DateTime.Now;
|
DateTime tStart = DateTime.Now;
|
||||||
string pdfFile = pp.Print(@"C:\TEMP\32Bit", _MyProms2010Print, null, this);
|
string pdfFile = pp.Print(@"C:\TEMP\32Bit");
|
||||||
DateTime tEnd = DateTime.Now;
|
DateTime tEnd = DateTime.Now;
|
||||||
_ElapsedTime.Add(PromsPrinterStatusType.Total, DateTime.Now - tStart);
|
_ElapsedTime.Add(PromsPrinterStatusType.Total, DateTime.Now - tStart);
|
||||||
MyStatus = pdfFile + " created.";
|
MyStatus = pdfFile + " created.";
|
||||||
@ -103,21 +80,14 @@ namespace PrintMSWord
|
|||||||
//tbTimings.Text += string.Format("{0},{1},'{2}','{3}'", TimeSpan.FromTicks(args.When.Ticks -_StartTime.Ticks).TotalSeconds, delta.TotalMilliseconds, args.Type, args.MyStatus);
|
//tbTimings.Text += string.Format("{0},{1},'{2}','{3}'", TimeSpan.FromTicks(args.When.Ticks -_StartTime.Ticks).TotalSeconds, delta.TotalMilliseconds, args.Type, args.MyStatus);
|
||||||
_LastTime = args.When;
|
_LastTime = args.When;
|
||||||
}
|
}
|
||||||
private void lbProcs_SelectedValueChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
//ProcedureInfo proc = lbProcs.SelectedValue as ProcedureInfo;
|
|
||||||
if (MyProcedure == null) return;
|
|
||||||
if (_MyProms2010Print == null) return;
|
|
||||||
Proms2010Procedure prProc = _MyProms2010Print.GetProcedure(MyProcedure);
|
|
||||||
tbRev.Text = prProc == null ? "" : prProc.Rev;
|
|
||||||
tbRevDate.Text = prProc == null ? "" : prProc.RevDate;
|
|
||||||
tbPageCount.Text = prProc == null ? "" : prProc.PageCount.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void pDFToolStripMenuItem_Click(object sender, EventArgs e)
|
private void pDFToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
CreatePDF();
|
CreatePDF();
|
||||||
}
|
}
|
||||||
|
private void frmPrintMSWord_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
DocVersionInfo dvi = GetDocVersionWithContent();
|
||||||
|
lbProcs.DataSource = dvi.Procedures;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
160
PROMS/Volian.Print.Library/PageCount.cs
Normal file
160
PROMS/Volian.Print.Library/PageCount.cs
Normal file
@ -0,0 +1,160 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using iTextSharp.text;
|
||||||
|
using iTextSharp.text.pdf;
|
||||||
|
using Volian.Svg.Library;
|
||||||
|
|
||||||
|
namespace Volian.Print.Library
|
||||||
|
{
|
||||||
|
public class PageCount
|
||||||
|
{
|
||||||
|
private bool _CanIncrement = true;
|
||||||
|
public bool CanIncrement
|
||||||
|
{
|
||||||
|
get { return _CanIncrement; }
|
||||||
|
set { _CanIncrement = value; }
|
||||||
|
}
|
||||||
|
private int Increment()
|
||||||
|
{
|
||||||
|
if (CanIncrement) Total++;
|
||||||
|
CanIncrement = false;
|
||||||
|
return Total;
|
||||||
|
}
|
||||||
|
private int _Total;
|
||||||
|
public int Total
|
||||||
|
{
|
||||||
|
get { return _Total; }
|
||||||
|
set { _Total = value; }
|
||||||
|
}
|
||||||
|
private PageCountTemplates _MyTemplates; // (for each page that has this key)
|
||||||
|
internal PageCountTemplates MyTemplates
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_MyTemplates == null) _MyTemplates = new PageCountTemplates();
|
||||||
|
return _MyTemplates;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_MyTemplates = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void DrawTemplates()
|
||||||
|
{
|
||||||
|
foreach (PageCountTemplate pct in MyTemplates)
|
||||||
|
{
|
||||||
|
string fstr = pct.Text.Replace("{OF}", _Total.ToString());
|
||||||
|
|
||||||
|
// use font from pct
|
||||||
|
string fontFace = pct.MyFont.Name;
|
||||||
|
int fontStyle = (pct.MyFont.Bold ? iTextSharp.text.Font.BOLD : 0) + (pct.MyFont.Italic ? iTextSharp.text.Font.ITALIC : 0);
|
||||||
|
Font itextFont = Volian.Svg.Library.Svg.GetFont(fontFace, pct.MyFont.Size, fontStyle, pct.MyColor);
|
||||||
|
ColumnText columnText = new ColumnText(pct.MyTemplate);
|
||||||
|
float textSize = itextFont.BaseFont.GetWidthPoint(fstr, pct.MyFont.Size);
|
||||||
|
float flly = itextFont.BaseFont.GetDescentPoint("g", pct.MyFont.Size);
|
||||||
|
float lead = columnText.Leading;
|
||||||
|
columnText.Alignment = pct.Alignment;
|
||||||
|
Chunk chk = new Chunk(fstr, itextFont);
|
||||||
|
float width = chk.GetWidthPoint();
|
||||||
|
// justification:
|
||||||
|
float left = 0;
|
||||||
|
float right = width * 1.01F;
|
||||||
|
switch (pct.Alignment)
|
||||||
|
{
|
||||||
|
case Element.ALIGN_CENTER:
|
||||||
|
left = -.5F * width;
|
||||||
|
right = .51F * width;
|
||||||
|
break;
|
||||||
|
case Element.ALIGN_RIGHT:
|
||||||
|
left = -1.01F * width;
|
||||||
|
right = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
pct.MyTemplate.BoundingBox = new Rectangle(left, 2 * flly, right, columnText.Leading); //2*flly account for descenders
|
||||||
|
columnText.SetSimpleColumn(left, 0, right, columnText.Leading);
|
||||||
|
columnText.SetText(new Phrase(chk));
|
||||||
|
columnText.Go();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public PdfTemplate AddToTemplateList(PdfWriter pdfWriter, string text, System.Drawing.Font myFont, int alignment, System.Drawing.Color color)
|
||||||
|
{
|
||||||
|
Increment();
|
||||||
|
PageCountTemplate retTemplate = new PageCountTemplate(pdfWriter, text.Replace("{PAGE}",Total.ToString()), myFont, alignment, color);
|
||||||
|
MyTemplates.Add(retTemplate);
|
||||||
|
return retTemplate.MyTemplate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class PageCounts : Dictionary<string, PageCount>
|
||||||
|
{
|
||||||
|
public bool CanIncrement
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
foreach (PageCount pc in this.Values)
|
||||||
|
{
|
||||||
|
pc.CanIncrement = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public PdfTemplate AddToTemplateList(string key, PdfWriter pdfWriter, string text, System.Drawing.Font myFont, int alignment, System.Drawing.Color color)
|
||||||
|
{
|
||||||
|
if (!this.ContainsKey(key)) this.Add(key, new PageCount());
|
||||||
|
return (this[key].AddToTemplateList(pdfWriter, text, myFont, alignment,color));
|
||||||
|
}
|
||||||
|
public void DrawTemplates()
|
||||||
|
{
|
||||||
|
foreach (PageCount pc in this.Values)
|
||||||
|
{
|
||||||
|
pc.DrawTemplates();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class PageCountTemplate
|
||||||
|
{
|
||||||
|
private string _Text;
|
||||||
|
public string Text // "Page 1 of {OF}"
|
||||||
|
{
|
||||||
|
get { return _Text; }
|
||||||
|
set { _Text = value; }
|
||||||
|
}
|
||||||
|
private System.Drawing.Font _MyFont;
|
||||||
|
public System.Drawing.Font MyFont
|
||||||
|
{
|
||||||
|
get { return _MyFont; }
|
||||||
|
set { _MyFont = value; }
|
||||||
|
}
|
||||||
|
private int _Alignment; // iTextSharp Element.<XYZ>
|
||||||
|
public int Alignment
|
||||||
|
{
|
||||||
|
get { return _Alignment; }
|
||||||
|
set { _Alignment = value; }
|
||||||
|
}
|
||||||
|
private System.Drawing.Color _MyColor;
|
||||||
|
public System.Drawing.Color MyColor
|
||||||
|
{
|
||||||
|
get { return _MyColor; }
|
||||||
|
set { _MyColor = value; }
|
||||||
|
}
|
||||||
|
private PdfTemplate _MyTemplate;
|
||||||
|
public PdfTemplate MyTemplate
|
||||||
|
{
|
||||||
|
get { return _MyTemplate; }
|
||||||
|
set { _MyTemplate = value; }
|
||||||
|
}
|
||||||
|
public PageCountTemplate(PdfWriter pdfWriter, string text, System.Drawing.Font myFont, int alignment, System.Drawing.Color color)
|
||||||
|
{
|
||||||
|
// Create Template can be called with a small, i.e. 1, width/height because when
|
||||||
|
// it is actually drawn, the bounding box overrides the CreateTemplate values.
|
||||||
|
_MyTemplate = pdfWriter.DirectContent.CreateTemplate(1, 1);
|
||||||
|
_Text = text;
|
||||||
|
_MyFont = myFont;
|
||||||
|
_MyColor = color;
|
||||||
|
_Alignment = alignment;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class PageCountTemplates : List<PageCountTemplate>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
646
PROMS/Volian.Print.Library/PromsPrinter.cs
Normal file
646
PROMS/Volian.Print.Library/PromsPrinter.cs
Normal file
@ -0,0 +1,646 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using VEPROMS.CSLA.Library;
|
||||||
|
using Volian.Svg.Library;
|
||||||
|
using iTextSharp.text.factories;
|
||||||
|
using iTextSharp.text;
|
||||||
|
using iTextSharp.text.pdf;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.IO;
|
||||||
|
using System.Xml;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using LBWordLibrary;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Drawing.Imaging;
|
||||||
|
using Volian.Controls.Library;
|
||||||
|
|
||||||
|
namespace Volian.Print.Library
|
||||||
|
{
|
||||||
|
public delegate void PromsPrinterStatusEvent(object sender,PromsPrintStatusArgs args);
|
||||||
|
public class PromsPrintStatusArgs
|
||||||
|
{
|
||||||
|
private string _MyStatus;
|
||||||
|
public string MyStatus
|
||||||
|
{
|
||||||
|
get { return _MyStatus; }
|
||||||
|
}
|
||||||
|
private DateTime _When = DateTime.Now;
|
||||||
|
public DateTime When
|
||||||
|
{
|
||||||
|
get { return _When; }
|
||||||
|
}
|
||||||
|
private PromsPrinterStatusType _Type;
|
||||||
|
public PromsPrinterStatusType Type
|
||||||
|
{
|
||||||
|
get { return _Type; }
|
||||||
|
set { _Type = value; }
|
||||||
|
}
|
||||||
|
public PromsPrintStatusArgs(string myStatus, PromsPrinterStatusType type)
|
||||||
|
{
|
||||||
|
_MyStatus = myStatus;
|
||||||
|
_Type = type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public enum PromsPrinterStatusType
|
||||||
|
{
|
||||||
|
Start,
|
||||||
|
General,
|
||||||
|
MSWordToPDF,
|
||||||
|
PageList,
|
||||||
|
Watermark,
|
||||||
|
Read16,
|
||||||
|
Merge16,
|
||||||
|
Open16,
|
||||||
|
ReadMSWord,
|
||||||
|
MergeMSWord,
|
||||||
|
OpenMSWord,
|
||||||
|
OpenPDF,
|
||||||
|
Merge,
|
||||||
|
Total,
|
||||||
|
CloseDocument,
|
||||||
|
NewPage,
|
||||||
|
BuildSVG,
|
||||||
|
SetSVG,
|
||||||
|
SetPageEvent,
|
||||||
|
GetSection,
|
||||||
|
Before,
|
||||||
|
BuildStep
|
||||||
|
}
|
||||||
|
public class PromsPrinter
|
||||||
|
{
|
||||||
|
public event PromsPrinterStatusEvent StatusChanged;
|
||||||
|
private void OnStatusChanged(object sender, PromsPrintStatusArgs args)
|
||||||
|
{
|
||||||
|
if (StatusChanged != null)
|
||||||
|
StatusChanged(sender, args);
|
||||||
|
}
|
||||||
|
private void OnStatusChanged(string myStatus, PromsPrinterStatusType type)
|
||||||
|
{
|
||||||
|
OnStatusChanged(this, new PromsPrintStatusArgs(myStatus, type));
|
||||||
|
}
|
||||||
|
private string _Rev;
|
||||||
|
private string _RevDate;
|
||||||
|
private ItemInfo _MyItem;
|
||||||
|
private string _Watermark;
|
||||||
|
private bool _DebugOutput;
|
||||||
|
public bool DebugOutput
|
||||||
|
{
|
||||||
|
get { return _DebugOutput; }
|
||||||
|
set { _DebugOutput = value; }
|
||||||
|
}
|
||||||
|
private string _BackgroundFolder;
|
||||||
|
public string BackgroundFolder
|
||||||
|
{
|
||||||
|
get { return _BackgroundFolder; }
|
||||||
|
set { _BackgroundFolder = value; }
|
||||||
|
}
|
||||||
|
public PromsPrinter(ItemInfo myItem, string rev, string revDate, string watermark, bool debugOutput, string backgroundFolder)
|
||||||
|
{
|
||||||
|
_MyItem = myItem;
|
||||||
|
_Rev = rev;
|
||||||
|
_RevDate = revDate;
|
||||||
|
_Watermark = watermark;
|
||||||
|
_DebugOutput = debugOutput;
|
||||||
|
_BackgroundFolder = backgroundFolder;
|
||||||
|
}
|
||||||
|
public string Print(string pdfFolder)
|
||||||
|
{
|
||||||
|
if (_MyItem is ProcedureInfo)
|
||||||
|
return Print(_MyItem as ProcedureInfo, pdfFolder);
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
private string BuildMSWordPDF(SectionInfo section)
|
||||||
|
{
|
||||||
|
DateTime tStart = DateTime.Now;
|
||||||
|
string MSWordFile = null;
|
||||||
|
if (section.MyContent.ContentEntryCount == 1)
|
||||||
|
{
|
||||||
|
MSWordFile = MSWordToPDF.ToPDFReplaceROs(section, false);
|
||||||
|
OnStatusChanged("MSWord converted to PDF " + MSWordFile, PromsPrinterStatusType.MSWordToPDF);
|
||||||
|
}
|
||||||
|
return MSWordFile;
|
||||||
|
}
|
||||||
|
private static void AddImportedPageToLayer(PdfContentByte cb, PdfLayer layer, PdfImportedPage page, float xOff, float yOff)
|
||||||
|
{
|
||||||
|
cb.BeginLayer(layer);
|
||||||
|
iTextSharp.text.Image image = iTextSharp.text.Image.GetInstance(page);
|
||||||
|
image.SetAbsolutePosition(xOff, yOff);
|
||||||
|
cb.AddImage(image);
|
||||||
|
cb.EndLayer();
|
||||||
|
}
|
||||||
|
private PdfLayer _TextLayer;
|
||||||
|
private PdfLayer _BackgroundLayer;
|
||||||
|
private PdfLayer _MSWordLayer;
|
||||||
|
private PdfLayer _PagelistLayer;
|
||||||
|
private PdfLayer _DebugLayer;
|
||||||
|
private PdfLayer _WatermarkLayer;
|
||||||
|
private void CreateLayers(PdfContentByte cb)
|
||||||
|
{
|
||||||
|
if (DebugOutput)
|
||||||
|
{
|
||||||
|
_BackgroundLayer = new PdfLayer("16-Bit", cb.PdfWriter);
|
||||||
|
_MSWordLayer = new PdfLayer("32-Bit MSWord", cb.PdfWriter);
|
||||||
|
_PagelistLayer = new PdfLayer("32-Bit Pagelist", cb.PdfWriter);
|
||||||
|
_TextLayer = new PdfLayer("32-Bit Text", cb.PdfWriter);
|
||||||
|
_DebugLayer = new PdfLayer("Debug", cb.PdfWriter);
|
||||||
|
_WatermarkLayer = new PdfLayer("Watermark", cb.PdfWriter);
|
||||||
|
_WatermarkLayer.SetPrint("Watermark", true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CloseDocument(PdfContentByte cb, string fileName)
|
||||||
|
{
|
||||||
|
cb.PdfDocument.Close();
|
||||||
|
OnStatusChanged("CloseDocument", PromsPrinterStatusType.CloseDocument);
|
||||||
|
System.Diagnostics.Process.Start(fileName);
|
||||||
|
OnStatusChanged("OpenPDF", PromsPrinterStatusType.OpenPDF);
|
||||||
|
}
|
||||||
|
|
||||||
|
private PdfContentByte OpenDoc(string outputFileName)
|
||||||
|
{
|
||||||
|
iTextSharp.text.Document document = new iTextSharp.text.Document(PageSize.LETTER);
|
||||||
|
PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(outputFileName, FileMode.Create));
|
||||||
|
document.Open();
|
||||||
|
// Create Layers
|
||||||
|
CreateLayers(writer.DirectContent);
|
||||||
|
PrintOverride.Reset();
|
||||||
|
if (DebugOutput)
|
||||||
|
{
|
||||||
|
PrintOverride.TextColor = System.Drawing.Color.Red;
|
||||||
|
PrintOverride.SvgColor = System.Drawing.Color.LawnGreen;
|
||||||
|
PrintOverride.BoxColor = System.Drawing.Color.Red;
|
||||||
|
PrintOverride.ChangeBarColor = System.Drawing.Color.Red;
|
||||||
|
PrintOverride.DebugColor = System.Drawing.Color.CadetBlue;
|
||||||
|
}
|
||||||
|
return writer.DirectContent;
|
||||||
|
}
|
||||||
|
private string CreateFileName(string procNumber, string sectNumber, string sectTitle)
|
||||||
|
{
|
||||||
|
return FixFileName(procNumber + "_" + ((sectNumber ?? "") != "" ? sectNumber : sectTitle));
|
||||||
|
}
|
||||||
|
private string CreateFileName(string procNumber)
|
||||||
|
{
|
||||||
|
return FixFileName(procNumber);
|
||||||
|
}
|
||||||
|
private string FixFileName(string name)
|
||||||
|
{
|
||||||
|
return Regex.Replace(name, "[ .,]", "_") + ".pdf";
|
||||||
|
}
|
||||||
|
int _StepPageNumber = 0;
|
||||||
|
private VlnSvgPageHelper _MyHelper = null;
|
||||||
|
private string Print(ProcedureInfo myProcedure, string pdfFolder)
|
||||||
|
{
|
||||||
|
OnStatusChanged("Print " + myProcedure.DisplayNumber, PromsPrinterStatusType.Start);
|
||||||
|
string outputFileName = pdfFolder + "\\" + CreateFileName(myProcedure.DisplayNumber);
|
||||||
|
// Create an MSWord Pdf
|
||||||
|
// Setup a pdf Document for printing
|
||||||
|
OnStatusChanged("Before OpenDoc", PromsPrinterStatusType.Before);
|
||||||
|
PdfContentByte cb = OpenDoc(outputFileName);
|
||||||
|
OnStatusChanged("Before NewPage", PromsPrinterStatusType.Before);
|
||||||
|
cb.PdfDocument.NewPage();
|
||||||
|
OnStatusChanged("After NewPage", PromsPrinterStatusType.NewPage);
|
||||||
|
foreach (SectionInfo mySection in myProcedure.Sections)
|
||||||
|
{
|
||||||
|
// Set up Helper for the particular Section
|
||||||
|
if (_MyHelper == null)
|
||||||
|
{
|
||||||
|
cb.PdfWriter.PageEvent = _MyHelper = new VlnSvgPageHelper(mySection);
|
||||||
|
_MyHelper.MyPdfWriter = cb.PdfWriter;
|
||||||
|
_MyHelper.MyPdfContentByte = cb;
|
||||||
|
|
||||||
|
if (DebugOutput)
|
||||||
|
{
|
||||||
|
// 16-bit background
|
||||||
|
string procedureFileName = BackgroundFolder + "\\" + CreateFileName(myProcedure.DisplayNumber);
|
||||||
|
FileInfo VEPromsFile = new FileInfo(procedureFileName);
|
||||||
|
if (VEPromsFile.Exists)
|
||||||
|
{
|
||||||
|
_MyHelper.BackgroundFile = procedureFileName;
|
||||||
|
//if (Environment.UserName.ToUpper() == "KATHY")
|
||||||
|
// _MyHelper.BackgroundOffset = new PointF(12, -13.5F); // non-KBR Needs this to be -9.5 to line up!
|
||||||
|
//else
|
||||||
|
_MyHelper.BackgroundOffset = new PointF(12, -9.5F); // KBR Needs this to be -13.5 to line up!
|
||||||
|
_MyHelper.BackgroundPageOffset = 0;
|
||||||
|
}
|
||||||
|
_MyHelper.WatermarkLayer = _WatermarkLayer;
|
||||||
|
_MyHelper.PageListLayer = _PagelistLayer;
|
||||||
|
_MyHelper.TextLayer = _TextLayer;
|
||||||
|
_MyHelper.BackgroundLayer = _BackgroundLayer;
|
||||||
|
_MyHelper.DebugLayer = _DebugLayer;
|
||||||
|
}
|
||||||
|
_MyHelper.Rev = _Rev;
|
||||||
|
_MyHelper.RevDate = _RevDate;
|
||||||
|
_MyHelper.Watermark = _Watermark;
|
||||||
|
OnStatusChanged("After Set PageEvent", PromsPrinterStatusType.SetPageEvent);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_MyHelper.MySection = mySection;
|
||||||
|
OnStatusChanged("After Set Svg", PromsPrinterStatusType.SetSVG);
|
||||||
|
}
|
||||||
|
PdfReader readerWord = null;
|
||||||
|
string myPdfFile = null;
|
||||||
|
if (mySection.IsStepSection)
|
||||||
|
CreateStepPdf(mySection, cb);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
myPdfFile = BuildMSWordPDF(mySection);
|
||||||
|
readerWord = myPdfFile != null ? new PdfReader(myPdfFile) : null;
|
||||||
|
OnStatusChanged("Get Section", PromsPrinterStatusType.GetSection);
|
||||||
|
int sectPageCount = (int)(Math.Ceiling(decimal.Parse(mySection.SectionConfig.Section_NumPages)));
|
||||||
|
for (int ii = 0; ii < sectPageCount; ii++)
|
||||||
|
{
|
||||||
|
int pageNumber = 1 + ii;
|
||||||
|
if (readerWord != null)
|
||||||
|
{
|
||||||
|
bool doimport2 = true;
|
||||||
|
PdfImportedPage fgPage = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
fgPage = cb.PdfWriter.GetImportedPage(readerWord, ii + 1);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine(ex);
|
||||||
|
doimport2 = false;
|
||||||
|
}
|
||||||
|
OnStatusChanged("Read MSWord", PromsPrinterStatusType.ReadMSWord);
|
||||||
|
if (doimport2) AddImportedPageToLayer(cb.PdfWriter.DirectContentUnder, _MSWordLayer, fgPage, 0, 0);
|
||||||
|
OnStatusChanged("Merge MSWord", PromsPrinterStatusType.MergeMSWord);
|
||||||
|
}
|
||||||
|
OnStatusChanged("Before NewPage", PromsPrinterStatusType.Before);
|
||||||
|
cb.PdfDocument.NewPage();
|
||||||
|
OnStatusChanged("After NewPage", PromsPrinterStatusType.NewPage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (_MyHelper.BackgroundFile != null)
|
||||||
|
{
|
||||||
|
_MyHelper.MySvg = null;
|
||||||
|
while (cb.PdfWriter.CurrentPageNumber <= _MyHelper.BackgroundPageCount)
|
||||||
|
{
|
||||||
|
if (_TextLayer != null) cb.BeginLayer(_TextLayer);
|
||||||
|
float fontSize = 30;
|
||||||
|
ColumnText ct = new ColumnText(cb);
|
||||||
|
iTextSharp.text.Font font = FontFactory.GetFont("Arial", fontSize, new iTextSharp.text.Color(PrintOverride.TextColor));
|
||||||
|
Chunk chk = new Chunk("No PROMS2010 Output", font);
|
||||||
|
float xCenter = cb.PdfDocument.PageSize.Width / 2;
|
||||||
|
float yCenter = cb.PdfDocument.PageSize.Height / 2;
|
||||||
|
float width = chk.GetWidthPoint() * 1.01F;
|
||||||
|
float height = fontSize * 1.5F;
|
||||||
|
ct.SetSimpleColumn(xCenter - width/2, yCenter - height/2, xCenter + width/2, yCenter + height/2);
|
||||||
|
Phrase ph = new Phrase(chk);
|
||||||
|
ct.AddElement(ph);
|
||||||
|
cb.SetColorFill(new iTextSharp.text.Color(PrintOverride.TextColor));
|
||||||
|
ct.Go();
|
||||||
|
if (_TextLayer != null) cb.EndLayer();
|
||||||
|
cb.PdfDocument.NewPage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CloseDocument(cb, outputFileName);
|
||||||
|
// Return the fileName;
|
||||||
|
return outputFileName;
|
||||||
|
}
|
||||||
|
private void CreateStepPdf(SectionInfo section, PdfContentByte cb)
|
||||||
|
{
|
||||||
|
iTextSharp.text.pdf.PdfWriter writer = cb.PdfWriter;
|
||||||
|
ItemInfo myItemInfo = section as ItemInfo;
|
||||||
|
// 792: 72 * 11 inches - TopRow - Top is high value
|
||||||
|
float _TwipsPerPage = 792;
|
||||||
|
float yTopMargin = _TwipsPerPage - (float)myItemInfo.MyDocStyle.Layout.TopRow;
|
||||||
|
float yBottomMargin = yTopMargin - (float)myItemInfo.MyDocStyle.Layout.PageLength - 2 * vlnPrintObject.SixLinesPerInch;
|
||||||
|
vlnParagraph.Prefix = myItemInfo.Path;
|
||||||
|
Rtf2Pdf.PdfDebug = true;
|
||||||
|
Rtf2Pdf.Offset = new PointF(24, 2.5F);
|
||||||
|
_MyHelper.ChangeBarDefinition = DetermineChangeBarSettings(myItemInfo);
|
||||||
|
vlnParagraph myParagraph = new vlnParagraph(null, cb, myItemInfo, (float)myItemInfo.MyDocStyle.Layout.LeftMargin, 0, 0, myItemInfo.ColumnMode, myItemInfo.ActiveFormat);
|
||||||
|
myParagraph.ToPdf(cb, yTopMargin, yTopMargin, yBottomMargin);
|
||||||
|
cb.PdfDocument.NewPage();
|
||||||
|
OnStatusChanged("StepSection converted to PDF " + section.ShortPath, PromsPrinterStatusType.BuildStep);
|
||||||
|
}
|
||||||
|
// Determine if any menu selections for change bars have overridden the data
|
||||||
|
// supplied in the format file. Settings are location and text.
|
||||||
|
// We could also put up the dialog for change bars if option is 'User Specified',
|
||||||
|
// i.e. prompt before printing.
|
||||||
|
private ChangeBarDefinition DetermineChangeBarSettings(ItemInfo myItemInfo)
|
||||||
|
{
|
||||||
|
// get to procedure level:
|
||||||
|
ItemInfo ii = myItemInfo;
|
||||||
|
while (ii.MyContent.Type != 0)
|
||||||
|
{
|
||||||
|
ii = ii.MyActiveParent as ItemInfo;
|
||||||
|
}
|
||||||
|
DocVersionInfo dvi = ii.MyActiveParent as DocVersionInfo;
|
||||||
|
if (dvi == null) return null; // should never be null!
|
||||||
|
DocVersionConfig docverConfig = dvi.MyConfig as DocVersionConfig;
|
||||||
|
|
||||||
|
ChangeBarDefinition cbd = new ChangeBarDefinition();
|
||||||
|
|
||||||
|
// if there is not overridden data on the docversion, prompt user...
|
||||||
|
ChangeBarData changeBarData = myItemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.ChangeBarData;
|
||||||
|
if (docverConfig == null || docverConfig.Print_ChangeBar == DocVersionConfig.PrintChangeBar.SelectBeforePrinting)
|
||||||
|
{
|
||||||
|
// use these for now, i.e. this is what user would have selected from dialog.
|
||||||
|
cbd.MyChangeBarType = DocVersionConfig.PrintChangeBar.WithDefault;
|
||||||
|
cbd.MyChangeBarLoc = DocVersionConfig.PrintChangeBarLoc.OutsideBox;
|
||||||
|
cbd.MyChangeBarText = DocVersionConfig.PrintChangeBarText.None;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cbd.MyChangeBarType = docverConfig.Print_ChangeBar;
|
||||||
|
cbd.MyChangeBarLoc = docverConfig.Print_ChangeBarLoc;
|
||||||
|
cbd.MyChangeBarText = docverConfig.Print_ChangeBarText;
|
||||||
|
}
|
||||||
|
if (cbd.MyChangeBarType == DocVersionConfig.PrintChangeBar.WithDefault) // get data from format
|
||||||
|
{
|
||||||
|
cbd.MyChangeBarText = changeBarData.ChangeBarMessage == "ChgID" ? DocVersionConfig.PrintChangeBarText.ChgID :
|
||||||
|
changeBarData.ChangeBarMessage == "DateAndChgID" ? DocVersionConfig.PrintChangeBarText.DateChgID :
|
||||||
|
changeBarData.ChangeBarMessage == "None" ? DocVersionConfig.PrintChangeBarText.None :
|
||||||
|
changeBarData.ChangeBarMessage == "RevNum" ? DocVersionConfig.PrintChangeBarText.RevNum : DocVersionConfig.PrintChangeBarText.UserDef;
|
||||||
|
}
|
||||||
|
if (cbd.MyChangeBarType != DocVersionConfig.PrintChangeBar.Without)
|
||||||
|
{
|
||||||
|
// if the format has the absolutefixedchangecolumn format flag, then always use the fixedchangecolumn from the
|
||||||
|
// format, otherwise, use the default column based on the selected location, stored in the base format.
|
||||||
|
cbd.MyChangeBarColumn = (changeBarData.AbsoluteFixedChangeColumn) ?
|
||||||
|
(int)changeBarData.FixedChangeColumn :
|
||||||
|
System.Convert.ToInt32(changeBarData.DefaultCBLoc.Split(" ".ToCharArray())[System.Convert.ToInt32(cbd.MyChangeBarLoc)]);
|
||||||
|
if (cbd.MyChangeBarText == DocVersionConfig.PrintChangeBarText.UserDef)
|
||||||
|
cbd.MyChangeBarMessage = docverConfig.Print_UserCBMess1 + @"\n" + docverConfig.Print_UserCBMess2;
|
||||||
|
|
||||||
|
}
|
||||||
|
return cbd;
|
||||||
|
}
|
||||||
|
private SvgPart PageItemToSvgText(PageItem pageItem, string text, float yOffset)
|
||||||
|
{
|
||||||
|
SvgText svgText = new SvgText();
|
||||||
|
svgText.Text = text;
|
||||||
|
E_Justify justify = pageItem.Justify ?? E_Justify.PSLeft;
|
||||||
|
if ((justify & E_Justify.PSLeft) == E_Justify.PSLeft)
|
||||||
|
svgText.Justify = SvgJustify.Left;
|
||||||
|
else if ((justify & E_Justify.PSRight) == E_Justify.PSRight)
|
||||||
|
svgText.Justify = SvgJustify.Right;
|
||||||
|
else
|
||||||
|
svgText.Justify = SvgJustify.Center;
|
||||||
|
svgText.Font = pageItem.Font.WindowsFont;
|
||||||
|
svgText.X = new SvgMeasurement((float)(pageItem.Col ?? 0), E_MeasurementUnits.PT);
|
||||||
|
svgText.Y = new SvgMeasurement((float)(yOffset + pageItem.Row ?? 0), E_MeasurementUnits.PT);
|
||||||
|
if (svgText.Font.Underline && svgText.Text.EndsWith(" ")) svgText.Text = svgText.Text.Substring(0, svgText.Text.Length - 1) + "\xA0";// replace last space with a hardspace
|
||||||
|
return svgText;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static class MSWordToPDF
|
||||||
|
{
|
||||||
|
private static LBApplicationClass _MyApp = null;
|
||||||
|
public static LBApplicationClass MyApp
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_MyApp == null)
|
||||||
|
_MyApp = new LBApplicationClass();
|
||||||
|
return _MyApp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static string ToPDFReplaceROs(SectionInfo sect, bool openPdf)
|
||||||
|
{
|
||||||
|
string fileName = GetFileName(sect);
|
||||||
|
// TODO: do we want to cache the word pdfs
|
||||||
|
//if (System.IO.File.Exists(@"C:\Temp\" + fileName + ".pdf"))
|
||||||
|
// return @"C:\Temp\" + fileName + ".pdf";
|
||||||
|
int docStyleIndex = ((int)sect.MyContent.Type) % 10000;
|
||||||
|
DocStyle myDocStyle = sect.ActiveFormat.PlantFormat.DocStyles.DocStyleList[docStyleIndex];
|
||||||
|
PageStyle myPageStyle = myDocStyle.pagestyle;
|
||||||
|
ProcedureInfo proc = sect.ActiveParent as ProcedureInfo;
|
||||||
|
DocVersionInfo dvi = proc.ActiveParent as DocVersionInfo;
|
||||||
|
ROFstInfo rofst = dvi.DocVersionAssociations[0].MyROFst;
|
||||||
|
ROFSTLookup lookup = rofst.ROFSTLookup;
|
||||||
|
string igPrefix = dvi.DocVersionConfig.RODefaults_graphicsprefix;
|
||||||
|
string spPrefix = dvi.DocVersionConfig.RODefaults_setpointprefix;
|
||||||
|
// string AccPageID = string.Format("<{0}-{1}>", accPrefix, roch.appid);
|
||||||
|
using (DSOFile myFile = new DSOFile(sect.MyContent.MyEntry.MyDocument))
|
||||||
|
{
|
||||||
|
LBDocumentClass myDoc = MyApp.Documents.Open(myFile.FullName);
|
||||||
|
float newTop = (float)myDocStyle.Layout.TopRow;
|
||||||
|
float newLeft = (float)myDocStyle.Layout.LeftMargin;
|
||||||
|
float newLength = (float)myDocStyle.Layout.PageLength;
|
||||||
|
float newWidth = (float)myDocStyle.Layout.PageWidth;
|
||||||
|
float oldTop = myDoc.PageSetup.TopMargin;
|
||||||
|
float oldLeft = myDoc.PageSetup.LeftMargin;
|
||||||
|
float oldBottom = myDoc.PageSetup.BottomMargin;
|
||||||
|
float oldRight = myDoc.PageSetup.RightMargin;
|
||||||
|
float oldHeight = myDoc.PageSetup.PageHeight;
|
||||||
|
float oldWidth = myDoc.PageSetup.PageWidth;
|
||||||
|
float newRight = oldWidth - (newWidth + newLeft);
|
||||||
|
if (newRight < 0) newRight = 0;
|
||||||
|
float newBottom = oldBottom - newTop;
|
||||||
|
//Console.WriteLine("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9}", newTop, newLeft, newLength, newWidth, oldTop, oldLeft, oldBottom, oldRight,oldHeight,oldWidth);
|
||||||
|
myDoc.PageSetup.BottomMargin = 0;// 11 * 72 - (newTop + newLength);
|
||||||
|
myDoc.PageSetup.RightMargin = newRight;
|
||||||
|
myDoc.PageSetup.LeftMargin = newLeft;
|
||||||
|
myDoc.PageSetup.TopMargin = newTop;
|
||||||
|
LBSelection sel = FindRO();
|
||||||
|
while (sel != null)
|
||||||
|
{
|
||||||
|
string val = lookup.GetROValueByAccPagID(sel.Text, spPrefix, igPrefix);
|
||||||
|
int? type = lookup.GetROTypeByAccPagID(sel.Text, spPrefix, igPrefix);
|
||||||
|
if ((int)type == 8) // Image
|
||||||
|
{
|
||||||
|
//Console.WriteLine("Image: {0} - {1}", sect.MyContent.Number, sect.MyContent.Text);
|
||||||
|
bool imageROTokenReplaced = false;
|
||||||
|
string[] vals = val.Split("\n".ToCharArray());
|
||||||
|
ROImageInfo roImage = ROImageInfo.GetByROFstID_FileName(rofst.ROFstID, vals[0]);
|
||||||
|
if (roImage != null)
|
||||||
|
{
|
||||||
|
ROImageFile roImageFile = new ROImageFile(roImage);
|
||||||
|
float width = 72 * Int32.Parse(vals[3], System.Globalization.NumberStyles.AllowHexSpecifier) / 12.0F;
|
||||||
|
int lines = Int32.Parse(vals[2], System.Globalization.NumberStyles.AllowHexSpecifier);
|
||||||
|
float height = 72 * lines / 6.0F;
|
||||||
|
//sel.MoveEnd(LBWdUnits.wdLine, lines);// The number of lines depends on the third parameter
|
||||||
|
//sel.EndKey(LBWdUnits.wdLine, true);
|
||||||
|
//sel.MoveEnd(LBWdUnits.wdCharacter, -1);
|
||||||
|
//Console.WriteLine("Lines = {0}", lines);
|
||||||
|
sel.Text = "";
|
||||||
|
// TODO: Need to create a temporary file for printing.
|
||||||
|
// TODO: Need a way to eliminate the temporary file when done printing.
|
||||||
|
// LBInlineShape shape = sel.InlineShapes.AddPicture(@"C:\Plant\HLP\VEHLP\ro\No1Seal.bmp");
|
||||||
|
float x = (float)sel.get_Information(LBWdInformation.wdHorizontalPositionRelativeToPage);
|
||||||
|
float y = (float)sel.get_Information(LBWdInformation.wdVerticalPositionRelativeToPage);
|
||||||
|
//LBInlineShape shape = sel.InlineShapes.AddPicture(pngFile);
|
||||||
|
LBRange myRange = sel.Paragraphs.First.Range;
|
||||||
|
float yTop = (float)myRange.get_Information(LBWdInformation.wdVerticalPositionRelativeToPage);
|
||||||
|
LBShape shape = myDoc.Shapes.AddPicture(roImageFile.MyFile.FullName, x, y - yTop, sel.Range);
|
||||||
|
// LBInlineShape shape = sel.InlineShapes.AddPicture(roImageFile.MyFile.FullName);
|
||||||
|
//Console.WriteLine("{0} Shape Width {1} Height {2}", val.Replace("\n", "','"), shape.Width, shape.Height);
|
||||||
|
shape.Width = width;
|
||||||
|
shape.Height = height;
|
||||||
|
//Console.WriteLine("{0} Shape Width {1} Height {2}", val.Replace("\n", "','"), shape.Width, shape.Height);
|
||||||
|
imageROTokenReplaced = true;
|
||||||
|
}
|
||||||
|
if (!imageROTokenReplaced)
|
||||||
|
sel.Text = string.Format("Bad Image Link (Missing Image File:{0})", vals[0]);
|
||||||
|
}
|
||||||
|
else if ((int)type == 4) // X-Y Plot
|
||||||
|
{
|
||||||
|
val = val.Replace("`", "\xB0");
|
||||||
|
//AddInfo("\tRO Found {0} = '{1}'", sel.Text, val);
|
||||||
|
sel.Text = "";
|
||||||
|
//float width = 72 * Int32.Parse(vals[3], System.Globalization.NumberStyles.AllowHexSpecifier) / 12.0F;
|
||||||
|
//float height = 72 * lines / 6.0F;
|
||||||
|
string pngFile = @"C:\Temp\XYPlot1.png";
|
||||||
|
RectangleF plotRect = CreatePlot(pngFile, val, 600F);
|
||||||
|
//LBShape shape = myDoc.Shapes.AddPicture(@"C:\Temp\XYPlot.png", 0, 0, sel.Range);
|
||||||
|
float x = (float)sel.get_Information(LBWdInformation.wdHorizontalPositionRelativeToPage);
|
||||||
|
float y = (float)sel.get_Information(LBWdInformation.wdVerticalPositionRelativeToPage);
|
||||||
|
//LBInlineShape shape = sel.InlineShapes.AddPicture(pngFile);
|
||||||
|
LBRange myRange = sel.Paragraphs.First.Range;
|
||||||
|
float yTop = (float)myRange.get_Information(LBWdInformation.wdVerticalPositionRelativeToPage);
|
||||||
|
float xAdjust = -29.3F; // TODO: Check this value
|
||||||
|
float yAdjust = 9.1F; // TODO: Check this value
|
||||||
|
LBShape shape = myDoc.Shapes.AddPicture(pngFile, x + xAdjust + plotRect.X, yAdjust + y - yTop + plotRect.Y, sel.Range);
|
||||||
|
//Console.WriteLine(",{0},{1},{2},{3}", x, y - yTop, xAdjust,yAdjust);
|
||||||
|
shape.LockAspectRatio = LBMsoTriState.msoTrue;
|
||||||
|
//shape.Width = .89F * shape.Width;
|
||||||
|
//shape.Width = float.Parse(tbAdjust.Text) * shape.Width;
|
||||||
|
shape.Width = plotRect.Width;
|
||||||
|
//shape.Height = .89F * shape.Height;
|
||||||
|
sel.WholeStory();
|
||||||
|
// TODO: Do we want to color code ROs
|
||||||
|
//sel.Range.Font.Color = LBWdColor.wdColorRed;
|
||||||
|
//Console.WriteLine("{0} Shape Width {1} Height {2}", val.Replace("\n", "','"), shape.Width, shape.Height);
|
||||||
|
//shape.Width = width;
|
||||||
|
//shape.Height = height;
|
||||||
|
//Console.WriteLine("{0} Shape Width {1} Height {2}", val.Replace("\n", "','"), shape.Width, shape.Height);
|
||||||
|
//imageROTokenReplaced = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
val = val.Replace("`", "\xB0");
|
||||||
|
//AddInfo("\tRO Found {0} = '{1}'", sel.Text, val);
|
||||||
|
InsertROValue(sel, val, sect.ActiveFormat.PlantFormat.FormatData.ROData.UpRoIfPrevUpper);
|
||||||
|
}
|
||||||
|
sel = FindRO();
|
||||||
|
}
|
||||||
|
sel = MyApp.Selection;
|
||||||
|
sel.WholeStory();
|
||||||
|
sel.Range.Font.Color = (LBWdColor)WordColor(PrintOverride.OverrideTextColor(System.Drawing.Color.Black));
|
||||||
|
sel.ParagraphFormat.LineSpacingRule = LBWdLineSpacing.wdLineSpaceExactly;
|
||||||
|
sel.ParagraphFormat.LineSpacing = 12;
|
||||||
|
fileName = CreatePDF(fileName, openPdf);
|
||||||
|
MyApp.ActiveDocument.Close();
|
||||||
|
MyApp.Quit();
|
||||||
|
_MyApp = null;
|
||||||
|
return fileName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private static int WordColor(System.Drawing.Color color)
|
||||||
|
{
|
||||||
|
System.Drawing.Color c1 = System.Drawing.Color.FromArgb(0, color.B, color.G, color.R);
|
||||||
|
return c1.ToArgb();
|
||||||
|
}
|
||||||
|
private static string GetFileName(SectionInfo sect)
|
||||||
|
{
|
||||||
|
string fileName = "Doc " + sect.MyContent.MyEntry.DocID.ToString(); // +" " + (sect.DisplayNumber == "" ? sect.DisplayText : sect.DisplayNumber);
|
||||||
|
return fileName;
|
||||||
|
}
|
||||||
|
private static RectangleF CreatePlot(string pngFile, string xyPlot, float resolution)
|
||||||
|
{
|
||||||
|
RectangleF retval = new RectangleF(0, 0, 0, 0);
|
||||||
|
Form frm = Application.OpenForms[0];
|
||||||
|
Graphics grfx = frm.CreateGraphics();
|
||||||
|
string emfFile = pngFile.Replace(".png", ".emf");
|
||||||
|
Metafile mf = new Metafile(emfFile, grfx.GetHdc());
|
||||||
|
grfx.Dispose();
|
||||||
|
grfx = Graphics.FromImage(mf);
|
||||||
|
float dpi = grfx.DpiX;
|
||||||
|
//grfx.ScaleTransform(resolution / grfx.DpiX, (resolution +1F) / grfx.DpiY);
|
||||||
|
grfx.ScaleTransform(resolution / grfx.DpiX, resolution / grfx.DpiY);
|
||||||
|
grfx.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
|
||||||
|
grfx.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
|
||||||
|
grfx.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
|
||||||
|
grfx.Clear(System.Drawing.Color.Transparent);
|
||||||
|
XYPlots.XYPlot.BlackColor = System.Drawing.Color.Red;
|
||||||
|
XYPlots.XYPlot myPlot = new XYPlots.XYPlot(xyPlot);
|
||||||
|
myPlot.SetMargins(0, 0, 0, 0);
|
||||||
|
myPlot.Process(new VG.VGOut_Graphics(grfx));
|
||||||
|
grfx.Dispose();
|
||||||
|
GraphicsUnit gu = new GraphicsUnit();
|
||||||
|
retval = mf.GetBounds(ref gu);
|
||||||
|
retval.Width *= dpi / resolution;
|
||||||
|
retval.Height *= dpi / resolution;
|
||||||
|
retval.X *= dpi / resolution;
|
||||||
|
retval.Y *= dpi / resolution;
|
||||||
|
//retval.X = myPlot.Width-retval.Width;
|
||||||
|
//AddInfo("{0},{1},{2},{3},{4},{5}", myPlot.Width, myPlot.Height, retval.Width, retval.Height,retval.X,retval.Y);
|
||||||
|
//Console.Write("{0},{1},{2},{3}", myPlot.Width, myPlot.Height, retval.Width, retval.Height);
|
||||||
|
mf.Save(pngFile, ImageFormat.Png);
|
||||||
|
//Console.WriteLine("'pngfile','{0}'", pngFile);
|
||||||
|
mf.Dispose();
|
||||||
|
FileInfo myFile = new System.IO.FileInfo(emfFile);
|
||||||
|
myFile.Delete();
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
private static void InsertROValue(LBSelection sel, string roValue, bool upRoIfPrevUpper)
|
||||||
|
{
|
||||||
|
if (roValue == null)
|
||||||
|
{
|
||||||
|
sel.Text = "RO Not Found";
|
||||||
|
sel.Font.Color = LBWdColor.wdColorRed;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (upRoIfPrevUpper && sel.LastWasUpper) roValue = roValue.ToUpper();
|
||||||
|
// Convert fortran formatted numbers to scientific notation.
|
||||||
|
|
||||||
|
string tmp = DisplayRO.ConvertFortranFormatToScienctificNotation(roValue);
|
||||||
|
// Look for superscript or subscript and insert the appropriate commands
|
||||||
|
//Match roMatch = Regex.Match(tmp, @"(.*?)\\(super|sub) (.*?)\\nosupersub ");
|
||||||
|
Match roMatch = Regex.Match(tmp, @"(.*?)\\(up3|dn3) (.*?)\\(up0|dn0) ");
|
||||||
|
if (roMatch.Groups.Count == 4)// Superscript or subscript found
|
||||||
|
{
|
||||||
|
sel.Font.Color = LBWdColor.wdColorRed;
|
||||||
|
while (roMatch.Groups.Count == 4)
|
||||||
|
{
|
||||||
|
sel.TypeText(roMatch.Groups[1].Value); // output the text preceeding the super or sub command
|
||||||
|
sel.Font.Position = roMatch.Groups[2].Value == "up3" ? 2 : -2; // Shift the vertical position for super or sub
|
||||||
|
//sel.Font.Position = roMatch.Groups[2].Value == "super" ? 2 : -2; // Shift the vertical position for super or sub
|
||||||
|
sel.TypeText(roMatch.Groups[3].Value); // output the superscript or subscript
|
||||||
|
sel.Font.Position = 0; // restore the vertical position
|
||||||
|
tmp = tmp.Substring(roMatch.Length); // remove the processed text
|
||||||
|
//roMatch = Regex.Match(tmp, @"(.*?)\\(super|sub) (.*?)\\nosupersub "); // check to see if the text contain another super or sub
|
||||||
|
roMatch = Regex.Match(tmp, @"(.*?)\\(up3|dn3) (.*?)\\(up0|dn0) "); // check to see if the text contain another super or sub
|
||||||
|
}
|
||||||
|
if(tmp != "")// Add any remaining text
|
||||||
|
sel.TypeText(tmp);
|
||||||
|
sel.Font.Color = LBWdColor.wdColorAutomatic;
|
||||||
|
}
|
||||||
|
else // if no superscripts or subscripts just output the text
|
||||||
|
{
|
||||||
|
sel.Text = roValue;
|
||||||
|
sel.Font.Color = LBWdColor.wdColorRed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private static LBSelection FindRO()
|
||||||
|
{
|
||||||
|
LBSelection sel = MyApp.Selection;
|
||||||
|
LBFind find = sel.Find;
|
||||||
|
find.ClearFormatting();
|
||||||
|
find.Text = "[<](?@)-(?@)[>]";
|
||||||
|
//find.Wrap = LBWdFindWrap.wdFindStop;
|
||||||
|
find.Wrap = LBWdFindWrap.wdFindContinue;
|
||||||
|
find.MatchCase = false;
|
||||||
|
find.MatchWholeWord = false;
|
||||||
|
find.MatchWildcards = true;
|
||||||
|
find.MatchSoundsLike = false;
|
||||||
|
find.MatchAllWordForms = false;
|
||||||
|
if (find.Execute()) return sel;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
private static string CreatePDF(string fileName, bool openPdf)
|
||||||
|
{
|
||||||
|
return MyApp.CreatePDF(@"C:\Temp\" + fileName + ".pdf", openPdf);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -7,7 +7,6 @@ using iTextSharp.text.factories;
|
|||||||
using Itenso.Rtf;
|
using Itenso.Rtf;
|
||||||
using Itenso.Rtf.Parser;
|
using Itenso.Rtf.Parser;
|
||||||
using Itenso.Rtf.Interpreter;
|
using Itenso.Rtf.Interpreter;
|
||||||
//using Itenso.Rtf.Model;
|
|
||||||
using Itenso.Rtf.Support;
|
using Itenso.Rtf.Support;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
@ -57,7 +56,6 @@ namespace Volian.Print.Library
|
|||||||
while (yTop > 0)
|
while (yTop > 0)
|
||||||
{
|
{
|
||||||
float newYTop = TextAt(cb, para, x, yTop - 12F, width, 100,"",36);
|
float newYTop = TextAt(cb, para, x, yTop - 12F, width, 100,"",36);
|
||||||
//Console.WriteLine("{0},{1},{2}", yTop, width, newYTop);
|
|
||||||
width -= 16;
|
width -= 16;
|
||||||
yTop = newYTop;
|
yTop = newYTop;
|
||||||
}
|
}
|
||||||
@ -100,7 +98,7 @@ namespace Volian.Print.Library
|
|||||||
if (iParagraph.Font.BaseFont != null)
|
if (iParagraph.Font.BaseFont != null)
|
||||||
yDescent = -iParagraph.Font.BaseFont.GetDescentPoint("Almg", iParagraph.Font.Size);
|
yDescent = -iParagraph.Font.BaseFont.GetDescentPoint("Almg", iParagraph.Font.Size);
|
||||||
if (PdfDebug)
|
if (PdfDebug)
|
||||||
DrawPdfDebug(cb, left, top, left + width, myColumnText.YLine, debugText,yDescent);
|
DrawPdfDebug(cb, left, top, left + width, myColumnText.YLine, debugText, yDescent);
|
||||||
return myColumnText.YLine;
|
return myColumnText.YLine;
|
||||||
}
|
}
|
||||||
public static float FigureAt(PdfContentByte cb, iTextSharp.text.Image image, float x, float y, float width, float height, string debugText, float yBottommargin, bool hasBorder)
|
public static float FigureAt(PdfContentByte cb, iTextSharp.text.Image image, float x, float y, float width, float height, string debugText, float yBottommargin, bool hasBorder)
|
||||||
@ -132,7 +130,6 @@ namespace Volian.Print.Library
|
|||||||
PdfLayer debugLayer = _MyPageHelper == null ? null : _MyPageHelper.DebugLayer;
|
PdfLayer debugLayer = _MyPageHelper == null ? null : _MyPageHelper.DebugLayer;
|
||||||
if (debugLayer == null) return;
|
if (debugLayer == null) return;
|
||||||
System.Drawing.Color sysColor = PrintOverride.OverrideDebugColor(System.Drawing.Color.Gray);
|
System.Drawing.Color sysColor = PrintOverride.OverrideDebugColor(System.Drawing.Color.Gray);
|
||||||
// yAdj is dependent on the size of the font and the spacing between lines.
|
|
||||||
cb.SaveState();
|
cb.SaveState();
|
||||||
cb.BeginLayer(debugLayer);
|
cb.BeginLayer(debugLayer);
|
||||||
cb.SetColorStroke(new Color(sysColor));
|
cb.SetColorStroke(new Color(sysColor));
|
||||||
|
@ -26,12 +26,6 @@ namespace Volian.Print.Library
|
|||||||
get { return _BottomMessage; }
|
get { return _BottomMessage; }
|
||||||
set { _BottomMessage = value; }
|
set { _BottomMessage = value; }
|
||||||
}
|
}
|
||||||
//vlnParagraphs _MyParagraphs = new vlnParagraphs(null);
|
|
||||||
//public vlnParagraphs MyParagraphs
|
|
||||||
//{
|
|
||||||
// get { return _MyParagraphs; }
|
|
||||||
// set { _MyParagraphs = value; }
|
|
||||||
//}
|
|
||||||
Dictionary<int, vlnParagraph> _MyParagraphs = new Dictionary<int, vlnParagraph>();
|
Dictionary<int, vlnParagraph> _MyParagraphs = new Dictionary<int, vlnParagraph>();
|
||||||
public Dictionary<int, vlnParagraph> MyParagraphs
|
public Dictionary<int, vlnParagraph> MyParagraphs
|
||||||
{
|
{
|
||||||
@ -44,16 +38,32 @@ namespace Volian.Print.Library
|
|||||||
get { return _YMultiplier; }
|
get { return _YMultiplier; }
|
||||||
set { _YMultiplier = value; }
|
set { _YMultiplier = value; }
|
||||||
}
|
}
|
||||||
|
private PdfWriter _MyPdfWriter;
|
||||||
|
public PdfWriter MyPdfWriter
|
||||||
|
{
|
||||||
|
get { return _MyPdfWriter; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
MyPageCounts = new PageCounts();
|
||||||
|
_MyPdfWriter = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private PdfContentByte _MyPdfContentByte;
|
||||||
|
public PdfContentByte MyPdfContentByte
|
||||||
|
{
|
||||||
|
get { return _MyPdfContentByte; }
|
||||||
|
set { _MyPdfContentByte = value; }
|
||||||
|
}
|
||||||
|
public override void OnCloseDocument(PdfWriter writer, iTextSharp.text.Document document)
|
||||||
|
{
|
||||||
|
MyPageCounts.DrawTemplates();
|
||||||
|
}
|
||||||
public override void OnEndPage(PdfWriter writer, iTextSharp.text.Document document)
|
public override void OnEndPage(PdfWriter writer, iTextSharp.text.Document document)
|
||||||
{
|
{
|
||||||
|
MyPageCounts.CanIncrement = true;
|
||||||
base.OnEndPage(writer, document);
|
base.OnEndPage(writer, document);
|
||||||
DrawChangeBars(writer.DirectContent);
|
DrawChangeBars(writer.DirectContent);
|
||||||
DrawMessages(writer.DirectContent);
|
DrawMessages(writer.DirectContent);
|
||||||
//DrawBackground(writer.DirectContentUnder);
|
|
||||||
//DrawPageList(writer.DirectContent);
|
|
||||||
//DrawWatermark(writer.DirectContentUnder);
|
|
||||||
//DrawZoomOMatic(writer.DirectContent);
|
|
||||||
//CurrentPageNumber++;
|
|
||||||
}
|
}
|
||||||
private void DrawMessages(PdfContentByte cb)
|
private void DrawMessages(PdfContentByte cb)
|
||||||
{
|
{
|
||||||
@ -233,7 +243,7 @@ namespace Volian.Print.Library
|
|||||||
vcb.YChangeBarBottomExtend >= (cb.YChangeBarBottomExtend - vlnPrintObject.SixLinesPerInch)) return true;
|
vcb.YChangeBarBottomExtend >= (cb.YChangeBarBottomExtend - vlnPrintObject.SixLinesPerInch)) return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
public VlnSvgPageHelper(VEPROMS.CSLA.Library.SectionInfo mySection)
|
public VlnSvgPageHelper(VEPROMS.CSLA.Library.SectionInfo mySection) : base()
|
||||||
{
|
{
|
||||||
MySection = mySection;
|
MySection = mySection;
|
||||||
}
|
}
|
||||||
@ -251,15 +261,66 @@ namespace Volian.Print.Library
|
|||||||
mySvg.TopMargin = 9.6F;
|
mySvg.TopMargin = 9.6F;
|
||||||
VEPROMS.CSLA.Library.PageStyle pageStyle = docStyle.pagestyle;
|
VEPROMS.CSLA.Library.PageStyle pageStyle = docStyle.pagestyle;
|
||||||
AddPageListItems(mySvg, pageStyle, mySection);
|
AddPageListItems(mySvg, pageStyle, mySection);
|
||||||
//DocStyle docStyle = GetDocStyle(activeFormat, (section.MyContent.Type ?? 10000));
|
|
||||||
mySvg.ProcessText += new SvgProcessTextEvent(mySvg_ProcessText);
|
mySvg.ProcessText += new SvgProcessTextEvent(mySvg_ProcessText);
|
||||||
return mySvg;
|
return mySvg;
|
||||||
}
|
}
|
||||||
|
PageCounts MyPageCounts = null;
|
||||||
private static Regex regexFindToken = new Regex("{[^{}]*}");
|
private static Regex regexFindToken = new Regex("{[^{}]*}");
|
||||||
private string mySvg_ProcessText(object sender, SvgProcessTextArgs args)
|
private string mySvg_ProcessText(object sender, SvgProcessTextArgs args)
|
||||||
{
|
{
|
||||||
if (!args.MyText.Contains("{"))
|
if (!args.MyText.Contains("{"))
|
||||||
return args.MyText;
|
return args.MyText;
|
||||||
|
/*
|
||||||
|
* Check if tokens for handling page counts ({PAGE} {OF} etc). if so, do templates.
|
||||||
|
*/
|
||||||
|
if (args.MyText.Contains("{PAGE}") || args.MyText.Contains("{OF}"))
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
public enum E_NumberingSequence : uint
|
||||||
|
{
|
||||||
|
NoPageNum = 0,
|
||||||
|
WithSteps = 1, Add to original steps section page count.
|
||||||
|
WithinEachDocStyle = 2,
|
||||||
|
WithinEachSection = 3,
|
||||||
|
WithinEachDocStyle1 = 4,
|
||||||
|
GroupedByPagination = 5,
|
||||||
|
GroupedByLevel = 6,
|
||||||
|
WithStepsAndSecondaryPageNumber = 7,
|
||||||
|
WithStepsAndSecondaryPageNumberGroupedByLevel = 8,
|
||||||
|
Like6_ButDoesntNeedSubsection = 9,
|
||||||
|
Like6_ButDoesntNeedSubsection1 = 10
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
// default for the key is to make it NumberingSequence. Then handle
|
||||||
|
// specific cases.
|
||||||
|
string key = ((int)MySection.MyDocStyle.NumberingSequence).ToString();
|
||||||
|
E_NumberingSequence numseq = MySection.MyDocStyle.NumberingSequence??0;
|
||||||
|
switch (numseq)
|
||||||
|
{
|
||||||
|
case E_NumberingSequence.WithSteps: // Number with 'originalstepsection'
|
||||||
|
ProcedureInfo pc = MySection.MyProcedure;
|
||||||
|
int sectid = 0;
|
||||||
|
foreach (SectionInfo si in pc.Sections)
|
||||||
|
{
|
||||||
|
SectionConfig sc = si.MyConfig as SectionConfig;
|
||||||
|
if (sc.Section_OriginalSteps == "Y")
|
||||||
|
{
|
||||||
|
sectid = si.ItemID;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (sectid != 0) key = (int)E_NumberingSequence.WithinEachSection + "." + sectid;
|
||||||
|
break;
|
||||||
|
case E_NumberingSequence.WithinEachDocStyle:
|
||||||
|
key = key + "." + MySection.ActiveFormat.FormatID + "." + MySection.MyDocStyle.Index;
|
||||||
|
break;
|
||||||
|
case E_NumberingSequence.WithinEachSection:
|
||||||
|
key = key + "." + MySection.ItemID;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
MyPdfContentByte.AddTemplate(MyPageCounts.AddToTemplateList(key, MyPdfWriter, args.MyText, args.MySvgText.Font, args.MySvgText.Align, args.MySvgText.FillColor), args.MySvgScale.X(args.MySvgText.X), args.MySvgScale.Y(MyPdfContentByte, args.MySvgText.Y));
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
return regexFindToken.Replace(args.MyText, new MatchEvaluator(ReplacePageListToken));
|
return regexFindToken.Replace(args.MyText, new MatchEvaluator(ReplacePageListToken));
|
||||||
}
|
}
|
||||||
private string BuildMyText(VEPROMS.CSLA.Library.FormatInfo activeFormat)
|
private string BuildMyText(VEPROMS.CSLA.Library.FormatInfo activeFormat)
|
||||||
|
@ -25,6 +25,10 @@ namespace Volian.Print.Library
|
|||||||
get { return _MyBox; }
|
get { return _MyBox; }
|
||||||
set { _MyBox = value; }
|
set { _MyBox = value; }
|
||||||
}
|
}
|
||||||
|
// the following two fields are used if 'boxed' step, thus
|
||||||
|
// no 'Box' was defined in format file.
|
||||||
|
public string DefBox = null;
|
||||||
|
public float DefEnd = 0;
|
||||||
public vlnBox()
|
public vlnBox()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -44,26 +48,34 @@ namespace Volian.Print.Library
|
|||||||
float top = CalculateYOffset(yPageStart, yTopMargin) - (7*MyPageHelper.YMultiplier);
|
float top = CalculateYOffset(yPageStart, yTopMargin) - (7*MyPageHelper.YMultiplier);
|
||||||
float bottom = top - (Height * MyPageHelper.YMultiplier);
|
float bottom = top - (Height * MyPageHelper.YMultiplier);
|
||||||
float leftmargin = (float)MyParent.MyItemInfo.MyDocStyle.Layout.LeftMargin + 3;
|
float leftmargin = (float)MyParent.MyItemInfo.MyDocStyle.Layout.LeftMargin + 3;
|
||||||
float left = leftmargin + (float)(MyBox.Start ?? 0);
|
float left = (float)(MyBox.Start == null ? MyParent.MyItemInfo.MyDocStyle.Layout.LeftMargin : leftmargin + MyBox.Start);
|
||||||
float right = leftmargin + (float)MyBox.End;
|
float right = leftmargin + (float)(MyBox.End ?? DefEnd);
|
||||||
iTextSharp.text.Color boxColor = new iTextSharp.text.Color(PrintOverride.OverrideBoxColor(System.Drawing.Color.Black));
|
iTextSharp.text.Color boxColor = new iTextSharp.text.Color(PrintOverride.OverrideBoxColor(System.Drawing.Color.Black));
|
||||||
cb.SetColorStroke(boxColor);
|
cb.SetColorStroke(boxColor);
|
||||||
|
if (DefBox != null)
|
||||||
|
{
|
||||||
|
cb.SetLineWidth(.6F);
|
||||||
|
cb.Rectangle(left, bottom, right - left, Height * MyPageHelper.YMultiplier);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
switch (MyBox.BoxStyle)
|
switch (MyBox.BoxStyle)
|
||||||
{
|
{
|
||||||
case BoxThin:
|
case BoxThin:
|
||||||
cb.SetLineWidth(.6F);
|
cb.SetLineWidth(.6F);
|
||||||
cb.Rectangle(left, bottom, right - left, Height*MyPageHelper.YMultiplier);
|
cb.Rectangle(left, bottom, right - left, Height * MyPageHelper.YMultiplier);
|
||||||
break;
|
break;
|
||||||
case BoxThick:
|
case BoxThick:
|
||||||
float lineThickness = 6;
|
float lineThickness = 6;
|
||||||
cb.SetLineWidth(lineThickness);
|
cb.SetLineWidth(lineThickness);
|
||||||
cb.Rectangle(left, bottom + (lineThickness/2), right - left, (Height - lineThickness)*MyPageHelper.YMultiplier);
|
cb.Rectangle(left+6, bottom + (lineThickness / 2), right - left - 6, (Height - lineThickness) * MyPageHelper.YMultiplier);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// For other than OHLP/HLP. For those not matching the HLP Boxes
|
// For other than OHLP/HLP. For those not matching the HLP Boxes
|
||||||
throw new Exception("Missing vlnBox handler");
|
throw new Exception("Missing vlnBox handler");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
cb.Stroke();
|
cb.Stroke();
|
||||||
if (textLayer != null) cb.EndLayer();
|
if (textLayer != null) cb.EndLayer();
|
||||||
cb.RestoreState();
|
cb.RestoreState();
|
||||||
|
@ -33,9 +33,20 @@ namespace Volian.Print.Library
|
|||||||
foreach (ItemInfo childItemInfo in itemInfoList)
|
foreach (ItemInfo childItemInfo in itemInfoList)
|
||||||
{
|
{
|
||||||
int? bxIndx = childItemInfo.FormatStepData.StepLayoutData.STBoxindex;
|
int? bxIndx = childItemInfo.FormatStepData.StepLayoutData.STBoxindex;
|
||||||
if (bxIndex != bxIndx)
|
if (bxIndex != bxIndx || childItemInfo.FormatStepData.BoxIt)
|
||||||
{
|
{
|
||||||
if (bxIndex == null) // First boxed step
|
if (childItemInfo.FormatStepData.BoxIt) // this is a boxed HLS
|
||||||
|
{
|
||||||
|
box = new vlnBox();
|
||||||
|
box.MyBox = new Box();
|
||||||
|
box.DefBox = vlnBox.BoxThin;
|
||||||
|
StepSectionLayoutData ssld = formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData;
|
||||||
|
int colR = int.Parse(formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColRTable.Split(",".ToCharArray())[childItemInfo.ColumnMode]);
|
||||||
|
int widS = vlnPrintObject.ToInt(formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.WidSTablePrint, maxRNO);
|
||||||
|
box.DefEnd = (float)(ssld.ColS + colR + widS + (60/4.8));
|
||||||
|
box.YOffset = yoff - .75F * vlnPrintObject.SixLinesPerInch;
|
||||||
|
}
|
||||||
|
else if (bxIndex == null) // First boxed step
|
||||||
{
|
{
|
||||||
box = new vlnBox();
|
box = new vlnBox();
|
||||||
box.MyBox = formatInfo.PlantFormat.FormatData.BoxList[(int)bxIndx];
|
box.MyBox = formatInfo.PlantFormat.FormatData.BoxList[(int)bxIndx];
|
||||||
@ -61,9 +72,15 @@ namespace Volian.Print.Library
|
|||||||
para.PartsContainer.Add(box);
|
para.PartsContainer.Add(box);
|
||||||
}
|
}
|
||||||
Add(para);
|
Add(para);
|
||||||
|
// para.YBottomMost will have y for bottom of any substeps that are also enclosed in the box.
|
||||||
yoff = para.YBottomMost;
|
yoff = para.YBottomMost;
|
||||||
|
if (childItemInfo.FormatStepData.BoxIt)
|
||||||
|
{
|
||||||
|
box.Height = yoff - box.YOffset - (1.1F * vlnPrintObject.SixLinesPerInch);
|
||||||
|
box = null; // if doing boxed steps, only do single sibling at a time.
|
||||||
}
|
}
|
||||||
if (bxIndex != null) // End Box Style
|
}
|
||||||
|
if (box != null)
|
||||||
{
|
{
|
||||||
if (box != null) box.Height = yoff - box.YOffset; // new height, with children
|
if (box != null) box.Height = yoff - box.YOffset; // new height, with children
|
||||||
yoff += 2 * vlnPrintObject.SixLinesPerInch;
|
yoff += 2 * vlnPrintObject.SixLinesPerInch;
|
||||||
@ -84,13 +101,7 @@ namespace Volian.Print.Library
|
|||||||
public float ParagraphToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin)
|
public float ParagraphToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin)
|
||||||
{
|
{
|
||||||
if (Processed) return yPageStart;
|
if (Processed) return yPageStart;
|
||||||
//if (!MyPageHelper.MyParagraphs.ContainsValue(this)) return yPageStart;
|
|
||||||
Processed = true;
|
Processed = true;
|
||||||
//MyPageHelper.MyParagraphs.Remove(this.MyItemInfo.ItemID);
|
|
||||||
//Console.WriteLine("'{0}',{1},{2},{3},{4},{5},{6},{7},{8}", MyItemInfo.Path.Substring(_Prefix.Length).Trim(),
|
|
||||||
// cb.PdfWriter.CurrentPageNumber, yStart, YTop, yStart + YTop, yStart + YTop - _LastY, YTopMost, YSize, yPageStart);
|
|
||||||
//_LastY = yStart + YTop;
|
|
||||||
// 72 points per inchs. 504 is 7 inches wide. 3 1/2 inches wide: 252, 100);
|
|
||||||
if (_PartsAbove != null && _PartsAbove.Count > 0) yPageStart = PartsAbove.ToPdf(cb, yPageStart, yTopMargin, yBottomMargin);
|
if (_PartsAbove != null && _PartsAbove.Count > 0) yPageStart = PartsAbove.ToPdf(cb, yPageStart, yTopMargin, yBottomMargin);
|
||||||
float yLocation = CalculateYOffset(yPageStart, yTopMargin);
|
float yLocation = CalculateYOffset(yPageStart, yTopMargin);
|
||||||
if (MyItemInfo.HasChangeBar()) MyPageHelper.AddChangeBar(DoChangeBar(cb, MyItemInfo, MyPageHelper, XOffset, yLocation, MyPageHelper.MaxRNO, MyItemInfo.ActiveFormat), cbMess);
|
if (MyItemInfo.HasChangeBar()) MyPageHelper.AddChangeBar(DoChangeBar(cb, MyItemInfo, MyPageHelper, XOffset, yLocation, MyPageHelper.MaxRNO, MyItemInfo.ActiveFormat), cbMess);
|
||||||
@ -161,8 +172,6 @@ namespace Volian.Print.Library
|
|||||||
}
|
}
|
||||||
public override float ToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin)
|
public override float ToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin)
|
||||||
{
|
{
|
||||||
//if (!MyPageHelper.MyParagraphs.Contains(this)) return yPageStart;
|
|
||||||
//MyPageHelper.MyParagraphs.Remove(this);
|
|
||||||
float yLocation = yPageStart - YTopMost;
|
float yLocation = yPageStart - YTopMost;
|
||||||
int paginate = Paginate(yLocation, yTopMargin, yBottomMargin);
|
int paginate = Paginate(yLocation, yTopMargin, yBottomMargin);
|
||||||
switch (paginate)
|
switch (paginate)
|
||||||
@ -187,7 +196,7 @@ namespace Volian.Print.Library
|
|||||||
Console.WriteLine("Not done yet");
|
Console.WriteLine("Not done yet");
|
||||||
break;
|
break;
|
||||||
case E_ContBottomLoc.BottomOfPage: // place continue message at bottom of page
|
case E_ContBottomLoc.BottomOfPage: // place continue message at bottom of page
|
||||||
msg_yLocation = yBottomMargin; // +2 * _SixLinesPerInch; // 2 lines above bottom margin
|
msg_yLocation = yBottomMargin + 2 * SixLinesPerInch; // 2 lines above bottom margin
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//float msg_yLocation = CalculateYOffset(yPageStart, yTopMargin);
|
//float msg_yLocation = CalculateYOffset(yPageStart, yTopMargin);
|
||||||
@ -254,8 +263,6 @@ namespace Volian.Print.Library
|
|||||||
{
|
{
|
||||||
float yPageSize = yTopMargin - yBottomMargin;
|
float yPageSize = yTopMargin - yBottomMargin;
|
||||||
float yWithinMargins = CalculateYLocation(yLocation, yTopMargin) - yBottomMargin;
|
float yWithinMargins = CalculateYLocation(yLocation, yTopMargin) - yBottomMargin;
|
||||||
if (MyItemInfo.ItemID == 832)
|
|
||||||
Console.Write(",'Here'");
|
|
||||||
if (MyItemInfo.IsStepSection) return 0; // Don't Paginate on a Step Section
|
if (MyItemInfo.IsStepSection) return 0; // Don't Paginate on a Step Section
|
||||||
float mySize = YSize * MyPageHelper.YMultiplier;
|
float mySize = YSize * MyPageHelper.YMultiplier;
|
||||||
if (mySize <= yWithinMargins)
|
if (mySize <= yWithinMargins)
|
||||||
@ -766,28 +773,6 @@ namespace Volian.Print.Library
|
|||||||
return _ChildrenLeft;
|
return _ChildrenLeft;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//public vlnParagraph(vlnParagraph myParent, ItemInfo myItemInfo, float xoff, float yoff, float width, string rtf, ChildLocation childRelation)
|
|
||||||
//{
|
|
||||||
// MyParent = myParent;
|
|
||||||
// MyItemInfo = myItemInfo;
|
|
||||||
// XOffset = xoff;
|
|
||||||
// YOffset = yoff;
|
|
||||||
// Width = width;
|
|
||||||
// Rtf = rtf;
|
|
||||||
// switch (childRelation)
|
|
||||||
// {
|
|
||||||
// case ChildLocation.Below:
|
|
||||||
// myParent.ChildrenBelow.Add(this);
|
|
||||||
// break;
|
|
||||||
// case ChildLocation.Above:
|
|
||||||
// myParent.ChildrenAbove.Add(this);
|
|
||||||
// break;
|
|
||||||
// case ChildLocation.Right:
|
|
||||||
// myParent.ChildrenRight.Add(this);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
public void AdjustXOffsetForTab(ItemInfo itemInfo, int maxRNO, FormatInfo formatInfo, vlnTab myTab)
|
public void AdjustXOffsetForTab(ItemInfo itemInfo, int maxRNO, FormatInfo formatInfo, vlnTab myTab)
|
||||||
{
|
{
|
||||||
float tabWidth = (myTab == null) ? 0 : myTab.Width;
|
float tabWidth = (myTab == null) ? 0 : myTab.Width;
|
||||||
|
@ -33,7 +33,7 @@ namespace Volian.Print.Library
|
|||||||
YOffset = yoffset;
|
YOffset = yoffset;
|
||||||
Text = cleanText;
|
Text = cleanText;
|
||||||
Rtf = GetRtf(origText, vFont);
|
Rtf = GetRtf(origText, vFont);
|
||||||
XOffset = xoffset; // -Width;
|
XOffset = xoffset;
|
||||||
MyFont = vFont;
|
MyFont = vFont;
|
||||||
Width = _CharsToTwips * (Text.Length + 2);
|
Width = _CharsToTwips * (Text.Length + 2);
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ namespace Volian.Svg.Library
|
|||||||
set { _MyFillSettings.Fill = value; }
|
set { _MyFillSettings.Fill = value; }
|
||||||
}
|
}
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
protected Color FillColor
|
public Color FillColor
|
||||||
{
|
{
|
||||||
get { return Svg.OverrideColor != System.Drawing.Color.Empty ? Svg.OverrideColor : _MyFillSettings.FillColor; }
|
get { return Svg.OverrideColor != System.Drawing.Color.Empty ? Svg.OverrideColor : _MyFillSettings.FillColor; }
|
||||||
set { _MyFillSettings.FillColor = value; }
|
set { _MyFillSettings.FillColor = value; }
|
||||||
|
@ -2,7 +2,6 @@ using System;
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
//using System.Text;
|
|
||||||
using System.Xml.Serialization;
|
using System.Xml.Serialization;
|
||||||
using iTextSharp.text;
|
using iTextSharp.text;
|
||||||
using iTextSharp.text.pdf;
|
using iTextSharp.text.pdf;
|
||||||
@ -10,7 +9,6 @@ using iTextSharp.text.factories;
|
|||||||
using Itenso.Rtf;
|
using Itenso.Rtf;
|
||||||
using Itenso.Rtf.Parser;
|
using Itenso.Rtf.Parser;
|
||||||
using Itenso.Rtf.Interpreter;
|
using Itenso.Rtf.Interpreter;
|
||||||
//using Itenso.Rtf.Model;
|
|
||||||
using Itenso.Rtf.Support;
|
using Itenso.Rtf.Support;
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
@ -73,9 +71,23 @@ namespace Volian.Svg.Library
|
|||||||
{
|
{
|
||||||
get { return _MyText; }
|
get { return _MyText; }
|
||||||
}
|
}
|
||||||
public SvgProcessTextArgs(string myText)
|
private SvgText _MySvgText;
|
||||||
|
public SvgText MySvgText
|
||||||
|
{
|
||||||
|
get { return _MySvgText; }
|
||||||
|
set { _MySvgText = value; }
|
||||||
|
}
|
||||||
|
private SvgScale _MySvgScale;
|
||||||
|
public SvgScale MySvgScale
|
||||||
|
{
|
||||||
|
get { return _MySvgScale; }
|
||||||
|
set { _MySvgScale = value; }
|
||||||
|
}
|
||||||
|
public SvgProcessTextArgs(string myText, SvgText mySvgText, SvgScale mySvgScale)
|
||||||
{
|
{
|
||||||
_MyText = myText;
|
_MyText = myText;
|
||||||
|
_MySvgText = mySvgText;
|
||||||
|
_MySvgScale = mySvgScale;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public partial class Svg : SvgGroup
|
public partial class Svg : SvgGroup
|
||||||
@ -89,10 +101,10 @@ namespace Volian.Svg.Library
|
|||||||
macro.SvgParts.Draw(cb, MyScale.AdjustOrigin(X, Y), this,this);
|
macro.SvgParts.Draw(cb, MyScale.AdjustOrigin(X, Y), this,this);
|
||||||
}
|
}
|
||||||
public event SvgProcessTextEvent ProcessText;
|
public event SvgProcessTextEvent ProcessText;
|
||||||
internal string OnProcessText(string myText)
|
internal string OnProcessText(string myText, SvgText mySvgText, SvgScale scale)
|
||||||
{
|
{
|
||||||
if (ProcessText != null)
|
if (ProcessText != null)
|
||||||
return ProcessText(this, new SvgProcessTextArgs(myText));
|
return ProcessText(this, new SvgProcessTextArgs(myText, mySvgText, scale));
|
||||||
return myText;
|
return myText;
|
||||||
}
|
}
|
||||||
private Dictionary<string, PdfTemplate> _Templates;
|
private Dictionary<string, PdfTemplate> _Templates;
|
||||||
@ -102,7 +114,6 @@ namespace Volian.Svg.Library
|
|||||||
{
|
{
|
||||||
PdfTemplate tmp = cb.CreateTemplate(100, 100);
|
PdfTemplate tmp = cb.CreateTemplate(100, 100);
|
||||||
_Templates.Add(name, tmp);
|
_Templates.Add(name, tmp);
|
||||||
//tmp.BoundingBox = new iTextSharp.text.Rectangle(-200,-200,700,200);
|
|
||||||
}
|
}
|
||||||
return _Templates[name];
|
return _Templates[name];
|
||||||
}
|
}
|
||||||
@ -164,13 +175,11 @@ namespace Volian.Svg.Library
|
|||||||
RegisterFont(fontName);
|
RegisterFont(fontName);
|
||||||
return FontFactory.GetFont(fontName);
|
return FontFactory.GetFont(fontName);
|
||||||
}
|
}
|
||||||
//private void RegisterFonts()
|
public static iTextSharp.text.Font GetFont(string fontName, float size, int style, System.Drawing.Color color)
|
||||||
//{
|
{
|
||||||
// //if (!FontFactory.IsRegistered("Arial"))
|
RegisterFont(fontName);
|
||||||
// //{
|
return FontFactory.GetFont(fontName, size, style, new iTextSharp.text.Color(color));
|
||||||
// // RegisterFont("Prestige Elite Tall");
|
}
|
||||||
// //}
|
|
||||||
//}
|
|
||||||
public static void RegisterFont(string fontName)
|
public static void RegisterFont(string fontName)
|
||||||
{
|
{
|
||||||
if (!FontFactory.IsRegistered(fontName))
|
if (!FontFactory.IsRegistered(fontName))
|
||||||
@ -378,12 +387,10 @@ namespace Volian.Svg.Library
|
|||||||
SetupInheritance(myParent.MyInheritedSettings);
|
SetupInheritance(myParent.MyInheritedSettings);
|
||||||
cb.SaveState();
|
cb.SaveState();
|
||||||
iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance(ImagePath);
|
iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance(ImagePath);
|
||||||
//Console.WriteLine("Before ScaledHeight = {0}", img.ScaledHeight);
|
|
||||||
if (Height.Value != 0)
|
if (Height.Value != 0)
|
||||||
img.ScaleAbsoluteHeight(scale.M(Height));
|
img.ScaleAbsoluteHeight(scale.M(Height));
|
||||||
if (Width.Value != 0)
|
if (Width.Value != 0)
|
||||||
img.ScaleAbsoluteWidth(scale.M(Width));
|
img.ScaleAbsoluteWidth(scale.M(Width));
|
||||||
//Console.WriteLine("After ScaledHeight = {0}", img.ScaledHeight);
|
|
||||||
img.SetAbsolutePosition(scale.X(X), scale.Y(cb, Y) - scale.M(img.ScaledHeight));
|
img.SetAbsolutePosition(scale.X(X), scale.Y(cb, Y) - scale.M(img.ScaledHeight));
|
||||||
cb.AddImage(img);
|
cb.AddImage(img);
|
||||||
cb.RestoreState();
|
cb.RestoreState();
|
||||||
@ -408,14 +415,12 @@ namespace Volian.Svg.Library
|
|||||||
bool stroke = LineColor != System.Drawing.Color.Empty;
|
bool stroke = LineColor != System.Drawing.Color.Empty;
|
||||||
if (stroke)
|
if (stroke)
|
||||||
{
|
{
|
||||||
//cb.SetLineWidth(scale.M(LineWidth));
|
|
||||||
cb.SetLineWidth(LineWidth.Value);
|
cb.SetLineWidth(LineWidth.Value);
|
||||||
cb.SetColorStroke(new Color(LineColor));
|
cb.SetColorStroke(new Color(LineColor));
|
||||||
}
|
}
|
||||||
cb.SetLineCap(PdfContentByte.LINE_CAP_ROUND);
|
cb.SetLineCap(PdfContentByte.LINE_CAP_ROUND);
|
||||||
cb.MoveTo(scale.X(X1), scale.Y(cb, Y1));
|
cb.MoveTo(scale.X(X1), scale.Y(cb, Y1));
|
||||||
cb.LineTo(scale.X(X2), scale.Y(cb, Y2));
|
cb.LineTo(scale.X(X2), scale.Y(cb, Y2));
|
||||||
//Console.WriteLine("'CB Line',{0},{1},{2},{3},{4}", scale.X(X1), scale.Y(cb, Y1), scale.X(X2), scale.Y(cb, Y2), scale.M(LineWidth));
|
|
||||||
cb.Stroke();
|
cb.Stroke();
|
||||||
cb.RestoreState();
|
cb.RestoreState();
|
||||||
}
|
}
|
||||||
@ -431,7 +436,6 @@ namespace Volian.Svg.Library
|
|||||||
}
|
}
|
||||||
tmp.MoveTo(scale.X(X1), scale.Y(Y1));
|
tmp.MoveTo(scale.X(X1), scale.Y(Y1));
|
||||||
tmp.LineTo(scale.X(X2), scale.Y(Y2));
|
tmp.LineTo(scale.X(X2), scale.Y(Y2));
|
||||||
//Console.WriteLine("'Template Line',{0},{1},{2},{3},{4}", scale.X(X1), scale.Y(tmp, Y1), scale.X(X2), scale.Y(tmp, Y2), scale.M(LineWidth));
|
|
||||||
tmp.Stroke();
|
tmp.Stroke();
|
||||||
tmp.RestoreState();
|
tmp.RestoreState();
|
||||||
Svg.FixBoundingBox(tmp, scale.X(X1), scale.Y(Y1), scale.X(X2), scale.Y(Y2));
|
Svg.FixBoundingBox(tmp, scale.X(X1), scale.Y(Y1), scale.X(X2), scale.Y(Y2));
|
||||||
@ -483,90 +487,43 @@ namespace Volian.Svg.Library
|
|||||||
tmp.SetLineWidth(scale.M(OutlineWidth));
|
tmp.SetLineWidth(scale.M(OutlineWidth));
|
||||||
tmp.SetColorStroke(new Color(OutlineColor));
|
tmp.SetColorStroke(new Color(OutlineColor));
|
||||||
}
|
}
|
||||||
//tmp.Rectangle(scale.X(X), scale.Y(Y), scale.M(Width), -scale.M(Height));
|
|
||||||
tmp.Rectangle(scale.X(X), scale.Y(Y), scale.M(Width), -scale.M(Height));
|
tmp.Rectangle(scale.X(X), scale.Y(Y), scale.M(Width), -scale.M(Height));
|
||||||
SvgITextLibrary.StrokeAndFill(tmp, stroke, fill);
|
SvgITextLibrary.StrokeAndFill(tmp, stroke, fill);
|
||||||
Svg.FixBoundingBox(tmp, scale.X(X), scale.Y(Y), scale.X(X) + scale.M(Width), scale.Y(Y) - scale.M(Height));
|
Svg.FixBoundingBox(tmp, scale.X(X), scale.Y(Y), scale.X(X) + scale.M(Width), scale.Y(Y) - scale.M(Height));
|
||||||
tmp.RestoreState();
|
tmp.RestoreState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//public partial class SvgRtf : SvgShapePart
|
|
||||||
//{
|
|
||||||
// public override void Draw(PdfContentByte cb, SvgScale scale, Svg mySvg, SvgPartInheritance myParent)
|
|
||||||
// {
|
|
||||||
// ColumnText ct = new ColumnText(cb);
|
|
||||||
// IRtfDocument myRtf = RtfInterpreterTool.BuildDoc(Rtf);
|
|
||||||
// Rtf2iTextSharp rtf = new Rtf2iTextSharp(myRtf);
|
|
||||||
// Paragraph p = rtf.Convert();
|
|
||||||
// p.SetLeading(0, 1);
|
|
||||||
// float leading = 10;
|
|
||||||
// ct.SetSimpleColumn(scale.X(X), scale.Y(cb, Y) + leading, scale.X(X) + scale.M(Width), scale.Y(cb, Y) - cb.PdfDocument.PageSize.Height);
|
|
||||||
// ct.AddElement(p);
|
|
||||||
// ct.Go();
|
|
||||||
// }
|
|
||||||
// public override void Draw(PdfTemplate tmp, SvgScale scale, Svg mySvg, SvgPartInheritance myParent)
|
|
||||||
// {
|
|
||||||
// ColumnText ct = new ColumnText(tmp);
|
|
||||||
// IRtfDocument myRtf = RtfInterpreterTool.BuildDoc(Rtf);
|
|
||||||
// Rtf2iTextSharp rtf = new Rtf2iTextSharp(myRtf);
|
|
||||||
// Paragraph p = rtf.Convert();
|
|
||||||
// p.SetLeading(0, 1);
|
|
||||||
// float leading = 10;
|
|
||||||
// ct.SetSimpleColumn(scale.X(X), scale.Y(Y) + leading, scale.X(X) + scale.M(Width), scale.Y(Y) - tmp.PdfDocument.PageSize.Height);
|
|
||||||
// ct.AddElement(p);
|
|
||||||
// ct.Go();
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
public partial class SvgText : SvgShapePart
|
public partial class SvgText : SvgShapePart
|
||||||
{
|
{
|
||||||
|
public int Align
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
switch (Justify)
|
||||||
|
{
|
||||||
|
case SvgJustify.Left:
|
||||||
|
return Element.ALIGN_LEFT;
|
||||||
|
break;
|
||||||
|
case SvgJustify.Center:
|
||||||
|
return Element.ALIGN_CENTER;
|
||||||
|
break;
|
||||||
|
case SvgJustify.Right:
|
||||||
|
return Element.ALIGN_RIGHT;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return Element.ALIGN_LEFT;
|
||||||
|
}
|
||||||
|
}
|
||||||
public override void Draw(PdfContentByte cb, SvgScale scale, Svg mySvg, SvgPartInheritance myParent)
|
public override void Draw(PdfContentByte cb, SvgScale scale, Svg mySvg, SvgPartInheritance myParent)
|
||||||
{
|
{
|
||||||
string text = mySvg.OnProcessText(Text);
|
string text = mySvg.OnProcessText(Text, this, scale);
|
||||||
|
if (text == string.Empty) return;
|
||||||
SetupInheritance(myParent.MyInheritedSettings);
|
SetupInheritance(myParent.MyInheritedSettings);
|
||||||
float yScale = scale.Y(cb, Y);
|
float yScale = scale.Y(cb, Y);
|
||||||
cb.SaveState();
|
cb.SaveState();
|
||||||
bool fill = FillColor != System.Drawing.Color.Transparent;
|
bool fill = FillColor != System.Drawing.Color.Transparent;
|
||||||
bool stroke = OutlineWidth.Value != 0F && OutlineColor != System.Drawing.Color.Empty;
|
bool stroke = OutlineWidth.Value != 0F && OutlineColor != System.Drawing.Color.Empty;
|
||||||
//cb.MoveTo(0, scale.Y(cb, Y));
|
|
||||||
//cb.LineTo(500, scale.Y(cb, Y));
|
|
||||||
//cb.SetColorStroke(Color.BLUE);
|
|
||||||
//cb.Stroke();
|
|
||||||
//cb.BeginText();
|
|
||||||
/*
|
|
||||||
if (fill)
|
|
||||||
cb.SetColorFill(new Color(FillColor));
|
|
||||||
if (stroke)
|
|
||||||
{
|
|
||||||
cb.SetLineWidth(scale.M(OutlineWidth));
|
|
||||||
cb.SetColorStroke(new Color(OutlineColor));
|
|
||||||
}
|
|
||||||
cb.SetColorFill(Color.RED);
|
|
||||||
*/
|
|
||||||
//iTextSharp.text.pdf.ColumnText ct = new ColumnText(cb);
|
|
||||||
iTextSharp.text.Font font = FontFactory.GetFont(Font.Name, scale.M(new SvgMeasurement(Font.SizeInPoints, E_MeasurementUnits.PT)));
|
iTextSharp.text.Font font = FontFactory.GetFont(Font.Name, scale.M(new SvgMeasurement(Font.SizeInPoints, E_MeasurementUnits.PT)));
|
||||||
//BaseFont baseFont = font.BaseFont;
|
|
||||||
//cb.MoveText(scale.X(X), yScale);
|
|
||||||
//cb.SetFontAndSize(baseFont, Font.SizeInPoints);
|
|
||||||
//BaseFont baseFont = BaseFont.CreateFont("Helvetica", BaseFont.CP1252, BaseFont.NOT_EMBEDDED);
|
|
||||||
//cb.SetFontAndSize(baseFont, scale.M(new SvgMeasurement(Font.SizeInPoints, E_MeasurementUnits.PT)));
|
|
||||||
//Console.WriteLine("\"FontSize\",{0},{1}", Font.SizeInPoints, scale.M(new SvgMeasurement(Font.SizeInPoints, E_MeasurementUnits.PT)));
|
|
||||||
/*
|
|
||||||
switch ((stroke ? 1 : 0) + (fill ? 2 : 0))
|
|
||||||
{
|
|
||||||
case 0: // No Stroke or Fill
|
|
||||||
cb.SetTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_INVISIBLE);
|
|
||||||
break;
|
|
||||||
case 1: // Stroke
|
|
||||||
cb.SetTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_STROKE);
|
|
||||||
break;
|
|
||||||
case 2: // Fill
|
|
||||||
cb.SetTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_FILL);
|
|
||||||
break;
|
|
||||||
case 3: // Stroke and Fill
|
|
||||||
cb.SetTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
ColumnText ct = new ColumnText(cb);
|
ColumnText ct = new ColumnText(cb);
|
||||||
Chunk chk = new Chunk(text, font);
|
Chunk chk = new Chunk(text, font);
|
||||||
float x = scale.X(X);
|
float x = scale.X(X);
|
||||||
@ -575,55 +532,38 @@ namespace Volian.Svg.Library
|
|||||||
{
|
{
|
||||||
//case SvgJustify.Left:
|
//case SvgJustify.Left:
|
||||||
//x=x;
|
//x=x;
|
||||||
//cb.ShowTextAlignedKerned(PdfContentByte.ALIGN_LEFT, Text, scale.X(X), yScale, 0F);
|
|
||||||
//break;
|
//break;
|
||||||
case SvgJustify.Center:
|
case SvgJustify.Center:
|
||||||
x-=w/2;
|
x-=w/2;
|
||||||
//cb.ShowTextAlignedKerned(PdfContentByte.ALIGN_CENTER, Text, scale.X(X), yScale, 0F);
|
|
||||||
break;
|
break;
|
||||||
case SvgJustify.Right:
|
case SvgJustify.Right:
|
||||||
x-=w;
|
x-=w;
|
||||||
//cb.ShowTextAlignedKerned(PdfContentByte.ALIGN_RIGHT, Text, scale.X(X), yScale, 0F);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
float y = yScale;
|
float y = yScale;
|
||||||
float xRight = x + w;
|
float xRight = x + w;
|
||||||
//float adjustForUnderline = Font.Underline ? Font.Size * .047F / 2 : 0;
|
|
||||||
//float adjustForDescender = font.BaseFont.GetDescentPoint("Almg", font.Size);
|
|
||||||
//float width = font.BaseFont.GetWidthPoint(Text, font.Size);
|
|
||||||
//x -= isCentered ? width / 2 : 0;
|
|
||||||
//xRight = x + font.BaseFont.GetWidthPoint(Text, font.Size) + adjustForUnderline;
|
|
||||||
|
|
||||||
float Offset = 0;
|
float Offset = 0;
|
||||||
if (Font.Underline)
|
if (Font.Underline)
|
||||||
{
|
{
|
||||||
chk.SetUnderline(new Color(FillColor), 0, 0.047F, 0, -.1373F, PdfContentByte.LINE_CAP_ROUND);
|
chk.SetUnderline(new Color(FillColor), 0, 0.047F, 0, -.1373F, PdfContentByte.LINE_CAP_ROUND);
|
||||||
}
|
}
|
||||||
Phrase ph = new Phrase(chk);
|
Phrase ph = new Phrase(chk);
|
||||||
//Paragraph ph = new Paragraph(chk);
|
|
||||||
ct.SetSimpleColumn(x, y + ph.Leading + Offset, xRight + 1F, y + ph.Leading + Offset - 2 * font.Size);
|
ct.SetSimpleColumn(x, y + ph.Leading + Offset, xRight + 1F, y + ph.Leading + Offset - 2 * font.Size);
|
||||||
ct.AddElement(ph);
|
ct.AddElement(ph);
|
||||||
cb.SaveState();
|
cb.SaveState();
|
||||||
cb.SetColorFill(new Color(FillColor));
|
cb.SetColorFill(new Color(FillColor));
|
||||||
ct.Go();
|
ct.Go();
|
||||||
cb.RestoreState();
|
cb.RestoreState();
|
||||||
//Console.WriteLine("'{0}',{1},{2},{3},{4}", Text, scale.X(X), yScale, X, Y);
|
|
||||||
//cb.ShowTextKerned(Text);
|
|
||||||
//cb.EndText();
|
|
||||||
//cb.RestoreState();
|
|
||||||
}
|
}
|
||||||
public override void Draw(PdfTemplate tmp, SvgScale scale, Svg mySvg, SvgPartInheritance myParent)
|
public override void Draw(PdfTemplate tmp, SvgScale scale, Svg mySvg, SvgPartInheritance myParent)
|
||||||
{
|
{
|
||||||
string text = mySvg.OnProcessText(Text);
|
string text = mySvg.OnProcessText(Text, this, scale);
|
||||||
|
if (text == string.Empty) return;
|
||||||
SetupInheritance(myParent.MyInheritedSettings);
|
SetupInheritance(myParent.MyInheritedSettings);
|
||||||
float yScale = -scale.Y(Y);
|
float yScale = -scale.Y(Y);
|
||||||
tmp.SaveState();
|
tmp.SaveState();
|
||||||
bool fill = FillColor != System.Drawing.Color.Transparent;
|
bool fill = FillColor != System.Drawing.Color.Transparent;
|
||||||
bool stroke = OutlineWidth.Value != 0F && OutlineColor != System.Drawing.Color.Empty;
|
bool stroke = OutlineWidth.Value != 0F && OutlineColor != System.Drawing.Color.Empty;
|
||||||
//cb.MoveTo(0, scale.Y(cb, Y));
|
|
||||||
//cb.LineTo(500, scale.Y(cb, Y));
|
|
||||||
//cb.SetColorStroke(Color.BLUE);
|
|
||||||
//cb.Stroke();
|
|
||||||
tmp.BeginText();
|
tmp.BeginText();
|
||||||
if (fill)
|
if (fill)
|
||||||
tmp.SetColorFill(new Color(FillColor));
|
tmp.SetColorFill(new Color(FillColor));
|
||||||
@ -632,15 +572,10 @@ namespace Volian.Svg.Library
|
|||||||
tmp.SetLineWidth(scale.M(OutlineWidth));
|
tmp.SetLineWidth(scale.M(OutlineWidth));
|
||||||
tmp.SetColorStroke(new Color(OutlineColor));
|
tmp.SetColorStroke(new Color(OutlineColor));
|
||||||
}
|
}
|
||||||
//iTextSharp.text.pdf.ColumnText ct = new ColumnText(cb);
|
|
||||||
//Console.WriteLine("Font['{0}'].IsRegistered = {1}",Font.Name,FontFactory.IsRegistered(Font.Name));
|
|
||||||
iTextSharp.text.Font font = Svg.GetFont(Font.Name);
|
iTextSharp.text.Font font = Svg.GetFont(Font.Name);
|
||||||
BaseFont baseFont = font.BaseFont;
|
BaseFont baseFont = font.BaseFont;
|
||||||
tmp.MoveText(scale.X(X), yScale);
|
tmp.MoveText(scale.X(X), yScale);
|
||||||
//cb.SetFontAndSize(baseFont, Font.SizeInPoints);
|
|
||||||
//BaseFont baseFont = BaseFont.CreateFont("Helvetica", BaseFont.CP1252, BaseFont.NOT_EMBEDDED);
|
|
||||||
tmp.SetFontAndSize(baseFont, scale.M(new SvgMeasurement(Font.SizeInPoints, E_MeasurementUnits.PT)));
|
tmp.SetFontAndSize(baseFont, scale.M(new SvgMeasurement(Font.SizeInPoints, E_MeasurementUnits.PT)));
|
||||||
//Console.WriteLine("\"FontSize\",{0},{1}", Font.SizeInPoints, scale.M(new SvgMeasurement(Font.SizeInPoints, E_MeasurementUnits.PT)));
|
|
||||||
switch ((stroke ? 1 : 0) + (fill ? 2 : 0))
|
switch ((stroke ? 1 : 0) + (fill ? 2 : 0))
|
||||||
{
|
{
|
||||||
case 0: // No Stroke or Fill
|
case 0: // No Stroke or Fill
|
||||||
@ -661,148 +596,6 @@ namespace Volian.Svg.Library
|
|||||||
tmp.RestoreState();
|
tmp.RestoreState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//public class Rtf2iTextSharp : RtfVisualVisitorBase
|
|
||||||
//{
|
|
||||||
// private IRtfDocument _RtfDoc;
|
|
||||||
// private Paragraph _MyParagraph = new Paragraph();
|
|
||||||
// // public Rtf2iTextSharp(IRtfDocument rtfDoc, Document doc, PdfWriter writer)
|
|
||||||
// public Rtf2iTextSharp(IRtfDocument rtfDoc)
|
|
||||||
// {
|
|
||||||
// if (rtfDoc == null)
|
|
||||||
// throw new ArgumentNullException("rtfDoc");
|
|
||||||
// _RtfDoc = rtfDoc;
|
|
||||||
// }
|
|
||||||
// public Paragraph Convert()
|
|
||||||
// {
|
|
||||||
// _MyParagraph.Clear();
|
|
||||||
// foreach (IRtfVisual visual in _RtfDoc.VisualContent)
|
|
||||||
// visual.Visit(this);
|
|
||||||
// //_MyParagraph.SetLeading(0, 1);
|
|
||||||
// return _MyParagraph;
|
|
||||||
// }
|
|
||||||
// // ----------------------------------------------------------------------
|
|
||||||
// protected override void DoVisitBreak(IRtfVisualBreak visualBreak)
|
|
||||||
// {
|
|
||||||
// switch (visualBreak.BreakKind)
|
|
||||||
// {
|
|
||||||
// case RtfVisualBreakKind.Line:
|
|
||||||
// break;
|
|
||||||
// case RtfVisualBreakKind.Page:
|
|
||||||
// break;
|
|
||||||
// case RtfVisualBreakKind.Paragraph:
|
|
||||||
// //_MyParagraph.Add("\r\n");
|
|
||||||
// break;
|
|
||||||
// case RtfVisualBreakKind.Section:
|
|
||||||
// break;
|
|
||||||
// default:
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// //_MyParagraph.Add(string.Format("<{0}>", visualBreak.BreakKind.ToString()));
|
|
||||||
// }
|
|
||||||
// protected override void DoVisitSpecial(IRtfVisualSpecialChar visualSpecialChar)
|
|
||||||
// {
|
|
||||||
// //_MyParagraph.Add(string.Format("<special {0}>", visualSpecialChar.CharKind.ToString()));
|
|
||||||
// switch (visualSpecialChar.CharKind)
|
|
||||||
// {
|
|
||||||
// case RtfVisualSpecialCharKind.Bullet:
|
|
||||||
// break;
|
|
||||||
// case RtfVisualSpecialCharKind.EmDash:
|
|
||||||
// break;
|
|
||||||
// case RtfVisualSpecialCharKind.EmSpace:
|
|
||||||
// break;
|
|
||||||
// case RtfVisualSpecialCharKind.EnDash:
|
|
||||||
// break;
|
|
||||||
// case RtfVisualSpecialCharKind.EnSpace:
|
|
||||||
// break;
|
|
||||||
// case RtfVisualSpecialCharKind.LeftDoubleQuote:
|
|
||||||
// break;
|
|
||||||
// case RtfVisualSpecialCharKind.LeftSingleQuote:
|
|
||||||
// break;
|
|
||||||
// case RtfVisualSpecialCharKind.NonBreakingHyphen:
|
|
||||||
// break;
|
|
||||||
// case RtfVisualSpecialCharKind.NonBreakingSpace:
|
|
||||||
// _MyParagraph.Add(new Chunk("\u00A0"));
|
|
||||||
// break;
|
|
||||||
// case RtfVisualSpecialCharKind.OptionalHyphen:
|
|
||||||
// break;
|
|
||||||
// case RtfVisualSpecialCharKind.ParagraphNumberBegin:
|
|
||||||
// break;
|
|
||||||
// case RtfVisualSpecialCharKind.ParagraphNumberEnd:
|
|
||||||
// break;
|
|
||||||
// case RtfVisualSpecialCharKind.QmSpace:
|
|
||||||
// break;
|
|
||||||
// case RtfVisualSpecialCharKind.RightDoubleQuote:
|
|
||||||
// break;
|
|
||||||
// case RtfVisualSpecialCharKind.RightSingleQuote:
|
|
||||||
// break;
|
|
||||||
// case RtfVisualSpecialCharKind.Tabulator:
|
|
||||||
// break;
|
|
||||||
// default:
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// //private static Dictionary<string, BaseFont> _MyBaseFonts = new Dictionary<string, BaseFont>();
|
|
||||||
// //private static BaseFont GetBaseFont(string fontName)
|
|
||||||
// //{
|
|
||||||
// // if (!_MyBaseFonts.ContainsKey(fontName))
|
|
||||||
// // _MyBaseFonts.Add(fontName, BaseFont.CreateFont(FontFind.FullFileName(fontName), BaseFont.IDENTITY_H, BaseFont.EMBEDDED));
|
|
||||||
// // return _MyBaseFonts[fontName];
|
|
||||||
// //}
|
|
||||||
// //private static Dictionary<string, iTextSharp.text.Font> _MyFonts = new Dictionary<string, iTextSharp.text.Font>();
|
|
||||||
// //private static iTextSharp.text.Font GetFont(string fontName, int size, int style)
|
|
||||||
// //{
|
|
||||||
// // string key = string.Format("{0}.{1}.{2}", fontName, size, style);
|
|
||||||
// // if (!_MyFonts.ContainsKey(key))
|
|
||||||
// // _MyFonts.Add(key, new iTextSharp.text.Font(GetBaseFont(fontName), size / 2, style));
|
|
||||||
// // return _MyFonts[key];
|
|
||||||
// //}
|
|
||||||
// //protected override void DoVisitText(IRtfVisualText visualText)
|
|
||||||
// //{
|
|
||||||
// // if (visualText.Format.IsHidden) return;
|
|
||||||
// // //iTextSharp.text.Font font = GetFont(visualText.Format.Font.Name, visualText.Format.FontSize,
|
|
||||||
// // // (visualText.Format.IsBold ? iTextSharp.text.Font.BOLD : 0) + (visualText.Format.IsItalic ? iTextSharp.text.Font.ITALIC : 0));
|
|
||||||
// // iTextSharp.text.Font font = FontFactory.GetFont(visualText.Format.Font.Name, BaseFont.IDENTITY_H, BaseFont.EMBEDDED,
|
|
||||||
// // visualText.Format.FontSize / 2F);// TODO: Don't know why this is 2.4 rather than 2.
|
|
||||||
|
|
||||||
// // font.SetStyle((visualText.Format.IsBold ? iTextSharp.text.Font.BOLD : 0) + (visualText.Format.IsItalic ? iTextSharp.text.Font.ITALIC : 0));
|
|
||||||
// // font.Color = new iTextSharp.text.Color(visualText.Format.ForegroundColor.AsDrawingColor);
|
|
||||||
// // Chunk chk = new Chunk(visualText.Text, font);
|
|
||||||
// // chk.SetBackground(new iTextSharp.text.Color(visualText.Format.BackgroundColor.AsDrawingColor));
|
|
||||||
// // if (visualText.Format.IsStrikeThrough)
|
|
||||||
// // chk.SetUnderline(iTextSharp.text.Color.BLACK, 0, 0.05F, 0, .3F, PdfContentByte.LINE_CAP_ROUND); // Relative Based upon font size
|
|
||||||
// // if (visualText.Format.IsUnderline)
|
|
||||||
// // chk.SetUnderline(iTextSharp.text.Color.BLACK, 0, 0.05F, 0, -.09F, PdfContentByte.LINE_CAP_ROUND); // Relative Based upon font size
|
|
||||||
// // if (visualText.Format.SuperScript == -1)
|
|
||||||
// // chk.SetTextRise(.45F * chk.Font.Size);
|
|
||||||
// // else if (visualText.Format.SuperScript == 1)
|
|
||||||
// // chk.SetTextRise(-.25F * chk.Font.Size);
|
|
||||||
// // //Console.WriteLine("\"RTF FontSize\",{0},{1}", visualText.Format.FontSize / 2,chk.Font.Size);
|
|
||||||
|
|
||||||
// // _MyParagraph.Add(chk);
|
|
||||||
|
|
||||||
// //}// DoVisitText
|
|
||||||
|
|
||||||
// // ----------------------------------------------------------------------
|
|
||||||
// protected override void DoVisitImage(IRtfVisualImage visualImage)
|
|
||||||
// {
|
|
||||||
// _MyParagraph.Add(new Chunk("<Image>"));
|
|
||||||
// //WriteStartElement("rtfVisualImage");
|
|
||||||
|
|
||||||
// //WriteElementString("format", visualImage.Format.ToString());
|
|
||||||
// //WriteElementString("width", visualImage.Width.ToString());
|
|
||||||
// //WriteElementString("height", visualImage.Height.ToString());
|
|
||||||
// //WriteElementString("desiredWidth", visualImage.DesiredWidth.ToString());
|
|
||||||
// //WriteElementString("desiredHeight", visualImage.DesiredHeight.ToString());
|
|
||||||
// //WriteElementString("scaleWidthPercent", visualImage.ScaleWidthPercent.ToString());
|
|
||||||
// //WriteElementString("scaleHeightPercent", visualImage.ScaleHeightPercent.ToString());
|
|
||||||
// //WriteElementString("alignment", visualImage.Alignment.ToString());
|
|
||||||
|
|
||||||
// //WriteElementString("image", visualImage.ImageDataHex.ToString());
|
|
||||||
|
|
||||||
// //WriteEndElement();
|
|
||||||
// } // DoVisitImage
|
|
||||||
|
|
||||||
//}
|
|
||||||
public class SvgPageTotal
|
public class SvgPageTotal
|
||||||
{
|
{
|
||||||
public SvgPageTotal(System.Drawing.Font myFont, PdfContentByte cb)
|
public SvgPageTotal(System.Drawing.Font myFont, PdfContentByte cb)
|
||||||
@ -812,17 +605,7 @@ namespace Volian.Svg.Library
|
|||||||
_MyTemplate.BoundingBox= new Rectangle(-20, -20, 100, 100);
|
_MyTemplate.BoundingBox= new Rectangle(-20, -20, 100, 100);
|
||||||
}
|
}
|
||||||
private int _PageCount=1;
|
private int _PageCount=1;
|
||||||
//public int PageCount
|
|
||||||
//{
|
|
||||||
// get { return _PageCount; }
|
|
||||||
// set { _PageCount = value; }
|
|
||||||
//}
|
|
||||||
private System.Drawing.Font _MyFont;
|
private System.Drawing.Font _MyFont;
|
||||||
//public System.Drawing.Font MyFont
|
|
||||||
//{
|
|
||||||
// get { return _MyFont; }
|
|
||||||
// set { _MyFont = value; }
|
|
||||||
//}
|
|
||||||
private PdfTemplate _MyTemplate;
|
private PdfTemplate _MyTemplate;
|
||||||
public PdfTemplate MyTemplate
|
public PdfTemplate MyTemplate
|
||||||
{
|
{
|
||||||
@ -843,11 +626,8 @@ namespace Volian.Svg.Library
|
|||||||
public class SvgPageHelper : PdfPageEventHelper
|
public class SvgPageHelper : PdfPageEventHelper
|
||||||
{
|
{
|
||||||
private Svg _MySvg;
|
private Svg _MySvg;
|
||||||
//private Svg _MyNextSvg;
|
|
||||||
public Svg MySvg
|
public Svg MySvg
|
||||||
{
|
{
|
||||||
//get { return _MyNextSvg; }
|
|
||||||
//set { _MyNextSvg = value; }
|
|
||||||
get { return _MySvg; }
|
get { return _MySvg; }
|
||||||
set { _MySvg = value; }
|
set { _MySvg = value; }
|
||||||
}
|
}
|
||||||
@ -877,7 +657,6 @@ namespace Volian.Svg.Library
|
|||||||
}
|
}
|
||||||
public SvgPageHelper(Svg mySvg)
|
public SvgPageHelper(Svg mySvg)
|
||||||
{
|
{
|
||||||
//_MySvg = _MyNextSvg = mySvg;
|
|
||||||
_MySvg = mySvg;
|
_MySvg = mySvg;
|
||||||
}
|
}
|
||||||
public SvgPageHelper()
|
public SvgPageHelper()
|
||||||
@ -889,7 +668,6 @@ namespace Volian.Svg.Library
|
|||||||
get { return _BGPageOffset; }
|
get { return _BGPageOffset; }
|
||||||
set { _BGPageOffset = value; }
|
set { _BGPageOffset = value; }
|
||||||
}
|
}
|
||||||
//private Regex regexReplaceTokens = new Regex(@"{[^{}]}");
|
|
||||||
protected virtual string ReplacePageListToken(Match match)
|
protected virtual string ReplacePageListToken(Match match)
|
||||||
{
|
{
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
@ -946,7 +724,7 @@ namespace Volian.Svg.Library
|
|||||||
private PdfImportedPage GetBackgroundPage(PdfContentByte cb)
|
private PdfImportedPage GetBackgroundPage(PdfContentByte cb)
|
||||||
{
|
{
|
||||||
if (BackgroundReader == null) return null;
|
if (BackgroundReader == null) return null;
|
||||||
int page = CurrentPageNumber + BackgroundPageOffset;
|
int page = cb.PdfWriter.CurrentPageNumber + BackgroundPageOffset;
|
||||||
if (page < 1 || page > BackgroundPageCount) return null;
|
if (page < 1 || page > BackgroundPageCount) return null;
|
||||||
return cb.PdfWriter.GetImportedPage(BackgroundReader, page);
|
return cb.PdfWriter.GetImportedPage(BackgroundReader, page);
|
||||||
}
|
}
|
||||||
@ -978,15 +756,17 @@ namespace Volian.Svg.Library
|
|||||||
cb.RestoreState();
|
cb.RestoreState();
|
||||||
}
|
}
|
||||||
private void DrawPageList(PdfContentByte cb)
|
private void DrawPageList(PdfContentByte cb)
|
||||||
|
{
|
||||||
|
if (_MySvg != null)
|
||||||
{
|
{
|
||||||
cb.SaveState();
|
cb.SaveState();
|
||||||
if (_PageListLayer != null) cb.BeginLayer(_PageListLayer);
|
if (_PageListLayer != null) cb.BeginLayer(_PageListLayer);
|
||||||
// Do anything needed to finish off the page
|
// Do anything needed to finish off the page
|
||||||
_MySvg.Draw(cb);
|
_MySvg.Draw(cb);
|
||||||
//_MySvg = _MyNextSvg; // After doing to current page update the Svg for the next page.
|
|
||||||
if (_PageListLayer != null) cb.EndLayer();
|
if (_PageListLayer != null) cb.EndLayer();
|
||||||
cb.RestoreState();
|
cb.RestoreState();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
private void ZoomOMatic(PdfContentByte cb, float size)
|
private void ZoomOMatic(PdfContentByte cb, float size)
|
||||||
{
|
{
|
||||||
for (float xx = 0; xx < cb.PdfDocument.PageSize.Width; xx += size)
|
for (float xx = 0; xx < cb.PdfDocument.PageSize.Width; xx += size)
|
||||||
@ -998,21 +778,6 @@ namespace Volian.Svg.Library
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//private void DrawRectangle(PdfContentByte cb, float x, float y, float w, float h, Color fill, Color stroke)
|
|
||||||
//{
|
|
||||||
// cb.SaveState();
|
|
||||||
// PdfGState gState = new PdfGState();
|
|
||||||
// gState.StrokeOpacity = .95F;
|
|
||||||
// gState.FillOpacity = .75F;
|
|
||||||
// cb.SetGState(gState);
|
|
||||||
// cb.SetColorFill(fill);
|
|
||||||
// cb.SetLineWidth(1F);
|
|
||||||
// cb.SetColorStroke(stroke);
|
|
||||||
// cb.Rectangle(x, cb.PdfWriter.PageSize.Height - y, w, -h);
|
|
||||||
// cb.FillStroke();
|
|
||||||
// cb.RestoreState();
|
|
||||||
//}
|
|
||||||
public override void OnStartPage(PdfWriter writer, Document document)
|
public override void OnStartPage(PdfWriter writer, Document document)
|
||||||
{
|
{
|
||||||
//base.OnStartPage(writer, document);
|
//base.OnStartPage(writer, document);
|
||||||
@ -1136,8 +901,6 @@ namespace Volian.Svg.Library
|
|||||||
_ContentByte.SaveState();
|
_ContentByte.SaveState();
|
||||||
_ContentByte.BeginText();
|
_ContentByte.BeginText();
|
||||||
_ContentByte.SetPatternFill(_PatternPainter);
|
_ContentByte.SetPatternFill(_PatternPainter);
|
||||||
//_ContentByte.SetTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_FILL);
|
|
||||||
//_ContentByte.SetTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_STROKE);
|
|
||||||
_ContentByte.SetTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE);
|
_ContentByte.SetTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE);
|
||||||
_ContentByte.SetLineWidth(.5F);
|
_ContentByte.SetLineWidth(.5F);
|
||||||
_ContentByte.SetFontAndSize(_Basefont, _Fontsize);// Set font and size
|
_ContentByte.SetFontAndSize(_Basefont, _Fontsize);// Set font and size
|
||||||
|
Loading…
x
Reference in New Issue
Block a user