Export to PDF of InlineUIContainer not working

2 posts, 0 answers
  1. Bjorn
    Bjorn avatar
    6 posts
    Member since:
    Nov 2010

    Posted 10 Nov 2011 Link to this post

    I'm already using the Telerik controls for Silverlight for some time but just ran into a feature that doesn't seem to be working anymore.

    In one of my previous releases of my app I used to Export to PDF functionality to create a PDF of an UIElement. that release of the app used an older version of the Teleriks controls.

    With the current release (2011.2.915.0) it's not working anymore.

    Some debugging showed that it's probably the InlineUIContainer that's not working properly.

    The following example shows my problem. It only displays the Hello text, but not the Button. I tried to put different UIElements in the InlineUIContainer, but none of them would show up on the PDF.

    Can you tell me if i'm doing something wrong or is there a bug in the current Telerik release?

    Thank you!

     

    PdfFormatProvider provider = new PdfFormatProvider();
     
    Span sp = new Span() { Text = "Hello" };
     
    Paragraph para = new Paragraph() { TextAlignment = Telerik.Windows.Documents.Layout.RadTextAlignment.Center };
    para.Children.Add(sp);
     
    InlineUIContainer container = new InlineUIContainer();
    container.UiElement = new Button() { Content = "Button" };
    container.Height = 25;
    container.Width = 70;
    para.Children.Add(container);
     
    Section section = new Section() { PageMargin = new Telerik.Windows.Documents.Layout.Padding(10) };
    section.Children.Add(para);
     
    RadDocument doc = new RadDocument() { LayoutMode = DocumentLayoutMode.Paged };
    doc.Sections.Add(section);
     
    SaveFileDialog saveDialog = new SaveFileDialog();
    saveDialog.DefaultExt = ".pdf";
    saveDialog.Filter = "Adobe Pdf|*.pdf";
    bool? dialogResult = saveDialog.ShowDialog();
    if (dialogResult == true)
    {
        using (Stream output = saveDialog.OpenFile())
        {
            provider.Export(doc, output);
            MessageBox.Show("Saved Successfuly!");
        }
    }

     

     

  2. Bjorn
    Bjorn avatar
    6 posts
    Member since:
    Nov 2010

    Posted 10 Nov 2011 Link to this post

    Sorry, please close this thread. I had the latest Telerik installation but didn't upgrade my references. Used the Upgrade Wizard to get the latest references in my project.
Back to Top