Я использую простую программу, которая возьмет TallPDF XML и преобразует его в PDF-представление, чтобы вы знали, на что вы смотрите.Проблема в том, что я ограничен тем, сколько персонажей я могу ввести.Это проблема, которую я могу исправить в представлении дизайна формы, или это примитив в коде, потому что кода очень мало?
Снова ЭТО НЕ МОЙ КОД.Я НЕ ПРИНИМАЮ КРЕДИТ ДЛЯ ЭТОГО!
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
try
{
// load the XML document template
System.Xml.XmlDocument documentTemplate = new System.Xml.XmlDocument();
documentTemplate.LoadXml(txtPDFXML.Text);
// Setup the document
TallComponents.PDF.Layout.Document pdf = new TallComponents.PDF.Layout.Document();
pdf.Read(documentTemplate.DocumentElement);
// Finally write the PDF document
webBrowser1.Navigate("about:blank");
System.IO.FileStream fs = null;
try
{
fs = new System.IO.FileStream(@"Out.pdf", System.IO.FileMode.Create);
}
catch
{
fs = new System.IO.FileStream(@"Out2.pdf", System.IO.FileMode.Create);
}
pdf.Write(fs, false);
fs.Close();
fs.Dispose();
webBrowser1.Navigate(fs.Name);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
}
Это форма designer.cs
'частичный класс Form1 {/// /// Обязательная переменная конструктора./// private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.txtPDFXML = new System.Windows.Forms.TextBox();
this.webBrowser1 = new System.Windows.Forms.WebBrowser();
this.button1 = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.splitContainer1.Name = "splitContainer1";
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.txtPDFXML);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.webBrowser1);
this.splitContainer1.Size = new System.Drawing.Size(1347, 824);
this.splitContainer1.SplitterDistance = 693;
this.splitContainer1.SplitterWidth = 5;
this.splitContainer1.TabIndex = 0;
//
// txtPDFXML
//
this.txtPDFXML.AcceptsReturn = true;
this.txtPDFXML.AcceptsTab = true;
this.txtPDFXML.Dock = System.Windows.Forms.DockStyle.Fill;
this.txtPDFXML.Location = new System.Drawing.Point(0, 0);
this.txtPDFXML.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.txtPDFXML.Multiline = true;
this.txtPDFXML.Name = "txtPDFXML";
this.txtPDFXML.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.txtPDFXML.Size = new System.Drawing.Size(693, 824);
this.txtPDFXML.TabIndex = 0;
this.txtPDFXML.WordWrap = false;
//
// webBrowser1
//
this.webBrowser1.Dock = System.Windows.Forms.DockStyle.Fill;
this.webBrowser1.Location = new System.Drawing.Point(0, 0);
this.webBrowser1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.webBrowser1.MinimumSize = new System.Drawing.Size(27, 25);
this.webBrowser1.Name = "webBrowser1";
this.webBrowser1.Size = new System.Drawing.Size(649, 824);
this.webBrowser1.TabIndex = 0;
//
// button1
//
this.button1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.button1.Location = new System.Drawing.Point(0, 824);
this.button1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(1347, 28);
this.button1.TabIndex = 1;
this.button1.Text = "&View";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1347, 852);
this.Controls.Add(this.splitContainer1);
this.Controls.Add(this.button1);
this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.Name = "Form1";
this.Text = "Form1";
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel1.PerformLayout();
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.TextBox txtPDFXML;
private System.Windows.Forms.WebBrowser webBrowser1;
private System.Windows.Forms.Button button1;
}
}
,