Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!
Field property- Font Size/Alignment arent preserve |
Post Reply |
Author | |
fletchsod
Team Player Joined: 11 Sep 20 Status: Offline Points: 40 |
Post Options
Thanks(0)
Posted: 16 Sep 20 at 7:43PM |
Why does font size & alignment in fields get altered from original (AcroForm fields)? There's nothing in the code that modify the field's properties.
For example, this one AcroForm field property have Font Size set at 10 & is Center aligned. When this PDF get generated, the Font Size end up as 4 & is left aligned. For some reasons, all of those AcroForm fields' properties setting aren't being preserved.
for (int p = 0; p < pdfApp.PageCount(); p++) { // https://developers.foxitsoftware.com/kb/article/programmatically-extract-form-field-data-pdf-files/ // http://www.quickpdf.org/forum/how-to-use-parent-child-fields_topic3702.html pdfApp.SelectPage(p); for (int fieldIX = 0; fieldIX < pdfApp.FormFieldCount(); fieldIX++) { var fieldName = pdfApp.GetFormFieldTitle(fieldIX); if (!string.IsNullOrEmpty(fieldName)) { if (fieldName.EndsWith(".")) // This indicate we have AcroForm field-name duplications. (FoxIt Quick PDF append the "." to it for unknown reasons). { fieldName = fieldName.Substring(0, (fieldName.Length - 1)); } bool isString = true; // Do we really need this? (It is unused here & can be moved inside this "SendDpValuesToPdf" method instead). var fieldResult = _formService.SendDpValuesToPdf(fieldName, formWriter, ref isString); if (fieldResult.Value != null) { var fieldValue = fieldResult.Value; pdfApp.SetFormFieldValue(fieldIX, fieldValue); pdfApp.UpdateAppearanceStream(fieldIX); pdfApp.SetFormFieldDefaultValue(fieldIX, fieldValue); for (int childIX = 0; childIX < pdfApp.GetFormFieldKidCount(fieldIX); childIX++) { var tempIX = pdfApp.GetFormFieldKidTempIndex(fieldIX, childIX); pdfApp.SetFormFieldValue(tempIX, fieldValue); pdfApp.UpdateAppearanceStream(tempIX); pdfApp.SetFormFieldDefaultValue(tempIX, fieldValue); } } } } for (int fieldIX = 0; fieldIX < pdfApp.FormFieldCount(); fieldIX++) { pdfApp.FlattenFormField(fieldIX); // https://www.debenu.com/docs/pdf_library_reference/SetFormFieldReadOnly.php pdfApp.SetFormFieldReadOnly(fieldIX, 1); } } Edited by fletchsod - 16 Sep 20 at 9:31PM |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store