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)
@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)
@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
@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.
@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.
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.