void RealizeVisualBrush(VisualBrush brush, ref XForm xform) { //Debug.Assert(xform != null); xform = new XForm(writer.Owner, new XRect(brush.Viewbox.X * 3 / 4, brush.Viewbox.Y * 3 / 4, brush.Viewbox.Width * 3 / 4, brush.Viewbox.Height * 3 / 4)); Visual visual = brush.Visual; PdfContentWriter formWriter = new PdfContentWriter(writer.Context, xform, RenderMode.Default); //formWriter.Size = brush.Viewport.Size; formWriter.BeginContent(false); formWriter.WriteElement(visual); formWriter.EndContent(); }
void RealizeVisualBrush(VisualBrush brush, ref XForm xform) { //Debug.Assert(xform != null); xform = new XForm(this.writer.Owner, new XRect(brush.Viewbox.X * 3 / 4, brush.Viewbox.Y * 3 / 4, brush.Viewbox.Width * 3 / 4, brush.Viewbox.Height * 3 / 4)); Visual visual = brush.Visual; PdfContentWriter formWriter = new PdfContentWriter(this.writer.Context, xform, RenderMode.Default); //formWriter.Size = brush.Viewport.Size; formWriter.BeginContent(false); formWriter.WriteElement(visual); formWriter.EndContent(); }
internal void RenderPage(PdfPage page, FixedPage fixedPage) { this.page = page; context = new DocumentRenderingContext(page.Owner); //this.page.Width = fixedPage.Width; //this.page.Height = fixedPage.Height; //this.gsStack = new GraphicsStateStack(this); PdfContent content = null; //switch (options) //{ // case XGraphicsPdfPageOptions.Replace: // page.Contents.Elements.Clear(); // goto case XGraphicsPdfPageOptions.Append; // case XGraphicsPdfPageOptions.Prepend: // content = page.Contents.PrependContent(); // break; // case XGraphicsPdfPageOptions.Append: content = page.Contents.AppendContent(); // break; //} page.RenderContent = content; writer = new PdfContentWriter(context, this.page); //Initialize(); writer.BeginContent(false); writer.WriteElements(fixedPage.Content); writer.EndContent(); }
/// <summary> /// Creates an XForm from a visual brush. /// </summary> public static XForm FromVisualBrush(DocumentRenderingContext context, VisualBrush brush) { //XPImage xpImage = ImageBuilder.FromImageBrush(context, brush); //XImage ximage = xpImage.XImage; double width = brush.Viewport.Width; double height = brush.Viewport.Height; // view box in point // XRect box = new XRect(brush.Viewbox.X * 0.75, brush.Viewbox.Y * 0.75, brush.Viewbox.Width * 0.75, brush.Viewbox.Height * 0.75); XRect box = new XRect(0, 0, width, height); XForm xform = new XForm(context.PdfDocument, box); PdfContentWriter formWriter = new PdfContentWriter(context, xform, RenderMode.Default); PdfFormXObject pdfForm = xform.PdfForm; pdfForm.Elements.SetMatrix(PdfFormXObject.Keys.Matrix, new XMatrix()); //formWriter.Size = brush.Viewport.Size; formWriter.BeginContent(false); formWriter.WriteElement(brush.Visual); formWriter.EndContent(); return(xform); }
/// <summary> /// Creates an XForm from a visual brush. /// </summary> public static XForm FromVisualBrush(DocumentRenderingContext context, VisualBrush brush) { //XPImage xpImage = ImageBuilder.FromImageBrush(context, brush); //XImage ximage = xpImage.XImage; double width = brush.Viewport.Width; double height = brush.Viewport.Height; // view box in point // XRect box = new XRect(brush.Viewbox.X * 0.75, brush.Viewbox.Y * 0.75, brush.Viewbox.Width * 0.75, brush.Viewbox.Height * 0.75); XRect box = new XRect(0, 0, width, height); XForm xform = new XForm(context.PdfDocument, box); PdfContentWriter formWriter = new PdfContentWriter(context, xform, RenderMode.Default); PdfFormXObject pdfForm = xform.PdfForm; pdfForm.Elements.SetMatrix(PdfFormXObject.Keys.Matrix, new XMatrix()); //formWriter.Size = brush.Viewport.Size; formWriter.BeginContent(false); formWriter.WriteElement(brush.Visual); formWriter.EndContent(); return xform; }