Unplanned
Last Updated: 03 Jun 2020 14:01 by ADMIN
Hector
Created on: 30 Jul 2019 20:25
Category: PdfProcessing
Type: Bug Report
2
PdfProcessing: TextBox widget appearance is exported with wrong text properties when recalculated
Importing document containing TextBox widgets with NormalContentSource defining text properties, such as FontSize and Position, are exported with incorrect appearance when the value of the field is modified.
4 comments
ADMIN
Georgi
Posted on: 03 Jun 2020 14:01

Hi Hector,

I am sorry to hear that you are experiencing issues because of the missing functionality.

We prioritize the items in our backlog by customer demand and review them on a regular basis. This way we ensure that the most demanded items will be delivered. I have increased the priority of this item, however, I cannot commit to a specific time-frame when it will be delivered.

A possible workaround would be to apply the text properties after the widget appearance is recalculated using the original TextFragment instance. For example:

foreach (FormField field in pdfDocument.AcroForm.FormFields)
{
    if (field is TextBoxField textBoxField)
    {
        List<TextFragment> oldTextFragments = new List<TextFragment>();
        foreach (VariableContentWidget widget in textBoxField.Widgets)
        {
            oldTextFragments.Add(widget.Content.NormalContentSource.Content.Where(f => f is TextFragment).Cast<TextFragment>().First());
        }

        textBoxField.Value = "New value";

        int index = 0;
        foreach (VariableContentWidget widget in textBoxField.Widgets)
        {
            widget.RecalculateContent();
            TextFragment newTextFragment = widget.Content.NormalContentSource.Content.Where(f => f is TextFragment).Cast<TextFragment>().First();

            TextFragment oldTextFragment = oldTextFragments[index++];
            newTextFragment.Font = oldTextFragment.Font;
            newTextFragment.FontSize = oldTextFragment.FontSize;
            newTextFragment.CharacterSpacing = oldTextFragment.CharacterSpacing;
            newTextFragment.Fill = oldTextFragment.Fill;
            newTextFragment.Stroke = oldTextFragment.Stroke;
            newTextFragment.StrokeThickness = oldTextFragment.StrokeThickness;
            newTextFragment.HorizontalScaling = oldTextFragment.HorizontalScaling;
            newTextFragment.Position = oldTextFragment.Position;
            newTextFragment.MiterLimit = oldTextFragment.MiterLimit;
        }
    }
}

Let me know how this approach applies to your scenario.

Regards,
Georgi
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Hector
Posted on: 27 May 2020 14:01
I've been following this item. If there are no plans to fix this in the near future, then I need a way to work around this issue. I am ok with meddling with reflection as I needed to do this to address some of the other PdfProcessing issues until they got fixed.
ADMIN
Martin
Posted on: 27 May 2020 07:08

Hello Hector,

I apologize for the inconvenience this issue might be causing you. It is still not scheduled for implementation as the development team is working on more demanding tasks. Please, make sure you are following this public item so you can receive an update when its status changes.

Regards,
Martin
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Hector
Posted on: 26 May 2020 21:36
Submitted nearly a year ago. Any improvements on this? This is one of the big reasons why we haven't adopted your PDF library.