Exemplo n.º 1
0
        public void RotatedText()
        {
            using (var document = PdfDocument.Open(DlaHelper.GetDocumentPath("complex rotated")))
            {
                var page = document.GetPage(1);

                foreach (var letter in page.Letters)
                {
                    Assert.Equal(12, letter.PointSize);
                }
            }
        }
Exemplo n.º 2
0
 public void GetCorrectBBoxLinux(string name, object[][] expected)
 {
     // success on Windows but LinuxSystemFontLister cannot find the 'TimesNewRomanPSMT' font
     using (var document = PdfDocument.Open(DlaHelper.GetDocumentPath(name)))
     {
         var page = document.GetPage(1);
         for (int i = 0; i < expected.Length; i++)
         {
             string bbox     = (string)expected[i][0];
             var    rotation = (double)expected[i][1];
             var    current  = page.Letters[i];
             Assert.Equal(bbox, current.GlyphRectangle.ToString());
             Assert.Equal(rotation, current.GlyphRectangle.Rotation, 3);
         }
     }
 }
Exemplo n.º 3
0
        public void GetCorrectBBoxLinux(string name, object[][] expected)
        {
            // success on Windows but LinuxSystemFontLister cannot find the 'TimesNewRomanPSMT' font
            var font = SystemFontFinder.Instance.GetTrueTypeFont("TimesNewRomanPSMT");

            Skip.If(font == null, "Skipped because the font TimesNewRomanPSMT could not be found in the execution environment.");

            using (var document = PdfDocument.Open(DlaHelper.GetDocumentPath(name)))
            {
                var page = document.GetPage(1);
                for (int i = 0; i < expected.Length; i++)
                {
                    string bbox     = (string)expected[i][0];
                    var    rotation = (double)expected[i][1];
                    var    current  = page.Letters[i];
                    Assert.Equal(bbox, current.GlyphRectangle.ToString());
                    Assert.Equal(rotation, current.GlyphRectangle.Rotation, 3);
                }
            }
        }
Exemplo n.º 4
0
        public void GetCorrectBBoxLinux(string name, ExpectedLetterData[] expected)
        {
            // success on Windows but LinuxSystemFontLister cannot find the 'TimesNewRomanPSMT' font
            var font = SystemFontFinder.Instance.GetTrueTypeFont("TimesNewRomanPSMT");

            Skip.If(font == null, "Skipped because the font TimesNewRomanPSMT could not be found in the execution environment.");

            using (var document = PdfDocument.Open(DlaHelper.GetDocumentPath(name)))
            {
                var page = document.GetPage(1);
                for (int i = 0; i < expected.Length; i++)
                {
                    var expectedData = expected[i];

                    var current = page.Letters[i];

                    Assert.Equal(expectedData.TopLeft.X, current.GlyphRectangle.TopLeft.X, 7);
                    Assert.Equal(expectedData.TopLeft.Y, current.GlyphRectangle.TopLeft.Y, 7);
                    Assert.Equal(expectedData.Width, current.GlyphRectangle.Width, 7);
                    Assert.Equal(expectedData.Height, current.GlyphRectangle.Height, 7);
                    Assert.Equal(expectedData.Rotation, current.GlyphRectangle.Rotation, 3);
                }
            }
        }