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

ExportToPdf turn valid xhtml off?

3 Answers 95 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Paul J
Top achievements
Rank 1
Paul J asked on 12 Dec 2008, 07:40 PM
Trying to invoke ExportToPdf function on a radEditor, but runs into errors that say the xhtml has to be valid. I'm normally a huge fan of valid xhtml/css code, however, my users, many of which are non-technical, are using the radEditor. They often cut and paste MS Word content into the window. I want to be able to possibly export the contents to PDF using the builtin function, but it requires all the content to be valid xhtml. Is there a way to turn off this requirement? To try and get the users to convert their content via the radEditor tools into Valid xhtml is going to be next to impossible. Also it appears through the conversion function that it does not allow the developer to set the header xhtml? i.e. before running .ExportToPDF, i would like to attach my print stylesheet to the contents for use when it converts over to PDF for proper printing. Am I doing something wrong here, or is this not possible?

Thanks,

Paul

3 Answers, 1 is accepted

Sort by
0
Accepted
Lini
Telerik team
answered on 16 Dec 2008, 09:17 AM
Hello Paul,

You can modify the editor content before you call the ExportToPdf() method. This way you can add the stylesheet you want at the beginning of the content. For example:

RadEditor1.Content = "<style>.text { color:black;}</style>" + RadEditor1.Content;
RadEditor1.ExportToPdf();

The XHTML requirement is there only to make sure that the editor content can be transferred to an XML document, which is then used to create the PDF document. This means that you only need to make sure that all tags are properly closed before the content is submitted to the server. Usually, this task is performed by the ConvertToXhtml editor content filter. In your case this filter is either disabled or it cannot process the MS Word pasted content properly.

Regards,
Lini
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
marcos paz
Top achievements
Rank 1
answered on 19 Dec 2008, 12:57 AM

greetings Lini,
i have tried your example exactly & have not been able to make the styles show up.

 

is there something i am missing ?

 
also, for some editor content values i am getting a PDF error- " .... could not open xxx.pdf because it is either not a supported file type or because the file has been damaged."
 is this due to xhtml compiance or a different cause? using adober reader 8.1.3

thanks,

marcos paz.

 

0
Rumen
Telerik team
answered on 22 Dec 2008, 01:05 PM
Hi Marcos,

Please, see the following forum thread on the subject: ExportToPdf putting out blank content?.

My suggestion is to also try another Html2Pdf converter tool to export the produced content to PDF, because the current editor's tool is still in development and does not work well in all scenarios.

Best regards,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Editor
Asked by
Paul J
Top achievements
Rank 1
Answers by
Lini
Telerik team
marcos paz
Top achievements
Rank 1
Rumen
Telerik team
Share this question
or