iTextSharp.text.pdf.PdfReader.GetPageSizeWithRotation C# (CSharp) Метод

GetPageSizeWithRotation() публичный Метод

public GetPageSizeWithRotation ( PdfDictionary page ) : Rectangle
page PdfDictionary
Результат iTextSharp.text.Rectangle
        public Rectangle GetPageSizeWithRotation(PdfDictionary page) {
            Rectangle rect = GetPageSize(page);
            int rotation = GetPageRotation(page);
            while (rotation > 0) {
                rect = rect.Rotate();
                rotation -= 90;
            }
            return rect;
        }
        

Same methods

PdfReader::GetPageSizeWithRotation ( int index ) : Rectangle

Usage Example

Пример #1
1
        public static byte[] MergePdfs(IEnumerable<byte[]> inputFiles)
        {
            MemoryStream outputStream = new MemoryStream();
            Document document = new Document();
            PdfWriter writer = PdfWriter.GetInstance(document, outputStream);
            document.Open();
            PdfContentByte content = writer.DirectContent;

            foreach (byte[] input in inputFiles)
            {
                PdfReader reader = new PdfReader(input);
                for (int i = 1; i <= reader.NumberOfPages; i++)
                {
                    document.SetPageSize(reader.GetPageSizeWithRotation(i));
                    document.NewPage();
                    PdfImportedPage page = writer.GetImportedPage(reader, i);
                    int rotation = reader.GetPageRotation(i);
                    if (rotation == 90 || rotation == 270)
                    {
                        content.AddTemplate(page, 0, -1f, 1f, 0, 0,
                            reader.GetPageSizeWithRotation(i).Height);
                    }
                    else
                    {
                        content.AddTemplate(page, 1f, 0, 0, 1f, 0, 0);
                    }
                }
            }

            document.Close();

            return outputStream.ToArray();
        }
All Usage Examples Of iTextSharp.text.pdf.PdfReader::GetPageSizeWithRotation