After upgrading the Telerik Document Processing libraries to version Q1 2025 the following error messages may occur:
* "The file or assembly cannot be loaded 'Telerik.Licensing.Runtime, Version=1.4.6.0, Culture=neutral, PublicKeyToken=token_here' or one of its dependencies. The system cannot find the specified file."
* "NU1101: Unable to find package Telerik.Licensing. No packages exist with this id in source(s): Telerik nuget. PackageSourceMapping is enabled, the following source(s) were not considered: Microsoft Visual Studio Offline Packages, nuget.org."
I'm using SpreadProcessing in conjunction with a TelerikSpreadsheet in a Blazor app where the user can modify a spreadsheet and click a submit button. In my submit handler I'm using the result of Worksheet.UsedCellRange to set up my loops for the purpose of validation. When the user clicks submit, I get the expected result from Worksheet.UsedCellRange and then I spin the used rows and columns and apply validation. If there are validation errors I make the cell red and then export the workbook back to a memory stream and assign the byte array back to the variable to which the spreadsheet is bound. That works fine.
The issue I'm having is that if the user clicks submit, gets validation errors, makes a change and then clicks the submit button a second time, the result I get from Worksheet.UsedCellRange includes all rows, even if only one or two rows actually have data. To narrow down the issue I removed all my validation logic so I am not making any changes to the cells before I assign the byte array, but the second time through the result of UsedCellRange still reports all rows. Am I not assigning the byte array correctly at the end of my submit method? See code:
private async Task OnSubmitAsync()
{
byte[] sheet = await _spreadsheetRef.ExportToExcelAsync();
using MemoryStream ms = new(sheet);
XlsxFormatProvider formatProvider = new();
Workbook workbook = formatProvider.Import(ms, new TimeSpan(0, 0, 5));
Worksheet worksheet = workbook.Worksheets.First();
// The first time through this is correct, second time through it reports all 200 rows are in use. Why?
CellRange cellRange = worksheet.UsedCellRange;
// Validation logic would normally go here
// Set the byte array back to the bound variable
// Should I be doing this differently?
ms.SetLength(0);
formatProvider.Export(workbook, ms, new TimeSpan(0, 0, 30));
_fileData = ms.ToArray(); // _fileData is bound to the TelerikSpreadsheet component
}
I've seen a couple other posts here about export performance, but they both refer to relatively large amounts of data. I am having issues so I stripped my example down to the where it's exporting a blank spreadsheet (see code below) but it still takes over 10 seconds running in debug on my laptop. I'm using this in the context of a Blazor app and since this is synchronous the page hangs while the export is running. What can I do to speed this up?
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets.Add();
IWorkbookFormatProvider formatProvider = new XlsxFormatProvider();
using MemoryStream ms = new();
formatProvider.Export(workbook, ms, new TimeSpan(0, 0, 30)); // This takes over 10 seconds
_fileData = ms.ToArray(); // byte array that the Blazor component reads
I am trying out the document processing library and the barcode formsource (https://docs.telerik.com/devtools/document-processing/libraries/radpdfprocessing/model/formsource/barcode).
When I add the barcode, I get a white pdf. If I leave barcode off it, everything else shows up. Any idea what i am doing wrong?
Example file:
internal class DocGenerator
{
public void CreateDocument()
{
var document = new RadFixedDocument();
var page = document.Pages.AddPage();
page.Size = new Size(595, 842); // A4 size
var editor = new FixedContentEditor(page);
//editor.Position.Translate(0, 0);
//FormSource barcode = FormSource.FromBarcode(Symbology1DType.Code128, "1234567890", width: 100, height: 100);
//editor.DrawForm(barcode, 100, 100);
editor.Position.Translate(20, 20);
// Title
editor.DrawText("P 24-07-2024 12:03");
editor.Position.Translate(300, 20);
editor.DrawText("Person X");
// Aisle and Pallet
editor.Position.Translate(20, 60);
editor.DrawText("AISLE");
editor.Position.Translate(100, 60);
editor.TextProperties.FontSize = 36;
editor.DrawText("A101");
editor.Position.Translate(20, 150);
editor.TextProperties.FontSize = 12;
editor.DrawText("P");
editor.Position.Translate(100, 150);
editor.TextProperties.FontSize = 36;
editor.DrawText("0237");
AddBarcode(editor);
editor.TextProperties.FontSize = 10;
var blackColor = new RgbColor(0, 0, 0);
Table table = new Table();
table.Borders = new TableBorders(
new Border(1, blackColor), // Top
new Border(1, blackColor), // Right
new Border(1, blackColor), // Bottom
new Border(1, blackColor) // Left
);
AddTableRows(table);
editor.Position.Translate(20, 240);
editor.DrawTable(table);
using (Stream output = File.OpenWrite(@"c:\temp\Output.pdf"))
{
PdfFormatProvider flowPdfProvider = new();
flowPdfProvider.Export(document, output, new TimeSpan(0,0,10));
}
}
private void AddBarcode(FixedContentEditor editor)
{
editor.Position.Translate(150, 150);
FormSource barcodeWithCenterCenterText = FormSource.FromBarcode(Symbology1DType.Code128, "1234567890", showText: true);
editor.DrawForm(barcodeWithCenterCenterText, 100, 100);
}
private void AddTableRows(Table table)
{
string[][] rows = new[]
{
new[] { "P", "PNo", "Brut", "Net", "Quality", "Pattern", "Pr", "Co", "Ac" },
new[] { "1000", "1001", "119,50", "118,70", "P1", "", "C1", "U1" },
new[] { "1000", "1002", "120,00", "119,40", "P1", "", "C1", "U1" },
new[] { "1000", "1003", "112,80", "112,10", "P1", "", "C1", "U1" },
new[] { "1000", "1004", "120,50", "120,00", "P1", "", "C1", "U1" },
new[] { "1000", "1005", "114,40", "113,50", "P1", "", "C1", "U1" },
new[] { "1000", "1006", "114,40", "113,70", "P1", "", "C1", "U1" },
new[] { "1000", "1007", "104,00", "102,60", "P1", "", "C1", "U1" },
new[] { "1002", "1008", "99,80", "99,40", "P2", "", "C2", "H1" },
new[] { "1002", "1009", "100,40", "100,00", "P2", "", "C2", "H1" },
new[] { "1002", "1010", "100,40", "99,40", "P2", "", "C2", "H1" },
new[] { "1002", "1011", "73,30", "72,50", "P2", "", "C2", "H1" },
new[] { "1002", "1012", "100,00", "99,80", "P2", "", "C2", "H1" },
new[] { "1002", "1013", "74,30", "73,80", "P2", "", "C2", "H1" },
new[] { "1002", "1014", "105,00", "104,30", "P2", "", "C2", "H1" },
};
foreach (var rowValues in rows)
{
var row = table.Rows.AddTableRow();
foreach (var value in rowValues)
{
var cell = row.Cells.AddTableCell();
cell.Blocks.AddBlock().InsertText(value);
}
}
}
}
After recent update to 2025.2.520.462 I'm unable to extract file and save on disk. ExtractToFile() method is not longer here.
I've changed my usings from Telerik.WinControls.Zip to Telerik.Windows.Zip but I'm missing Telerik.Windows.Zip.Extensions.dll file.
What should I replace method ExtractToFile() with?
There is a code we use right now:
Byte[] bytes = File.ReadAllBytes(filePath);
https://www.telerik.com/document-processing-libraries/pdf-processing
Folks,
For a new project I need to generate a dynamic multi page pdf and one of the mandatory requirements is that some kind of template (html, xml, word) is used for easier maintance purposes.
Is it correct that for the Telerik PDF processing Library the only way to define pdfs is directly in the c# code and not some kind of template?
Thank you
Valentin
PdfProcessing - Developer Focused Examples - Telerik Document Processing
Hi,
we need to generate PDF/UA comform pdfs from scratch. Is that possible with Telerik PdfProcessing? I know that PDF/A works but we need PDF/UA specifically.
Thank you,
Valentin
We need to print a GridView and are implementing the code found in "GridView | Print and Print Preview" example in the WPF Desktop Examples 2024 Q4 app but are encountering two issues also present in the Telerik-provided example.
1) Changes made in Print Preview are not carried over when the Print button is pressed. For example, if you change to Landscape/Legal in Print Preview, this will revert back to Portrait/Letter when Print is clicked.
2) Clicking Print on the Print Preview window shoves the Print Preview window to the background and if Cancel is clicked on the Print window, the user has to Alt-Tab through windows to find the Print Preview window to close it.
We need to set a spreadsheet font to Courier New in a WPF app using telerik.ui.for.wpf.60.xaml\2024.2.514. As a first step, we do:
using System.Windows;
using Telerik.Documents.Common.Model;
namespace WpfApp4;
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
var fontFamily = new ThemableFontFamily("Courier New");
}
}
Which is fine until we add a required cross-platform project referencing telerik.documents.core\2024.2.426
Then we get:
The type 'ThemableFontFamily' exists in both 'Telerik.Documents.Core, Version=2024.2.426.20, Culture=neutral, PublicKeyToken=5803cfa389c90ce7' and 'Telerik.Windows.Documents.Core, Version=2024.2.426.60, Culture=neutral, PublicKeyToken=5803cfa389c90ce7'
Ambiguous reference.
Candidates are:
Telerik.Documents.Common.Model.ThemableColor
Telerik.Documents.Common.Model.ThemableColor
What is the proper fix for this to reference the version in the WPF app project?