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?
I am doing some document processing and want to use Telerik to display and edit. I need access to the paraId and textId elements of the docx "document" XML. I have explored the object model in the debugger and do not see these attributes. Are they available in the imported model?
Thanks.