PDF forms content not adjusting after zoom/resize

Hello,

I have a problem using the Aspose.Pdf.Facades.PdfPageEditor(), modifying the Zoom does not scale/position the content of the forms properly. (Using Aspose.PDF.Drawing 24.3.0 with .net 8)
Opening the resulting attached file in Acrobat Reader the form text content is not properly sized/positioned in the box.
Test form zoom problem after zoom.pdf (683.2 KB)

Test form zoom problem original.pdf (696.3 KB)
image.png (41.3 KB)

Is there any possible workaround or fix to make the content properly scaled/visible?

Thanks

@gwert
When I open the document you attached in Adobe Acrobat Pro and Google Chrome, I do not have the same effects as in the image you provided.
123.png (96.3 KB)

What PDF viewer are you using?

1 Like

@sergei.shibanov
Thank you for checking this.
I’m using Adobe Acrobat Pro 2024.002.20965 (64-bit) on Windows 11
image.png (49.3 KB)
I’ve tested this in Chrome, Edge, Firefox, PDFescape and it indeed does not have the same effect when it renders.

Are you using any special settings in Adobe? I’m not seeing in your image the form edit overlay

Do you know what might be causing this?

@gwert
I use Acrobat Pro 2023, without any special settings.
Acrobat vers.png (4.6 KB)

Did I understand you correctly that the effect showed in the attached image is observed only with it?

@sergei.shibanov
Correct. Although I haven’t tried multiple versions of Adobe. But so far I only seen it on that. And it’s the latest version available.

@gwert
I’ll try to look for an opportunity to open the attached document in Acrobat 2024, but I suggest you open it and look at someone with a different version of Acrobat to get more complete information.

@sergei.shibanov

I’ve tried searching for an installer of the Adobe Acrobat 2023 version unfortunately I cannot find anywhere on the official support pages.

I also found this post on the Adobe community specifying that even after they contacted the support there is no full offline installer download link of the 2023 version chain only updates : https://community.adobe.com/t5/acrobat-discussions/acrobat-dc-2023-installer-download/td-p/14715018

Thank you

@gwert
Unfortunately, I also did not find anyone working with Acrobat 2024. Maybe I should write to Adobe and ask them about this?

@sergei.shibanov
Yes, that would be great. I think the Adobe 2023 can be updated to the latest version? The 2024 version you can always download.

@gwert
I can’t update to version 2024 (I can’t tell the reasons), but I reproduced a similar effect for the attached document when opening it in Acrobat 11 Pro.
Please attach the code you use so that I can fully reproduce this issue.

@sergei.shibanov

using Aspose.Pdf;
using Aspose.Pdf.Facades;

var document = new Document("test.pdf");

var pdfFileEditor = new PdfPageEditor(document)
{
    Zoom = 0.9f,
    VerticalAlignmentType = VerticalAlignment.Center,
    HorizontalAlignment = HorizontalAlignment.Center,
};

pdfFileEditor.ApplyChanges();

document.Save("test out.pdf");

@gwert
I found the reason.
In the fields of the attached document, the font size in Default Appearance is set to zero. This means that the viewer application itself determines what font size to display the text.
(this is the corresponding fragment from the pdf specification
DA_FontSize0.png (97.6 KB))
You can explicitly set the font size in Default Appearance and there will be no such effect.

var document = new Document(dataDir + "Test form zoom problem original.pdf");

var pdfFileEditor = new PdfPageEditor(document)
{
    Zoom = 0.9f,
    VerticalAlignmentType = VerticalAlignment.Center,
    HorizontalAlignment = HorizontalAlignment.Center,
};

pdfFileEditor.ApplyChanges();

Console.WriteLine("document.Form.Fields[1].DefaultAppearance.FontSize:" + document.Form.Fields[0].DefaultAppearance.FontSize);
Console.WriteLine("document.Form.Fields[2].DefaultAppearance.FontSize:" + document.Form.Fields[1].DefaultAppearance.FontSize);

document.Form.Fields[0].DefaultAppearance = new DefaultAppearance("Arial", 10, System.Drawing.Color.Blue);
document.Form.Fields[1].DefaultAppearance = new DefaultAppearance("Arial", 12, System.Drawing.Color.Black);

document.Save(dataDir + "testZoom-out.pdf");

You can also write to Adobe, attaching the resulting document and indicating the regression relative to Acrobat 2023.

1 Like