Ok, I tried to render the landscape control to a bitmap first and perform the transform on that. Unfortunately, the results are the same as the previous one - the content gets clipped. Code below:
WriteableBitmap bitmap = new WriteableBitmap(1112, 1112); LandscapePrintTemplateControl landscapeTemplate = new LandscapePrintTemplateControl(); landscapeTemplate.Height = e.PrintableArea.Width; landscapeTemplate.Width = e.PrintableArea.Height; landscapeTemplate.Title = headingTitle; bitmap.Render(elementToPrint, null); bitmap.Invalidate(); Image printImageSource = new Image(); printImageSource.Source = bitmap; printImageSource.Width = bitmap.PixelWidth; printImageSource.Height = bitmap.PixelHeight; TransformGroup transformGroup = new TransformGroup(); RotateTransform rotateTransform = new RotateTransform(); rotateTransform.Angle = 90; transformGroup.Children.Add(rotateTransform); TranslateTransform moveTransform = new TranslateTransform(); moveTransform.X = e.PrintableArea.Width; transformGroup.Children.Add(moveTransform); printImageSource.RenderTransform = transformGroup; e.PageVisual = printImageSource; On Mon, Jun 28th, 2010 at 9:48 AM, Jordan Knight <[email protected]> wrote: > Hey Tony, > > You need to make sure the containing element is higher than that > rotated > element... or it will clip it. > > On Mon, Jun 28, 2010 at 9:47 AM, <[email protected]> wrote: > > > Hi all, > > > > I am currently attempting to rotate a form which is rendering to > the screen > > in Landscape to a > > printed page which is Portrait. While I don't think it's that > important, > > the dimensions of the form are > > Width=1112, Height=793. The print surface (I am just printing to an > XPS > > file) are Width=793, > > Height=1112. I matched the dimensions for simplicity. > > > > Basically, I add a transform group, call a rotate transform (angle > 90 > > degrees), translate transform > > to shift the result back onto the "page" and then after setting > the > > transform onto the form, I set it > > as the print element. > > > > The result of this is that it does successfully rotate the form - > > everything that I have putting on the > > page is correct and showing up on the page EXCEPT that the page > itself is > > clipped at the bottom. > > That is, the page displays as portrait, the content is showing as > a > > landcape rotated, but the page > > clips at the bottom so that we only see part of that landscape > page. It is > > as though the output > > hasn't been adjusted for the new dimensions, only showing as much > as the > > height of the original > > form. I have attached a (very small) example image to show what I > mean. > > > > Below is the code I am using. Is there anything that I am doing > wrong here? > > > > Regards, > > Tony > > > > > > LandscapePrintTemplateControl landscapeTemplate = new > > LandscapePrintTemplateControl(); > > landscapeTemplate.Height = e.PrintableArea.Width; > > landscapeTemplate.Width = e.PrintableArea.Height; > > landscapeTemplate.Title = headingTitle; > > //landscapeTemplate.AddChildren(printImageSource); > > > > TransformGroup transformGroup = new TransformGroup(); > > RotateTransform rotateTransform = new RotateTransform(); > > rotateTransform.Angle = 90; > > transformGroup.Children.Add(rotateTransform); > > TranslateTransform moveTransform = new TranslateTransform(); > > moveTransform.X = e.PrintableArea.Width; > > transformGroup.Children.Add(moveTransform); > > > > landscapeTemplate.RenderTransform = transformGroup; > > > > e.PageVisual = landscapeTemplate; > > > > _______________________________________________ > > ozsilverlight mailing list > > [email protected] > > http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight > > > > > _______________________________________________ ozsilverlight mailing list [email protected] http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
