Possible to add UIElement?

5 posts, 0 answers
  1. UDV
    UDV avatar
    3 posts
    Member since:
    Nov 2014

    Posted 08 Oct 2015 Link to this post

    Hi

    I have been testing the PDFProcessing library, and have one question I hope you could answer.

    In my application I need to create a PDF documentation, with content like texts, tables, images etc. 

    Is there any way I can add a UIElement just like adding a text or image to a RadFixedPage?

    I have previously been using the FlowDocument where you can add UIElements... 

     

    Kind regards

    Jesper

  2. Deyan
    Admin
    Deyan avatar
    136 posts

    Posted 12 Oct 2015 Link to this post

    Hello Jesper,

    Thank you for contacting us.

    When you want to export UI element to PDF you have several options. Two of them are listed below:
    1. The first option is to convert the UI element to image and add this image to the PDF page. This may be achieved using ExportExtensions.ExportToImage method. I am attaching a sample application that creates image from Telerik's Barcode UI element and then exports this barcode to PDF.
    2. The second option is to draw the UI Element using native PDF primitives (texts, geometries and images). You may see how this can be achieved by following this link to SDK example showing how you can export UI element to PDF.
    I hope this information is helpful. If you have any other questions or concerns please do not hesitate to contact us again. 

    Regards,
    Deyan
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UDV
    UDV avatar
    3 posts
    Member since:
    Nov 2014

    Posted 13 Oct 2015 in reply to Deyan Link to this post

    Hi Deyan,

    Thanks for the feedback.

    I have already been thinking about those two options. First option will reduce the quality of the UIElement and that is not acceptable in this case. Since our UIElement might get pretty advanced the second option will take to long to implement.

    Regards,
    Jesper

  4. Deyan
    Admin
    Deyan avatar
    136 posts

    Posted 14 Oct 2015 Link to this post

    Hello Jesper,

    About the first option - you can take snapshot of the UI element in its desired size (or bigger that this size) and then insert the image in the PDF using the DrawImage overload that allows you to specify the rendering size. This way the image will be rendered in the PdfViewer with the specified size using the source of the originally bigger image. This combined with the ImageQuality.High option in ImageSource constructor may help to achieve better quality when rendering the UIElement.

    With the second option - we have tested this SDK example with relatively large variety of UIElements and in most cases everything is exported correctly. Basically, the example traverses the WPF visual tree and renders WPF primitives, so it is suitable for exporting different UI scenarios. If you experience any issues with some concrete example you may write to us again so that we can try solving the issue together.

    I hope this helps.

    Regards,
    Deyan
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  5. UDV
    UDV avatar
    3 posts
    Member since:
    Nov 2014

    Posted 15 Oct 2015 in reply to Deyan Link to this post

    Thanks, I will try this in a few weeks, and get back to you...
Back to Top