Ancora test printing pdf
This commit is contained in:
@@ -82,6 +82,9 @@
|
||||
<Reference Include="Pipelines.Sockets.Unofficial, Version=1.0.0.0, Culture=neutral, PublicKeyToken=42ea0a778e13fbe2, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Pipelines.Sockets.Unofficial.2.1.1\lib\net461\Pipelines.Sockets.Unofficial.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="RawPrint, Version=0.5.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\RawPrint.0.5.0\lib\net40\RawPrint.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SharpCompress, Version=0.24.0.0, Culture=neutral, PublicKeyToken=afb0a02973931d96, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SharpCompress.0.24.0\lib\net45\SharpCompress.dll</HintPath>
|
||||
</Reference>
|
||||
|
||||
Generated
+90
-16
@@ -28,34 +28,103 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.lbPrinters = new System.Windows.Forms.ListBox();
|
||||
this.btnReloadPrinters = new System.Windows.Forms.Button();
|
||||
this.webBrowserCtrl = new System.Windows.Forms.WebBrowser();
|
||||
this.btnOpenFile = new System.Windows.Forms.Button();
|
||||
this.txtFileSel = new System.Windows.Forms.TextBox();
|
||||
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
|
||||
this.btnPrint = new System.Windows.Forms.Button();
|
||||
this.btnRawPrint = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(13, 13);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(54, 13);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "Stampanti";
|
||||
//
|
||||
// lbPrinters
|
||||
//
|
||||
this.lbPrinters.FormattingEnabled = true;
|
||||
this.lbPrinters.Location = new System.Drawing.Point(103, 13);
|
||||
this.lbPrinters.Location = new System.Drawing.Point(100, 55);
|
||||
this.lbPrinters.Name = "lbPrinters";
|
||||
this.lbPrinters.Size = new System.Drawing.Size(219, 95);
|
||||
this.lbPrinters.Size = new System.Drawing.Size(219, 160);
|
||||
this.lbPrinters.TabIndex = 1;
|
||||
//
|
||||
// btnReloadPrinters
|
||||
//
|
||||
this.btnReloadPrinters.Location = new System.Drawing.Point(9, 55);
|
||||
this.btnReloadPrinters.Name = "btnReloadPrinters";
|
||||
this.btnReloadPrinters.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnReloadPrinters.TabIndex = 2;
|
||||
this.btnReloadPrinters.Text = "Printer List";
|
||||
this.btnReloadPrinters.UseVisualStyleBackColor = true;
|
||||
this.btnReloadPrinters.Click += new System.EventHandler(this.btnReloadPrinters_Click);
|
||||
//
|
||||
// webBrowserCtrl
|
||||
//
|
||||
this.webBrowserCtrl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.webBrowserCtrl.Location = new System.Drawing.Point(328, 13);
|
||||
this.webBrowserCtrl.MinimumSize = new System.Drawing.Size(20, 20);
|
||||
this.webBrowserCtrl.Name = "webBrowserCtrl";
|
||||
this.webBrowserCtrl.Size = new System.Drawing.Size(457, 471);
|
||||
this.webBrowserCtrl.TabIndex = 3;
|
||||
//
|
||||
// btnOpenFile
|
||||
//
|
||||
this.btnOpenFile.Location = new System.Drawing.Point(10, 11);
|
||||
this.btnOpenFile.Name = "btnOpenFile";
|
||||
this.btnOpenFile.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnOpenFile.TabIndex = 4;
|
||||
this.btnOpenFile.Text = "Open PDF";
|
||||
this.btnOpenFile.UseVisualStyleBackColor = true;
|
||||
this.btnOpenFile.Click += new System.EventHandler(this.btnOpenFile_Click);
|
||||
//
|
||||
// txtFileSel
|
||||
//
|
||||
this.txtFileSel.Location = new System.Drawing.Point(100, 13);
|
||||
this.txtFileSel.Name = "txtFileSel";
|
||||
this.txtFileSel.Size = new System.Drawing.Size(219, 20);
|
||||
this.txtFileSel.TabIndex = 5;
|
||||
//
|
||||
// statusStrip1
|
||||
//
|
||||
this.statusStrip1.Location = new System.Drawing.Point(0, 487);
|
||||
this.statusStrip1.Name = "statusStrip1";
|
||||
this.statusStrip1.Size = new System.Drawing.Size(785, 22);
|
||||
this.statusStrip1.TabIndex = 6;
|
||||
this.statusStrip1.Text = "statusStrip1";
|
||||
//
|
||||
// btnPrint
|
||||
//
|
||||
this.btnPrint.Location = new System.Drawing.Point(9, 131);
|
||||
this.btnPrint.Name = "btnPrint";
|
||||
this.btnPrint.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnPrint.TabIndex = 7;
|
||||
this.btnPrint.Text = "Print menu";
|
||||
this.btnPrint.UseVisualStyleBackColor = true;
|
||||
this.btnPrint.Click += new System.EventHandler(this.btnPrint_Click);
|
||||
//
|
||||
// btnRawPrint
|
||||
//
|
||||
this.btnRawPrint.Location = new System.Drawing.Point(9, 192);
|
||||
this.btnRawPrint.Name = "btnRawPrint";
|
||||
this.btnRawPrint.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnRawPrint.TabIndex = 8;
|
||||
this.btnRawPrint.Text = "Raw Print";
|
||||
this.btnRawPrint.UseVisualStyleBackColor = true;
|
||||
this.btnRawPrint.Click += new System.EventHandler(this.btnRawPrint_Click);
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.ClientSize = new System.Drawing.Size(785, 509);
|
||||
this.Controls.Add(this.btnRawPrint);
|
||||
this.Controls.Add(this.btnPrint);
|
||||
this.Controls.Add(this.statusStrip1);
|
||||
this.Controls.Add(this.txtFileSel);
|
||||
this.Controls.Add(this.btnOpenFile);
|
||||
this.Controls.Add(this.webBrowserCtrl);
|
||||
this.Controls.Add(this.btnReloadPrinters);
|
||||
this.Controls.Add(this.lbPrinters);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Name = "MainForm";
|
||||
this.Text = "LPA";
|
||||
this.ResumeLayout(false);
|
||||
@@ -64,9 +133,14 @@
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.ListBox lbPrinters;
|
||||
private System.Windows.Forms.Button btnReloadPrinters;
|
||||
private System.Windows.Forms.WebBrowser webBrowserCtrl;
|
||||
private System.Windows.Forms.Button btnOpenFile;
|
||||
private System.Windows.Forms.TextBox txtFileSel;
|
||||
private System.Windows.Forms.StatusStrip statusStrip1;
|
||||
private System.Windows.Forms.Button btnPrint;
|
||||
private System.Windows.Forms.Button btnRawPrint;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+57
-1
@@ -3,10 +3,12 @@ using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using RawPrint;
|
||||
|
||||
namespace LPA
|
||||
{
|
||||
@@ -25,11 +27,65 @@ namespace LPA
|
||||
|
||||
private void setupPrintersList()
|
||||
{
|
||||
lbPrinters.Items.Clear();
|
||||
foreach (string printer in System.Drawing.Printing.PrinterSettings.InstalledPrinters)
|
||||
{
|
||||
lbPrinters.Items.Add(printer);
|
||||
//MessageBox.Show(printer);
|
||||
}
|
||||
}
|
||||
|
||||
private void btnReloadPrinters_Click(object sender, EventArgs e)
|
||||
{
|
||||
setupPrintersList();
|
||||
}
|
||||
|
||||
private void btnOpenFile_Click(object sender, EventArgs e)
|
||||
{
|
||||
OpenFileDialog openFileDialog1 = new OpenFileDialog
|
||||
{
|
||||
//InitialDirectory = @"D:\",
|
||||
Title = "Selezione file",
|
||||
|
||||
CheckFileExists = true,
|
||||
CheckPathExists = true,
|
||||
|
||||
DefaultExt = "pdf",
|
||||
Filter = "pdf files (*.pdf)|*.pdf",
|
||||
FilterIndex = 2,
|
||||
RestoreDirectory = true,
|
||||
|
||||
ReadOnlyChecked = true,
|
||||
ShowReadOnly = true
|
||||
};
|
||||
|
||||
if (openFileDialog1.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
showFile(openFileDialog1.FileName);
|
||||
}
|
||||
openFileDialog1.Dispose();
|
||||
}
|
||||
|
||||
private void showFile(string fileName)
|
||||
{
|
||||
txtFileSel.Text = fileName;
|
||||
webBrowserCtrl.Navigate(fileName);
|
||||
}
|
||||
|
||||
private void btnPrint_Click(object sender, EventArgs e)
|
||||
{
|
||||
webBrowserCtrl.ShowPrintDialog();
|
||||
//webBrowserCtrl.Print();
|
||||
|
||||
}
|
||||
|
||||
private void btnRawPrint_Click(object sender, EventArgs e)
|
||||
{
|
||||
string printName = lbPrinters.SelectedItem.ToString();
|
||||
string filePath = txtFileSel.Text;
|
||||
|
||||
IPrinter printer = new Printer();
|
||||
|
||||
printer.PrintRawFile(printName, filePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,4 +117,7 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -19,6 +19,7 @@
|
||||
<package id="NLog" version="4.6.8" targetFramework="net462" />
|
||||
<package id="PDFsharp" version="1.50.5147" targetFramework="net462" />
|
||||
<package id="Pipelines.Sockets.Unofficial" version="2.1.1" targetFramework="net462" />
|
||||
<package id="RawPrint" version="0.5.0" targetFramework="net462" />
|
||||
<package id="SharpCompress" version="0.24.0" targetFramework="net462" />
|
||||
<package id="SharpZipLib" version="1.2.0" targetFramework="net462" />
|
||||
<package id="Snappy.NET" version="1.1.1.8" targetFramework="net462" />
|
||||
|
||||
Reference in New Issue
Block a user