I have multiple tables that are stacked vertically. In this scenario, the first table has text that wraps to the next line. After the table drawn, the position is calculated and the next table is drawn.
The issue is that the second table covers part of the first table, but only when the last line of the first table has text that wraps
Below is the code that we are using to calculate postion.
var tableSize = table.Measure(RemainingPageSize);
position.YPosition += tableSize.Height + defaultLineHeight;
editor.Position.Translate(position.XPosition, position.YPosition);
Note:
position.YPosition and postion.XPosition are type "double"
Hello,
I'm attempting to include PNG files in the PDF that I'm generating by using the same code structure in the "CreateDocumentWithImages" demo, but I keep getting 'Can not export other than Jpeg and Jpeg2000 and ImageQuality different than High'.
I then, attempted to run the demo project, as it includes PNG files, but I got the same error there, as well.
Is it possible to add PNG files to the PDF?
Thanks!
Hi,
I'm trying to see whether it is possible to use Telerik Document Processing to do the following
I've say dynamic number of SpreadSheet created with ClosedXML.Reports (data coming from SQL server)
I've one Word Template document where I need a way to insert the above worksheet in certain pages. If there is a better way to show(insert) the spreadsheet, I'm open to any suggestion.
I also need some fields (merge fields possibly) in the Template file and once this is processed, I want to save the file as a docx file and save as pdf file also.
I thought Telerik Document Processing will help but, I really confused with the namespaces, trial products etc Rad vs wordprocessing vs spreadsheetprocessing etc.
I would appreciate if you could help me with what I need product wise, namespace wise and some help on the process to do this
Thanks
Ramesh
i am getting the following error when trying to convert a docx to pdf at the following line
providerDocx.Import(input)
The type initializer for 'Telerik.Windows.Documents.Flow.Model.RadFlowDocument' threw an exception.
using System;
using System.IO;
using Telerik.Windows.Documents.Common.FormatProviders;
using Telerik.Windows.Documents.Flow.FormatProviders.Docx;
using Telerik.Windows.Documents.Flow.FormatProviders.Pdf;
using Telerik.Windows.Documents.Flow.Model;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
var providerDocx = new DocxFormatProvider();
string path = System.IO.Directory.GetCurrentDirectory();
string fileName = Path.Combine(path, "1.docx");
RadFlowDocument document = null;
using (FileStream input = new FileStream(fileName, FileMode.Open))
{
document = providerDocx.Import(input);
}
var providerPdf = new PdfFormatProvider();
Stream outStream = new MemoryStream();
providerPdf.Export(document, outStream);
//Test the conversion:
var fileStream = File.Create("PdfTest.pdf");
outStream.Seek(0, SeekOrigin.Begin);
outStream.CopyTo(fileStream);
fileStream.Close();
}
}
}
Hi,
I'm currently using FixedContentEditor to create my pdf. I'm using blocks to write the long text like "terms and conditions" at the end of the pdf but it doesnot wrap the text. Is there a way I can insert long text ?
FixedContentEditor contentEditor4 = new FixedContentEditor(document.Pages[0], simplePosition4);
Block block4 = new Block();
block4.InsertText("This summary details the voting directions (if any) for business items on the appointment documents in your favour. If you vote these proxy votes you must vote in accordance with these directions. By completing the attached voting paper, when directed to vote in a particular manner, you are deemed to have voted in accordance with those directions.");
contentEditor4.DrawBlock(block4);
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?