Esempio n. 1
0
        protected internal static ImageRenderer CreateLayoutedImageRenderer(float width, float height, Document document
                                                                            )
        {
            PdfFormXObject xObject  = new PdfFormXObject(new Rectangle(width, height));
            Image          img      = new Image(xObject);
            ImageRenderer  renderer = (ImageRenderer) new ImageRenderer(img).SetParent(document.GetRenderer());

            renderer.Layout(new LayoutContext(new LayoutArea(1, new Rectangle(1000, 1000))));
            return(renderer);
        }
Esempio n. 2
0
        public virtual void ImageRendererAddByIDTest()
        {
            DocumentRenderer documentRenderer = new DocumentRenderer(null);
            ImageRenderer    imageRenderer    = new ImageRenderer(new Image(ImageDataFactory.CreateRawImage(new byte[] { 50,
                                                                                                                         21 })));

            imageRenderer.SetParent(documentRenderer);
            String id = "id6";

            imageRenderer.SetProperty(Property.ID, id);
            LayoutContext layoutContext = new LayoutContext(new LayoutArea(4, new Rectangle(50, 50)));

            imageRenderer.Layout(layoutContext);
            documentRenderer.GetTargetCounterHandler().PrepareHandlerToRelayout();
            NUnit.Framework.Assert.AreEqual((int?)4, TargetCounterHandler.GetPageByID(imageRenderer, id));
        }