Unplanned
Last Updated: 26 Aug 2024 09:09 by Henrik
Unplanned
Last Updated: 23 Aug 2024 12:55 by Patrick
While parsing the Post table of a specific font file on export an exception is thrown: InvalidOperationException: 'Position is out of range.'
Unplanned
Last Updated: 20 Aug 2024 12:29 by Camila

SkiaImageFormatProvider: Add support for Text, TextMarkup, Line, and Stamp annotations.

Currently, these annotations are omitted on image export.

Unplanned
Last Updated: 06 Aug 2024 08:09 by Peg
The expected behavior is to iterate all the pages in a PDF document, export each page's content to an image and combine all the images in a common multipage TIFF image.
Unplanned
Last Updated: 30 Jul 2024 14:14 by Mathew

This is the code for inserting the image: 

        static void Main(string[] args)
        {
            FixedExtensibilityManager.ImagePropertiesResolver = new ImagePropertiesResolver();

            //Telerik.Windows.Documents.Extensibility.JpegImageConverterBase defaultJpegImageConverter = new Telerik.Documents.ImageUtils.JpegImageConverter();
            //Telerik.Windows.Documents.Extensibility.FixedExtensibilityManager.JpegImageConverter = defaultJpegImageConverter;

            //Output("fyb-64.png", "output-working.pdf");
             Output("fyb.png", "output-broken.pdf");
        }
        private static void Output(string resourceName, string outputFileName)
        {
            var document = new RadFixedDocument();
            using (var editor = new RadFixedDocumentEditor(document))
            {
                Stream image = new FileStream(resourceName, FileMode.Open);

                var table = new Table
                {
                    LayoutType = TableLayoutType.FixedWidth,
                    Margin = new Thickness(10, 0, 0, 0),
                };

                var row = table.Rows.AddTableRow();
                var cell = row.Cells.AddTableCell();
                var block = cell.Blocks.AddBlock();
                block.InsertImage(image);
                editor.InsertTable(table);

                var pdfData = ExportToPdf(document);
                File.Delete(outputFileName);
                File.WriteAllBytes(outputFileName, pdfData);

                Process.Start(new ProcessStartInfo() { FileName = outputFileName, UseShellExecute = true });
            }
        }

        private static byte[] ExportToPdf(RadFixedDocument document)
        {
            byte[] pdfData;

            using (var ms = new MemoryStream())
            {
                var pdfFormatProvider = new PdfFormatProvider();
                pdfFormatProvider.Export(document, ms);
                pdfData = ms.ToArray();
            }

            return pdfData;
        }

Workaround: Instead of setting the ImagePropertiesResolver, set the JpegImageConverter: 

            Telerik.Windows.Documents.Extensibility.JpegImageConverterBase defaultJpegImageConverter = new Telerik.Documents.ImageUtils.JpegImageConverter();
            Telerik.Windows.Documents.Extensibility.FixedExtensibilityManager.JpegImageConverter = defaultJpegImageConverter;

Unplanned
Last Updated: 30 Jul 2024 06:22 by Rodney

Search for specific text in a PDF document  and you will notice that if the document is landscape, the SearchResult.GetWordBoundingRect method may return incorrect results. If the document is Portrait, the exact results are highlighted with the code snippet below: 

            PdfFormatProvider provider = new PdfFormatProvider();
            RadFixedDocument document = provider.Import(File.ReadAllBytes("Landscape.pdf"));

                TextSearch searchText = new TextSearch(document);
                TextSearchOptions searchOptions = new TextSearchOptions { UseRegularExpression=false, CaseSensitive=false, WholeWordsOnly = true };
                IEnumerable<SearchResult> matchResults = searchText.FindAll("sed", searchOptions);
                foreach (SearchResult resultItem in matchResults)
                {
                    Rect rect = resultItem.GetWordBoundingRect();

                   
                    RadFixedPage page = resultItem.GetResultPage();
                    FixedContentEditor editor = new FixedContentEditor(page);
                 
                    editor.GraphicProperties.FillColor = new RgbColor(125, 255, 0, 0);
                    editor.DrawRectangle(rect);
                }
            
            string outputFilePath = "result.pdf";
            File.Delete(outputFilePath);
            File.WriteAllBytes(outputFilePath, provider.Export(document));
            Process.Start(new ProcessStartInfo() { FileName = outputFilePath, UseShellExecute = true });

Landscape: wrong rectangles are highlighted

Portrait: correct rectangles are highlighted:

 

Unplanned
Last Updated: 29 Jul 2024 12:11 by ADMIN
Part of the stack trace: 
System.OutOfMemoryException: Insufficient memory to continue the execution of the program.
   at System.Text.StringBuilder.ExpandByABlock(Int32 minBlockCharCount)
   at System.Text.StringBuilder.AppendWithExpansion(Char value)
   at System.Text.StringBuilder.Append(Char value)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Utilities.CrossReferenceCollectionReader.GetAllText(Reader reader, Int64 minOffset, Int64 maxOffset)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Utilities.CrossReferenceCollectionReader.FindAllObjectOffsets(Reader reader, Dictionary`2 tokenToOffsets, Int64 minOffset, Int64 maxOffset)
Unplanned
Last Updated: 19 Jul 2024 10:42 by Lucas

NullReferenceException is thrown when Find API is used on a newly created document.

Workaround: Export - Import the document before using the Find API

PdfFormatProvider pdfFormatProvider = new PdfFormatProvider();
byte[] exportedDocument = pdfFormatProvider.Export(document);
document = pdfFormatProvider.Import(exportedDocument);

 

Unplanned
Last Updated: 18 Jul 2024 08:46 by Joe

Encoding table headers are preserved when creating subsets.

Unplanned
Last Updated: 09 Jul 2024 14:30 by ADMIN
In version 1 there are three profiles that have different levels of detail in their structure: Basic (B), Comfort (C) and Extended (X): https://mind-forms.de/e-rechnung/welches-zugferd-profil-kann-ich-verwenden/ 
Unplanned
Last Updated: 24 Jun 2024 08:45 by Graham
Created by: Graham
Comments: 0
Category: PdfProcessing
Type: Bug Report
0

As a result of the below missing operator, some of the glyphs can't be extracted from the CFFFontTable and the characters are not displayed in the PdfViewer:

The end user result is missing letter from the PDF content.

Unplanned
Last Updated: 20 Jun 2024 09:21 by ADMIN
ADMIN
Created by: Deyan
Comments: 2
Category: PdfProcessing
Type: Feature Request
6
Square annotation displays a rectangle on the page. When opened, it displays a pop-up window containing the text of the associated note.
Unplanned
Last Updated: 04 Jun 2024 10:34 by Kishan
Improve performance of Block.Measure for large chunks of text.
Unplanned
Last Updated: 03 Jun 2024 13:05 by Lorrie
Currently, the SkiaImageFormatProvider considers the RadFixedPage.Size when creating the image. If the RadFixedPage.CropBox is specified, the developer can control what rectangle of the page to be displayed/printed. However, it is not considered when exporting to an image. Improving the SkiaImageFormatProvider to respect the CropBox as well will give the opportunity to crop just a certain region of the PDF page and save it as an image.
Unplanned
Last Updated: 21 May 2024 08:22 by ADMIN
ADMIN
Created by: Deyan
Comments: 18
Category: PdfProcessing
Type: Feature Request
35
Add support for documents containing RTL (right-to-left) text.
Unplanned
Last Updated: 20 May 2024 07:23 by ADMIN
Embedding a TrueType font collection using the FontsRepository.RegisterFont method leads to glyphs with empty outlines collection. The missing outlines are caused due to an empty glyf and loca tables of the TrueType font file.
Unplanned
Last Updated: 17 May 2024 13:59 by Axel
Example: 
16 0 obj
<</AP<</N<</Off null/On 188 0 R>>/D<</Off 189 0 R/On 190 0 R>>>>/AS/Off/F 4/FT/Btn/H/T/P 19 0 R/Rect[ 40.3 690.45 56.15 706.7999]/Subtype/Widget/T(Einraeumung:Grabnutzungsrechts)/Type/Annot>>
endobj

 
Unplanned
Last Updated: 13 May 2024 07:15 by Frank

PdfProcessing: Handle merge of documents containing fields with the same invalid name.

Unplanned
Last Updated: 26 Apr 2024 08:37 by ADMIN

When calling a PDF export in a high-concurrency environment the internal state can get corrupted because it uses a non-thread safe collection internally.

Sample code:

void WriteToPdf(RadFlowDocument document, Stream outputStream) {

   PdfFormatProvider pdfWriter = new() {};

   pdfWriter.Export(document, outputStream);
}

When calling it like this:

Parallel.ForEachAsync(listOfDocuments, (document, _) => {
   WriteToPdf(document, Stream.Null);
});

An exception may occur:

System.InvalidOperationException: Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.
   at System.Collections.Generic.Dictionary`2.FindValue(TKey key)
   at Telerik.Windows.Documents.Fixed.Model.Fonts.FontsRepository.TryCreateFont(FontFamily fontFamily, FontStyle fontStyle, FontWeight fontWeight, FontBase& font)
   at Telerik.Windows.Documents.Flow.FormatProviders.Pdf.Utils.Extensions.CopyPropertiesFrom(CharacterProperties fixedProperties, PdfExportContext context, CharacterProperties properties)
   at Telerik.Windows.Documents.Flow.FormatProviders.Pdf.Export.PdfExporter.CreateListLevel(ListLevel flowLevel)
   at Telerik.Windows.Documents.Flow.FormatProviders.Pdf.Export.PdfExporter.CreateList(List flowList)
   at Telerik.Windows.Documents.Flow.FormatProviders.Pdf.Export.PdfExporter.ExportDocument(RadFlowDocument document, RadFixedDocumentEditor editor)
   at Telerik.Windows.Documents.Flow.FormatProviders.Pdf.Export.PdfExporter.ExportInternal()
   at Telerik.Windows.Documents.Common.FormatProviders.FormatProviderBase`1.Export(T document, Stream output)
   at xxxxx.Application.Common.PdfGeneration.PdfWriter.WriteToPdf(RadFlowDocument document, Stream outputStream) 

The state is then corrupted forever, until the application is restarted.

Realistic scenario where this is also reproduced: Web application that generates PDFs and is called concurrently.

 

Unplanned
Last Updated: 18 Apr 2024 05:36 by Sujith

This is the code snippet for reproducing the error message: 

        static void Main(string[] args)
        {
            string filePath = "Lorem ipsum dolor sit amet.pdf";
            //load a random document
            PdfFormatProvider provider = new PdfFormatProvider();
            RadFixedDocument originalDocument;
            using (Stream stream = File.OpenRead(filePath))
            {
                originalDocument = provider.Import(stream);
            }
            //draw something on the first page
            FixedContentEditor editor = new FixedContentEditor(originalDocument.Pages[0]);
            editor.GraphicProperties.IsFilled = true;
            editor.GraphicProperties.FillColor = RgbColors.Black;
            Telerik.Documents.Primitives.Rect Rect = new Telerik.Documents.Primitives.Rect(10, 10, 200, 100);
            editor.DrawRectangle(Rect);

            //export the pages as images and build a brand new document from the images
            SkiaImageFormatProvider imageProvider = new SkiaImageFormatProvider();
            imageProvider.ExportSettings.ImageFormat = SkiaImageFormat.Jpeg;
            imageProvider.ExportSettings.ScaleFactor = 0.8;
            imageProvider.ExportSettings.Quality = 80;


            RadFixedDocument doc = new RadFixedDocument();
            foreach (RadFixedPage page in originalDocument.Pages)
            {
                byte[] resultImage = imageProvider.Export(page);
                RadFixedPage pdfpage = doc.Pages.AddPage();
                editor = new FixedContentEditor(pdfpage);
                Stream imageStream = new MemoryStream(resultImage);
                editor.DrawImage(imageStream);
            }

            //export the pdf built from the images
            PdfFormatProvider pdfFormatProvider = new PdfFormatProvider();
            string outputPdf = @"output.pdf";
            File.Delete(outputPdf);
            using (Stream output = File.OpenWrite(outputPdf))
            {
                pdfFormatProvider.Export(doc, output);
            }
            Process.Start(new ProcessStartInfo() { FileName = outputPdf, UseShellExecute = true });
        }

Workaround:

        static void Main(string[] args)
        {
            string filePath = "Lorem ipsum dolor sit amet.pdf";
            //load a random document
            PdfFormatProvider provider = new PdfFormatProvider();
            RadFixedDocument originalDocument;
            using (Stream stream = File.OpenRead(filePath))
            {
                originalDocument = provider.Import(stream);
            }
            //draw something on the first page
            FixedContentEditor editor = new FixedContentEditor(originalDocument.Pages[0]);
            editor.GraphicProperties.IsFilled = true;
            editor.GraphicProperties.FillColor = RgbColors.Black;
            Telerik.Documents.Primitives.Rect Rect = new Telerik.Documents.Primitives.Rect(10, 10, 200, 100);
            editor.DrawRectangle(Rect);

            using (Stream output = File.OpenWrite(filePath))
            {
                provider.Export(originalDocument, output);
            }

            using (Stream stream = File.OpenRead(filePath))
            {
                originalDocument = provider.Import(stream);
            }
            //export the pages as images and build a brand new document from the images
            SkiaImageFormatProvider imageProvider = new SkiaImageFormatProvider();
            imageProvider.ExportSettings.ImageFormat = SkiaImageFormat.Jpeg;
            imageProvider.ExportSettings.ScaleFactor = 0.8;
            imageProvider.ExportSettings.Quality = 80;


            RadFixedDocument doc = new RadFixedDocument();
            foreach (RadFixedPage page in originalDocument.Pages)
            {
                byte[] resultImage = imageProvider.Export(page);
                RadFixedPage pdfpage = doc.Pages.AddPage();
                editor = new FixedContentEditor(pdfpage);
                Stream imageStream = new MemoryStream(resultImage);
                editor.DrawImage(imageStream);
            }

            //export the pdf built from the images
            PdfFormatProvider pdfFormatProvider = new PdfFormatProvider();
            string outputPdf = @"output.pdf";
            File.Delete(outputPdf);
            using (Stream output = File.OpenWrite(outputPdf))
            {
                pdfFormatProvider.Export(doc, output);
            }
            Process.Start(new ProcessStartInfo() { FileName = outputPdf, UseShellExecute = true });
        }

1 2 3 4 5 6