This is a migrated thread and some comments may be shown as answers.

Possible to add UIElement?

4 Answers 80 Views
PdfProcessing
This is a migrated thread and some comments may be shown as answers.
UDV
Top achievements
Rank 2
UDV asked on 08 Oct 2015, 06:55 AM

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

4 Answers, 1 is accepted

Sort by
0
Deyan
Telerik team
answered on 12 Oct 2015, 03:44 PM
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
0
UDV
Top achievements
Rank 2
answered on 13 Oct 2015, 06:43 AM

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

0
Deyan
Telerik team
answered on 14 Oct 2015, 03:26 PM
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
0
UDV
Top achievements
Rank 2
answered on 15 Oct 2015, 07:30 AM
Thanks, I will try this in a few weeks, and get back to you...
Tags
PdfProcessing
Asked by
UDV
Top achievements
Rank 2
Answers by
Deyan
Telerik team
UDV
Top achievements
Rank 2
Share this question
or