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

Render output

2 Answers 141 Views
PdfProcessing
This is a migrated thread and some comments may be shown as answers.
ManniAT
Top achievements
Rank 2
ManniAT asked on 23 Mar 2015, 07:05 AM
Hi,

I have a view which looks something like this:
<Viewbox>
    <Canvas Width="800" Height="1050" x:Name="caContent">
        <Image x:Name="imgBackground" Source="Images/Proto1.png" Stretch="UniformToFill" Width="800" Height="1050"/>
    </Canvas>
</Viewbox>

At runtime I load a background image an after that I place controls (TextBlock) on the Canvas which are bound to data.
So after all I have some kind of a report "printed" on the screen.
I can also print this report (it's designed to fit on A4 paper format).

Now my question - is there an easy way to save this report as PDF?

I've seen your samples where FirstLook looked promising - but I had to learn that it displays an image "resultDocument...png" and not the data.
And the "rendering code" is working with a "FixedContentEditor" and special rendering.

My idea was that I can "print" to your PDF component like to a printer - or in other words - use the existing (for screen rendering) code and simply render the result to PDF.
Is this possible?

Thank you
Manfred

2 Answers, 1 is accepted

Sort by
0
Accepted
Petya
Telerik team
answered on 24 Mar 2015, 04:57 PM
Hi Manfred,

RadPdfProcessing is a PDF document generation library, meaning it has no UI. With this in mind, it does support some utility classes and methods that allow to create the document in an easy manner, but they are not rendering engines.

As to the specific scenario, I suggest you take a look at the documentation of the RadFixedDocumentEditor and FixedContentEditor classes. The first one allows generation of documents in a flow-like manner, e.g. adding table-like structures, paragraphs, images and so on. The latter is very similar but additionally exposes API for drawing geometries. So while the First Look and Bar Chart demos show images in their views, the funnel on the first one and the chart on the second are produced entirely with the API of the library and you could adopt a similar approach for your application.

Also, we've considered exposing API allowing to convert a XAML visual tree to PDF and this is logged on the public portal here. You can vote for the functionality in order to increase its priority and follow it to be notified about any progress on the matter.

I hope this helps.

Regards,
Petya
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
ManniAT
Top achievements
Rank 2
answered on 24 Mar 2015, 05:09 PM
Hi Petya,

ATM I found a solution by rendering my output to an image and add this to the PDF.
Not perfect (no text selection - copy and so is available from the PDF) but as long as it has only to be a "printable content display" this works for me.

Thank you for the precise answer
Manfred 
Tags
PdfProcessing
Asked by
ManniAT
Top achievements
Rank 2
Answers by
Petya
Telerik team
ManniAT
Top achievements
Rank 2
Share this question
or