
Hi,
I need help to setup page orientation to landscape due to size of the contents in cells.
Here is my code.
public RadFlowDocument CreateDocument(ref RadFlowDocument document, List<LetterGenerateData> initltr, string pathlogo)
{
RadFlowDocumentEditor editor = new RadFlowDocumentEditor(document);
Stream stream = File.Open(pathlogo, FileMode.Open);
using (stream)
{
Telerik.Windows.Documents.Media.ImageSource image = new Telerik.Windows.Documents.Media.ImageSource(stream, "png");
editor.InsertImageInline(stream, "png", new System.Windows.Size(168, 48));
}
var codeFont = new ThemableFontFamily(new System.Windows.Media.FontFamily("Arial"));
editor.CharacterFormatting.FontFamily.LocalValue = codeFont;
editor.CharacterFormatting.FontWeight.LocalValue = FontWeights.Bold;
editor.CharacterFormatting.FontSize.LocalValue = 12.0;
editor.InsertText("Statement");
document.StyleRepository.AddBuiltInStyle(BuiltInStyleNames.TableGridStyleId);
editor.TableFormatting.StyleId = BuiltInStyleNames.TableGridStyleId;
var table = editor.InsertTable();
var headerrow = table.Rows.AddTableRow();
headerrow.RepeatOnEveryPage = true;
var hcell1 = headerrow.Cells.AddTableCell();
hcell1.Blocks.AddParagraph().Inlines.AddRun("Name").FontWeight = FontWeights.Bold;
var hcell2 = headerrow.Cells.AddTableCell();
hcell2.Blocks.AddParagraph().Inlines.AddRun("Profession").FontWeight = FontWeights.Bold;
var hcell3 = headerrow.Cells.AddTableCell();
hcell3.Blocks.AddParagraph().Inlines.AddRun("Age").FontWeight = FontWeights.Bold;
foreach (var item in initltr)
{
var row = table.Rows.AddTableRow();
var cell1 = row.Cells.AddTableCell();
var cell2 = row.Cells.AddTableCell();
var cell3 = row.Cells.AddTableCell();
cell1.Blocks.AddParagraph().Inlines.AddRun(item.Name).FontSize = 9;
cell2.Blocks.AddParagraph().Inlines.AddRun(item.Profession).FontSize = 9;
cell3.Blocks.AddParagraph().Inlines.AddRun(item.Age).FontSize = 9;
}
return document;
}
Much appreciated.

Hi
I am generating a PDF from a html file using HtmlFormatProvider, RadFlowDocument and PdfFormatProvider.
The generated PDF contains some large tables that is not rendered correctly.
This can be solved if I can set the html page witdth somehow. Is it possible?
I have a Template pdf (With company logo as letter head). I want to use this pdf as the first page when I'm creating my pdf.
Here's my sample code. It creates the letter head in the first page and the rest of the content in a new page.
PdfFormatProvider provider = new PdfFormatProvider();
RadFixedDocument document = provider.Import(File.ReadAllBytes(InputFileName));
using (RadFixedDocumentEditor editor = new RadFixedDocumentEditor(document))
{
editor.ParagraphProperties.SpacingBefore = 10;
editor.ParagraphProperties.HorizontalAlignment = Telerik.Windows.Documents.Fixed.Model.Editing.Flow.HorizontalAlignment.Center;
editor.InsertParagraph();
editor.CharacterProperties.FontSize = 40;
editor.CharacterProperties.Font = boldItalicFont;
editor.InsertRun("Summary of Proxy Votes");

I'm having this issue with some digital signed pdfs.
Here is the code that gets the exception:
var signatureFields = document.AcroForm.FormFields.Where(field => field.FieldType == FormFieldType.Signature).ToList();
if (signatureFields.IsNotNullOrEmpty())
{
foreach (var signatureField in signatureFields)
{
var field = (SignatureField)signatureField;
if (field != null && field.Signature != null)
{
var test = field.Signature.Validate(); - this is the line where I get the exceptions!
The method Validate() called without the properties parameter throws exception in 2 cases:
1st - using pdf signed with specialized software
Message: "No signature validation handler was found for the subfilter: ETSI.CAdES.detached
and the StackTrace: at Telerik.Windows.Documents.Fixed.Model.DigitalSignatures.Signature.Validate(SignatureValidationProperties validationProperties)\r\n at Telerik.Windows.Documents.Fixed.Model.DigitalSignatures.Signature.Validate()\r\n at... (there goes the path in my project)
2nd - using pdf signed with the same digital signature by Adobe Acrobat Reader
Message "ASN1 bad tag value met.\r\n"
and the StackTrace: at System.Security.Cryptography.Pkcs.SignedCms.OpenToDecode(Byte[] encodedMessage, ContentInfo contentInfo, Boolean detached)\r\n at System.Security.Cryptography.Pkcs.SignedCms.Decode(Byte[] encodedMessage)\r\n at Telerik.Windows.Documents.Fixed.Model.DigitalSignatures.Pkcs7Detached.ValidateOverride(SignatureDataProperties dataProperties, SignatureValidationProperties validationProperties)\r\n at Telerik.Windows.Documents.Fixed.Model.DigitalSignatures.SignatureValidationHandlerBase.Validate(SignatureDataProperties dataProperties, SignatureValidationProperties validationProperties)\r\n at Telerik.Windows.Documents.Fixed.Model.DigitalSignatures.Signature.Validate(SignatureValidationProperties validationProperties)\r\n at Telerik.Windows.Documents.Fixed.Model.DigitalSignatures.Signature.Validate()\r\n at... (there goes the path in my project)
I'll be glad if you can tell me where the problem is and what can I do to fix it.
I want to be clear, there are just some correctly signed pdfs that cannot pass this validation. Most of them can but I'm afraid that I am missing something, as one of the non-passing digital signatures is new.

01.void f(List<Bitmap> Images)02.{03. DateTime now = DateTime.Now;04. string name = "scan-" + now.ToString("yyyyMMdd") + "-" + now.ToString("HHmmss") + "_3" + ".pdf";05. 06. using (FileStream FileStream = new FileStream(@"c:\Users\avicode\Desktop\tmp\" + name,FileMode.Create))07. using (MemoryStream ms = new MemoryStream())08. 09. if (Images.Count >= 1)10. {11. RadDocument document = new RadDocument();12. for (int i = 0; i < Images.Count; i++)13. {14. System.Drawing.Image oBmpImage = (System.Drawing.Image)Images[Images.Count - 1];15. oBmpImage.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);16. Telerik.Windows.Documents.Model.Section section = new Telerik.Windows.Documents.Model.Section();17. Telerik.Windows.Documents.Model.Paragraph paragraph = new Telerik.Windows.Documents.Model.Paragraph();18. 19. ImageInline image = new ImageInline(ms);20. paragraph.Inlines.Add(image);21. section.Blocks.Add(paragraph);22. document.Sections.Add(section);23. 24. }25. PdfFormatProvider oPdf = new PdfFormatProvider();26. oPdf.Export(document,FileStream);27. }28.}

I want to set table line style like this attachment. How Can I set this table line style?

Borders I am creating with RadFlowDocumentEditor are not displayed in Radrichtextbox, to demonstrate here is my test code, I am using Telerik UI for WPF R2 2019.
Attached is the file, also how it is displayed in Word and the how it is displayed in the RadRichTextBox inside my application.
using System.Windows;using System.Windows.Controls;using Telerik.Windows.Controls;using Telerik.Windows.Documents.FormatProviders.Html;using System.Linq;using System;using System.IO;using Telerik.Windows.Documents.Flow.Model;using Telerik.Windows.Documents.Flow.Model.Editing;using Telerik.Windows.Documents.Flow.Model.Styles;using Telerik.Windows.Documents.Spreadsheet.Model; public void CreateCell(RadFlowDocumentEditor documentEditor, Table table, int row, int column, string text, FontWeight fw, float Width, Alignment alignment, double fs = 0) { while (table.Rows[row].Cells.Count < (column + 1)) { table.Rows[row].Cells.AddTableCell(); } Paragraph newPara = table.Rows[row].Cells[column].Blocks.AddParagraph(); table.Rows[row].Cells[column].PreferredWidth = new TableWidthUnit(Width); table.Rows[row].Cells[column].Padding = new Telerik.Windows.Documents.Primitives.Padding(2); newPara.TextAlignment = alignment; documentEditor.MoveToParagraphStart(newPara); var line = documentEditor.InsertText(text); line.FontWeight = fw; if (fs > 0) line.FontSize = fs; } private void radButtonTest_Click(object sender, RoutedEventArgs e) { //produce test doc Telerik.Windows.Documents.Flow.FormatProviders.Docx.DocxFormatProvider provider = new Telerik.Windows.Documents.Flow.FormatProviders.Docx.DocxFormatProvider(); RadFlowDocument document = new RadFlowDocument(); RadFlowDocumentEditor documentEditor = new RadFlowDocumentEditor(document); //create table Table table = documentEditor.InsertTable(1, 3); //header double fsText = Telerik.Windows.Documents.Model.Unit.PointToDip(10); var row = 0; CreateCell(documentEditor,table, row, 0, "Time", FontWeights.Bold, 80, Alignment.Left, fsText); CreateCell(documentEditor, table, row, 1, "Type", FontWeights.Bold, 200, Alignment.Left, fsText); CreateCell(documentEditor, table, row, 2, "Location", FontWeights.Bold, 230, Alignment.Left, fsText); table.Rows[row].Cells[0].Shading.BackgroundColor = new ThemableColor(Telerik.Windows.Documents.Spreadsheet.Theming.ThemeColorType.Accent1, 0.5); table.Rows[row].Cells[1].Shading.BackgroundColor = new ThemableColor(Telerik.Windows.Documents.Spreadsheet.Theming.ThemeColorType.Accent1); table.Rows[row].Cells[2].Shading.BackgroundColor = new ThemableColor(Telerik.Windows.Documents.Spreadsheet.Theming.ThemeColorType.Accent1, 0.9); //add rows table.Rows.AddTableRow(); row++; CreateCell(documentEditor, table, row, 0, DateTime.Now.ToString("HH:mm:ss"), FontWeights.Normal, 80, Alignment.Left, fsText); CreateCell(documentEditor, table, row, 1, "Value " + row.ToString(), FontWeights.Normal, 200, Alignment.Left, fsText); CreateCell(documentEditor, table, row, 2, "Loc " + row.ToString(), FontWeights.Normal, 230, Alignment.Left, fsText); table.Rows[row].Cells[0].Borders = new TableCellBorders(new Telerik.Windows.Documents.Flow.Model.Styles.Border(BorderStyle.None) , new Telerik.Windows.Documents.Flow.Model.Styles.Border(BorderStyle.Double) , new Telerik.Windows.Documents.Flow.Model.Styles.Border(BorderStyle.None) , new Telerik.Windows.Documents.Flow.Model.Styles.Border(BorderStyle.None)); table.Rows[row].Cells[1].Borders = new TableCellBorders(new Telerik.Windows.Documents.Flow.Model.Styles.Border(BorderStyle.None) , new Telerik.Windows.Documents.Flow.Model.Styles.Border(BorderStyle.Double) , new Telerik.Windows.Documents.Flow.Model.Styles.Border(BorderStyle.None) , new Telerik.Windows.Documents.Flow.Model.Styles.Border(BorderStyle.None)); table.Rows[row].Cells[2].Borders = new TableCellBorders(new Telerik.Windows.Documents.Flow.Model.Styles.Border(BorderStyle.None) , new Telerik.Windows.Documents.Flow.Model.Styles.Border(BorderStyle.Double) , new Telerik.Windows.Documents.Flow.Model.Styles.Border(BorderStyle.None) , new Telerik.Windows.Documents.Flow.Model.Styles.Border(BorderStyle.None)); table.Rows.AddTableRow(); row++; CreateCell(documentEditor, table, row, 0, DateTime.Now.ToString("HH:mm:ss"), FontWeights.Normal, 80, Alignment.Left, fsText); CreateCell(documentEditor, table, row, 1, "Value " + row.ToString(), FontWeights.Normal, 200, Alignment.Left, fsText); CreateCell(documentEditor, table, row, 2, "Loc " + row.ToString(), FontWeights.Normal, 230, Alignment.Left, fsText); table.Borders = new TableBorders( new Telerik.Windows.Documents.Flow.Model.Styles.Border(BorderStyle.Single)); //save test file using (Stream output = new FileStream(@"c:\temp\testdoc.docx", FileMode.OpenOrCreate)) { provider.Export(document, output); }}

