當前位置: 首頁>>代碼示例>>C#>>正文


C# Document.AddProducer方法代碼示例

本文整理匯總了C#中iTextSharp.text.Document.AddProducer方法的典型用法代碼示例。如果您正苦於以下問題:C# Document.AddProducer方法的具體用法?C# Document.AddProducer怎麽用?C# Document.AddProducer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在iTextSharp.text.Document的用法示例。


在下文中一共展示了Document.AddProducer方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: button1_Click

        private void button1_Click(object sender, EventArgs e)
        {
            if (openFile1.SafeFileName == "" || openFile2.SafeFileName == "")
            {
                MessageBox.Show("No haz seleccionado ningún PDF", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            MessageBox.Show("Se unira \"" + openFile1.SafeFileName + "\" con \"" + openFile2.SafeFileName + "\"");
            saveFile.Filter = "Adobe Acrobat Document PDF (*.pdf)|*.pdf";
            saveFile.FilterIndex = 1;
            if (saveFile.ShowDialog() == DialogResult.OK)
            {
                MessageBox.Show("Se guardara en la siguiente ruta:\n" + saveFile.FileName);

                FileStream myStream = new FileStream(saveFile.FileName,FileMode.OpenOrCreate);

                PdfReader reader  = new PdfReader(openFile1.FileName);
                PdfReader reader2 = new PdfReader(openFile2.FileName);
                Document document = new Document(reader.GetPageSizeWithRotation(1));
                PdfCopy writer = new PdfCopy(document, myStream);
                document.Open();
                document.AddCreationDate();
                if (txtAutor.Text != null)
                {
                    document.AddAuthor(txtAutor.Text);
                }
                if (txtHeader.Text != null)
                {
                    document.AddHeader(txtHeader.Text, "Document");
                }
                if (txtKeywords.Text != null)
                {
                    document.AddKeywords(txtKeywords.Text);
                }

                document.AddProducer();

                if (txtTitulo.Text != null)
                {
                    document.AddTitle(txtTitulo.Text);
                }
                // Calculando incremento
                progressBar.Refresh();
                int incremento = (int)(100 / (reader.NumberOfPages + reader2.NumberOfPages));
                MessageBox.Show("Incremento es: " + incremento);
                for (int i = 1; i <= reader.NumberOfPages; i++)
                {
                    writer.AddPage(writer.GetImportedPage(reader, i));
                    progressBar.PerformStep();
                    progressBar.Increment(++incremento);
                }
                progressBar.Increment(50);
                for (int i = 1; i <= reader2.NumberOfPages; i++)
                {
                    writer.AddPage(writer.GetImportedPage(reader2, i));
                    progressBar.PerformStep();
                }
                progressBar.Increment(100);
                document.Close();
            }
        }
開發者ID:elialejandro,項目名稱:unirpdf,代碼行數:61,代碼來源:Form1.cs

示例2: MakePDF

        /// <summary>
        /// PDF生成
        /// </summary>
        public void MakePDF(List<System.Drawing.Image> list)
        {
            Document document = new Document(PageSize.A3);//創建一個Document實例
            PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(PDFSavePath, FileMode.Create));//創建Writer實例

            document.Open();

            #region 寫入一些數據,包括:作者、標題、摘要、關鍵詞、創建者、生產者、創建時間、頭信息

            document.AddAuthor("重齒風電");
            document.AddCreationDate();
            document.AddCreator("重齒風電");
            //document.AddHeader("QQ", "346163801");
            //document.AddHeader("Email", "[email protected]");
            document.AddKeywords("重齒風電");
            document.AddProducer();
            document.AddSubject("重齒風電");
            document.AddTitle("重齒風電");

            #endregion

            BaseFont baseFont = CreateChineseFont();

            iTextSharp.text.Font titleFont = new iTextSharp.text.Font(baseFont, 22, iTextSharp.text.Font.BOLD);
            iTextSharp.text.Font fontUnderLine = new iTextSharp.text.Font(baseFont, 12, iTextSharp.text.Font.UNDERLINE);
            iTextSharp.text.Font normalFont = new iTextSharp.text.Font(baseFont, 12);
            iTextSharp.text.Font normalRedFont = new iTextSharp.text.Font(baseFont, 12, iTextSharp.text.Font.NORMAL | iTextSharp.text.Font.BOLD, BaseColor.RED);
            //float titleLineHeight = 45f;
            float normalLineHeight = 25f;
            Paragraph pBlank = new Paragraph(" ", normalFont);
            pBlank.Leading = normalLineHeight;
            foreach (var im in list)
            {
                iTextSharp.text.Image jpeg = iTextSharp.text.Image.GetInstance(DoConvert(im,827,1169,80), BaseColor.WHITE);
                jpeg.Alignment = Element.ALIGN_CENTER;
                document.Add(jpeg);
            }

            document.Close();
        }
開發者ID:youthjoy,項目名稱:cshelper,代碼行數:43,代碼來源:PDFHelper.cs


注:本文中的iTextSharp.text.Document.AddProducer方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。