Hi,
I have an existing word document and I need to remove paragraph/sentence/line.
stream input = File.OpenRead(filepath);
RadFlowDocument document = provider.Import(input);
RadFlowDocumentEditor editor = new RadFlowDocumentEditor(document);
editor.ReplaceText("<Expr2>", ltr.Expr2));
editor.ReplaceText("<Expr3>", ltr.Expr3));
If ltr.Expr2 is blank, then it should remove blank lines from document where <Expr2> exists, otherwise replace text with ltr.Expr2 value.
Any help would be greatly appreciated.
Hi,
I have a problem where I need a header repeat on every page but its not working. Please help.
RadFlowDocumentEditor editor = new RadFlowDocumentEditor(document);
Stream stream = File.Open(pathlogo, FileMode.Open);
using (stream)
{
Telerik.Windows.Documents.Media.ImageSource image = newTelerik.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 section = editor.InsertSection();
var table = section.Blocks.AddTable();
section.Rotate(PageOrientation.Landscape);
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;
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?