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

Questions

1 Answer 33 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Fabio
Top achievements
Rank 1
Fabio asked on 14 Apr 2012, 02:42 PM
Hi,
we want to buy the new version of telerik controls because we are interested in RichTextEditor and PdfViewer for WPF.
We have some question before decide:
Is it possible to :
- convert review of text selection in highlight text when the document is converted in pdf?
- decide witch part of document is editable? We need to define some read only region in document.
- insert existing document as attachment of principal document? We need to embed other pdf documents. We know that in pdf is possible and we have do with iTextSharp. If is not allowed, is it possible to insert custom xaml tag to intercept the pdf generation and manage with our procedure?

Thanks

1 Answer, 1 is accepted

Sort by
0
Iva Toteva
Telerik team
answered on 18 Apr 2012, 02:59 PM
Hi Fabio,

Thank you for your interest in RadControls for WPF. To your questions:

Is it possible to:

- convert review of text selection in highlight text when the document is converted in pdf?
If I understand you correctly, you would like to export only the selected part of the document to PDF rather than the whole file. This is possible and can be achieved by creating a DocumentFragment from the selection, converting it to RadDocument and exporting this RadDocument instead of the original one. There is no command that can be used, but this can be achieved quite easily like this:

public void ExportSelectionToPdf(RadDocument document)
{
    if (document.Selection.IsEmpty)
    {
        return;
    }
    SaveFileDialog saveDialog = new SaveFileDialog();
    if (saveDialog.ShowDialog() == true)
    {
        using (Stream stream = saveDialog.OpenFile())
        {
            DocumentFragment selectedFragment = document.Selection.CopySelectedDocumentElements();
            RadDocument selectedPart = selectedFragment.ToDocument();
            DocumentFormatProvidersManager.GetProviderByExtension("pdf").Export(selectedPart, stream);
        }
 
    }
}


- decide witch part of document is editable? We need to define some read only region in document.
You can use PermissionRanges to specify which parts of a document different users have rights to edit. Please refer to the Document protection demo for Silverlight or the same one in the Click-once demos for a review of the way PermissionRanges are used. The document in the demo describes the way document protection can be used.
When it comes to programmatic usage of PermissionRanges, they are a type of annotation ranges. You can get a broader idea of their place in the document model from the picture in this article.

- insert existing document as attachment of principal document? We need to embed other pdf documents. We know that in pdf is possible and we have do with iTextSharp. If is not allowed, is it possible to insert custom xaml tag to intercept the pdf generation and manage with our procedure?
It is not possible to add file attachments to RadDocument or RadRichTextBox. This feature is currently not scheduled for implementation, so I cannot provide you with any details if or when it will be implemented. The export of PdfFormatProvider cannot be customized in such a way. However, you can create a custom PdfFormatProvider that includes the required functionality.

I hope this answers your questions.  

Regards,
Iva Toteva
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
RichTextBox
Asked by
Fabio
Top achievements
Rank 1
Answers by
Iva Toteva
Telerik team
Share this question
or