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


C# PdfReader.GetCropBox方法代碼示例

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


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

示例1: GetPdfSignatureAppearance

        private static PdfSignatureAppearance GetPdfSignatureAppearance(SigningCertificates signingCertificates, PdfStamper stamper, PdfReader reader, PdfSignatureParameters parameters)
        {
            PdfSignatureAppearance appearance = stamper.SignatureAppearance;

            appearance.Reason = "";
            appearance.LocationCaption = "";
            appearance.Location = "";
            appearance.Layer4Text = "";
            appearance.Layer2Text = GetSignatureText(signingCertificates.X509Certificate, parameters);
            appearance.Acro6Layers = true;

            Rectangle cropBox = reader.GetCropBox(parameters.SignaturePageNumber);

            Rectangle rectangle = GetSignatureLocation(cropBox, parameters);
            appearance.SetVisibleSignature(rectangle, parameters.SignaturePageNumber, parameters.SignatureName);

            return appearance;
        }
開發者ID:affecto,項目名稱:dotnet-Pdf.Toolkit,代碼行數:18,代碼來源:PdfSigner.cs

示例2: ConcatenateEvaluations

        // This class uses an open-source PDF engine to concatenate multiple PDFs into one organized by bookmarks
        public static bool ConcatenateEvaluations(string destination, String[] args)
        {
            try
            {
                int f = 0;  // index of current document
                int i = 0;  // current page of the current document
                int n = 0; // total pages for current document
                int j = 0; // counter used to display two portrait pages on one landscape page
                float width = PageSize.LETTER.Width; //PageSize.LETTER.Height;
                float height = PageSize.LETTER.Height; //PageSize.LETTER.Width;

                // we create a reader for a certain document
                PdfReader reader;

                // step 1: creation of a document-object with portrait orientation
                Document document = new Document(PageSize.LETTER, 0, 0, 0, 0);

                // step 2: we create a writer that listens to the document
                PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(destination, FileMode.Create));
                writer.ViewerPreferences = PdfWriter.PageModeUseOutlines;

                // step 3: we open the document
                document.Open();
                PdfContentByte cb = writer.DirectContent;
                PdfImportedPage page;
                int rotation;

                // step 4: we add the content
                while (f < args.Length)
                {
                    i = 0;
                    if (args[f] != "")
                    {
                        reader = new PdfReader(args[f]);
                        // we retrieve the total number of pages
                        n = reader.NumberOfPages;

                        while (i < n)
                        {
                            i++;
                            page = writer.GetImportedPage(reader, i);
                            rotation = reader.GetPageRotation(i);

                            //portrait - default
                            document.SetPageSize(PageSize.LETTER);
                            float pageHeight = reader.GetCropBox(i).Height;
                            float bottom = reader.GetCropBox(i).Bottom;

                            document.NewPage();
                            cb.AddTemplate(page, 0, 0);
                        }
                        // free up memory
                        writer.FreeReader(reader);
                    }
                    f++;

                }
                // step 5: we close the document
                document.Close();

            }
            catch (Exception e)
            {
                return false;
            }
            return true;
        }
開發者ID:tkim001,項目名稱:SystemOperationsEvaluations,代碼行數:68,代碼來源:PdfGenerator.cs


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