????2.?????????e???
???????????????????????????????????????????????????
????2.1 ?????????????
private PdfFont            ArialNormal;
private PdfFont            ArialBold;
private PdfFont            ArialItalic;
private PdfFont            ArialBoldItalic;
private PdfFont            TimesNormal;
private PdfFont            Comic;
private PdfTilingPattern WaterMark;
private PdfDocument        Document;
private PdfPage            Page;
private PdfContents        Contents;
???????????????
// Step 1:??????????????????????????????????????????????????????
Document = new PdfDocument(PaperType.Letter?? false?? UnitOfMeasure.Inch?? FileName);
//???????????
//Document.SetEncryption(null?? null?? Permission.All & ~Permission.Print?? EncryptionType.Aes128);
//????PDF????????
PdfInfo Info = PdfInfo.CreatePdfInfo(Document);
Info.Title("Article Example");
Info.Author("Uzi Granot Granotech Limited");
Info.Keywords("PDF?? .NET?? C#?? Library?? Document Creator");
Info.Subject("PDF File Writer C# Class Library (Version 1.14.1)");
????2.2 ????????????
????//???岻???????????????????
????String FontName1 = "Arial";
????String FontName2 = "Times New Roman";
????ArialNormal = PdfFont.CreatePdfFont(Document?? FontName1?? FontStyle.Regular?? true);
????ArialBold = PdfFont.CreatePdfFont(Document?? FontName1?? FontStyle.Bold?? true);
????ArialItalic = PdfFont.CreatePdfFont(Document?? FontName1?? FontStyle.Italic?? true);
????ArialBoldItalic = PdfFont.CreatePdfFont(Document?? FontName1?? FontStyle.Bold | FontStyle.Italic?? true);
????TimesNormal = PdfFont.CreatePdfFont(Document?? FontName2?? FontStyle.Regular?? true);
????Comic = PdfFont.CreatePdfFont(Document?? "Comic Sans MS"?? FontStyle.Bold?? true);
????2.3 ???????????
Contents.DrawText(Comic?? 40.0?? 4.25?? 9.25?? TextJustify.Center?? 0.02?? Color.FromArgb(128?? 0?? 255)?? Color.FromArgb(255?? 0?? 128)?? "PDF FILE WRITER");
Contents.SaveGraphicsState();
Contents.SetColorNonStroking(Color.Purple);
Contents.DrawText(Comic?? 30.0?? 4.25?? 8.75?? TextJustify.Center?? "Example");
Contents.RestoreGraphicsState();
//Step 3:????????
Page = new PdfPage(Document);
//Step 4:???????????
Contents = new PdfContents(Page);
????2.4 ??????????
Contents.SaveGraphicsState();
BarcodeEAN13 Barcode1 = new BarcodeEAN13("1234567890128");
Contents.DrawBarcode(1.3?? 7.05?? 0.012?? 0.75?? Barcode1?? ArialNormal?? 8.0);
PdfQRCode QRCode = new PdfQRCode(Document?? "http://www.codeproject.com/Articles/570682/PDF-File-Writer-Csharp-Class-Library-Version"?? ErrorCorrection.M);
Contents.DrawQRCode(QRCode?? 6.0?? 6.8?? 1.2);
// ???????
Page.AddWebLink(6.0?? 6.8?? 7.2?? 8.0?? "http://www.codeproject.com/Articles/570682/PDF-File-Writer-Csharp-Class-Library-Version");
//????
Contents.RestoreGraphicsState();
????2.5 ???????
Contents.SaveGraphicsState();
//????MS Chart???
Chart PieChart = PdfChart.CreateChart(Document?? 1.8?? 1.5?? 300.0);
PdfImageControl ImageControl = new PdfImageControl();
ImageControl.SaveAs = SaveImageAs.IndexedImage;
PdfChart PiePdfChart = new PdfChart(Document?? PieChart?? ImageControl);
PieChart.AntiAliasing = AntiAliasingStyles.None;
//???????
PieChart.BackColor = Color.FromArgb(220?? 220?? 255);
PieChart.Palette = ChartColorPalette.BrightPastel;
//???????
Font DefaultFont = PiePdfChart.CreateFont("Verdana"?? FontStyle.Regular?? 0.05?? FontSizeUnit.UserUnit);
Font TitleFont = PiePdfChart.CreateFont("Verdana"?? FontStyle.Bold?? 0.07?? FontSizeUnit.UserUnit);
// ???????
Title Title1 = new Title("Pie Chart Example"?? Docking.Top?? TitleFont?? Color.Purple);
PieChart.Titles.Add(Title1);
//???
Legend Legend1 = new Legend();
PieChart.Legends.Add(Legend1);
Legend1.BackColor = Color.FromArgb(230?? 230?? 255);
Legend1.Docking = Docking.Bottom;
Legend1.Font = DefaultFont;
// ???????
ChartArea ChartArea1 = new ChartArea();
PieChart.ChartAreas.Add(ChartArea1);
ChartArea1.BackColor = Color.FromArgb(255?? 200?? 255);
Series Series1 = new Series();
PieChart.Series.Add(Series1);
Series1.ChartType = SeriesChartType.Pie;
Series1.Font = DefaultFont;
Series1.IsValueShownAsLabel = true;
Series1.LabelFormat = "{0} %";
Series1.Points.Add(22.0);
Series1.Points[0].LegendText = "Apple";
Series1.Points.Add(27.0);
Series1.Points[1].LegendText = "Banana";
Series1.Points.Add(33.0);
Series1.Points[2].LegendText = "Orange";
Series1.Points.Add(18.0);
Series1.Points[3].LegendText = "Grape";
Contents.DrawChart(PiePdfChart?? 5.6?? 5.0);
// ????
Contents.RestoreGraphicsState();
????2.6 ????PDF
????// Step 6:????PDF
????Document.CreateFile();
????//??PDF???
????Process Proc = new Process();
????Proc.StartInfo = new ProcessStartInfo(FileName);
????Proc.Start();
????3.???
????1.Codeproject?????????http://www.codeproject.com/Articles/570682/PDF-File-Writer-Csharp-Class-Library-Version
????2.PDF File Writer DLL?????PdfFileWriter_dll.zip
????3.PDF File Writer ?????????PdfFileWriterCHM.rar
????4.PDF File Writer???????Demo:PdfFileWriter-Code.rar
?????????????е?????????????????????????????????????????????????????????????????????????????????п????????