I've searched and searched and I cannot find any information around using Telerik.Documents.Fixed with PDF's that have XFA forms. Is this possible? And if so is there any sample code showing how to do it?
Thanks.
I do notice that the AutoFitHeight works fine when I'm dealing with only a single row without any merged cells.
I have a situation where I have a merged cell which is the combination of cells from the same row (i.e. B2-B5). When trying to use AutoFitHeight, there is no change to the row height.
Is there anything I could do?
We have a scenario where the client is wanting a combobox in a generated Word document to have the color of the combobox change depending on the option selected (these combo boxes are repeated many times in the document so the colour change is important to the client.
Screenshot shows the Combobox in use. Below is the snippet of my code. Is there a way to do what I am after?
RadFlowDocumentEditor editor = new RadFlowDocumentEditor(document);
// In my source (an html document that was converted to a Word Document higher in the code) "#ddlApplies" is where I need to place a ComboBox
// It is in a table cell.
ReadOnlyCollection<FindResult> findResults = editor.FindAll("#ddlApplies", matchCase: false, matchWholeWord: false);
foreach (var item in findResults)
{
string foundVal = item.Runs[0].Text.Replace("#", "");
// The full run name consists of "#ddl|Identifier". In Furture dev we will use the Identifier (which is put in as the alias) to identify which control this is so we can read in the document and update other datasets
//var ddlContentControl = editor.InsertStructuredDocumentTag(SdtType.ComboBox);
ComboBoxProperties properties = new ComboBoxProperties();
// Complies --- Green
// Does not Comply --- Red
// Minor Variation --- Orange
// N/A -- Grey
properties.Items.Add(new ListItem() { DisplayText = "Complies", Value = "Complies" });
properties.Items.Add(new ListItem() { DisplayText = "Does not Comply", Value = "Does not Comply" });
properties.Items.Add(new ListItem() { DisplayText = "Minor Variation", Value = "Minor Variation" });
properties.Items.Add(new ListItem() { DisplayText = "N/A", Value = "N/A" });
// Setting the alias with the identifier.
properties.Alias = foundVal.Split("|")[1];
properties.Lock = Lock.SdtLocked;
properties.Placeholder = new Placeholder() {
PlaceholderText = "Select",
ShowPlaceholder = true
};
properties.OutlineAppearance = OutlineAppearance.BoundingBoxes;
//setting the properties
properties.RunProperties.CopyPropertiesFrom(item.Runs[0].Properties);
/***
Here is where I think I need to set things. But not sure how. Client wants each option to have a different colour. They would prefer the whole cell to change, but happy if I can just get the ComboBox to change.
***/
//inserting the Tag and setting the default value
editor.MoveToInlineStart(item.Runs[0]);
editor.InsertStructuredDocumentTag(properties, item.Runs[0], item.Runs[0]);
item.Runs[0].Text = "Select";
}
How can I install the document library alone without installing a component UI library?
I just want to process PDF files
Hi all,
I got some problems when I try to read my Excel file as below:
1. It skipped the null cells, it only read data at the cells having value. For example in my case, after reading cell 2 at row 2, it jumped to cell 14.
2. It showed the error message "The given key '3' was not present in the dictionary." at cell 15
You can see my code, the Excel file I used, and the result in below
My code
@page "/testpage"
@using Telerik.Documents.SpreadsheetStreaming;
<div>
@((MarkupString)(str.ToString()))
</div>
@code {
private StringBuilder str = new StringBuilder();
protected override void OnInitialized()
{
str = ReadData();
}
private StringBuilder ReadData()
{
try
{
string filename = ".\\Template.xlsx";
using (FileStream fs = new FileStream(filename, FileMode.Open))
{
using (IWorkbookImporter workBookImporter = SpreadImporter.CreateWorkbookImporter(SpreadDocumentFormat.Xlsx, fs))
{
foreach (IWorksheetImporter worksheetImporter in workBookImporter.WorksheetImporters)
{
foreach (IRowImporter rowImporter in worksheetImporter.Rows)
{
foreach (ICellImporter cell in rowImporter.Cells)
{
if(cell.Value!= null)
{
str.Append(cell.Value.ToString());
}
else
{
str.Append("NULL");
}
str.Append(",");
}
str.Append("<br/>");
}
}
}
}
return str;
}
catch(Exception ex)
{
str.Append("<br/>");
str.Append(ex.Message);
return str;
}
}
}
My Excel file as a picture below, I also attached my Excel in the question (Template.rar)
The result when I run
Everyone who know how to fix it, please help me.
Thank you
Hi all,
I would like to replace a temporary page content (a placeholder text) with an image in a Pdf. In order to do this, I use the telerik solution here.
My problem is that it doesn't work always : it often bugs because the placeholder text seems to be splitted in multiple text fragment.
Here is an example :
In my document : the placeholder text
The text fragments found in pdf :
And sometimes it works well:
Is there any solution to help me with this please?
Thank you,
Regards,
Adrian
I have a method like so that takes HTML and returns a PDF:
private static Stream ConvertToPdf(string htmlFileContent)
{
var htmlProvider = new HtmlFormatProvider();
var htmlDocument = htmlProvider.Import(htmlFileContent);
var pdfProvider = new PdfFormatProvider();
var pdfMemoryStream = new MemoryStream();
pdfProvider.Export(htmlDocument, pdfMemoryStream);
pdfMemoryStream.Position = 0;
return pdfMemoryStream;
}
This method works perfectly on my local Windows dev box, but when I run it in a Fargate container in AWS ECS, I get the following exception if the HTML contains an image:
System.NotSupportedException: Not supported image format.
at Telerik.Windows.Documents.Fixed.Model.Resources.ImageSource.DoOnUnknownData(Byte[] unknownData, ImageQuality imageQuality, Action`1 doOnEncodedData)
at Telerik.Windows.Documents.Fixed.Model.Resources.ImageSource.InitializeImageInfoFromUnknownData(Byte[] unknownData, ImageQuality imageQuality)
at Telerik.Windows.Documents.Fixed.Model.Resources.ImageSource.EnsureImageInfo()
at Telerik.Windows.Documents.Fixed.Model.Resources.ImageSource.get_Width()
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.Objects.ImageXObject.CopyPropertiesFrom(IPdfExportContext context, ImageSource imageSource)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Export.PdfExportContext.GetResource(ImageSource resource)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Export.PdfContentExportContext.GetResource(ImageSource imageSource)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Export.ContentElementWriters.ImageWriter.WriteOverride(PdfWriter writer, IPdfContentExportContext context, Image element)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Export.ContentElementWriters.MarkableContentElementWriter`1.Write(PdfWriter writer, IPdfContentExportContext context, Object element)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Export.ContentElementWriters.ClippingWriter.WriteOverride(PdfWriter writer, IPdfContentExportContext context, Clipping clipping)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Export.ContentElementWriters.ContentElementWriter`1.Write(PdfWriter writer, IPdfContentExportContext context, Object element)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Export.ContentElementWriters.ContentRootWriter.WriteOverride(PdfWriter writer, IPdfContentExportContext context, IContentRootElement element)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Export.ContentElementWriters.ContentElementWriter`1.Write(PdfWriter writer, IPdfContentExportContext context, Object element)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Export.ContentElementWriters.ContentElementWriterBase.WriteElement(PdfWriter writer, IPdfContentExportContext context, Object element)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.DocumentStructure.ContentStream.BuildContentData(IPdfExportContext context, IResourceHolder resourceHolder, IContentRootElement contentRootElement)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.DocumentStructure.Page.CopyPropertiesFrom(IPdfExportContext context, RadFixedPage fixedPage)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.DocumentStructure.DocumentCatalog.CopyRadFixedPageProperties(RadFixedPage source, Page destination, IRadFixedDocumentExportContext context)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.DocumentStructure.DocumentCatalog.CopyPagePropertiesFrom(IRadFixedDocumentExportContext context)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.DocumentStructure.DocumentCatalog.CopyPropertiesFrom(IRadFixedDocumentExportContext context)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Export.PdfExporter.Export(IRadFixedDocumentExportContext context, Stream output)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider.ExportOverride(RadFixedDocument document, Stream output)
at Telerik.Windows.Documents.Common.FormatProviders.FormatProviderBase`1.Export(T document, Stream output)
at Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider.ExportOverride(RadFlowDocument document, Stream output)
at Telerik.Windows.Documents.Common.FormatProviders.FormatProviderBase`1.Export(T document, Stream output)
When creating a PDF is there a way to nest a table within another table without having to be specific of the tables Y position? I actually have 3 tables that can look like this:
Table1 - Row1
Table2 - Row1
Table3 - Row1
Table3 - Row2
Table1 - Row2
The number of rows per table is determined by the data, so I don't necessarily know where I am on the page. Do I have to increase some kind of counter for each line, cause that would be miserable? I wish there were more extensive examples for creation of Pdf's. I have seen the Developer Focused examples none of them even come close to what I am trying to accomplish.