Problems with PushButtons and FormFieldFacade

I’m attempting to add a “Print Certificate” push button on my PDF but I’ve run into a couple of problems:

1. When the AddField is done without decorating, the text is rotated at 90 by default
2. When I use a FormFieldFacade to decorate my PushButton field, the formatting works but the text of the button and it’s javascript commands are lost, rendering the button useless.

Here’s my code snippet:

Dim editorObject As New FormEditor(outputStream, outputStream2) 'memory streams, outputStream has the certificate file
editorObject.AddField(FieldType.PushButton, “btnPrint”, “Print Certificate”, 1, 775, 610, 625, 580)
editorObject.Save()
outputStream2.Seek(0, SeekOrigin.Begin)

editorObject = New FormEditor(outputStream2, outputStream)
editorObject.SetFieldScript(“btnPrint”, “this.print();”)
editorObject.SetFieldAppearance(“btnPrint”, AnnotationFlag.VisibleButNotPrint)
editorObject.Save()
outputStream.Seek(0, SeekOrigin.Begin)

’ *** if I return the contents of outputStream here, I get a valid pushbutton with rotated 90 text but good javascript
'Return outputStream.GetBuffer()

’ Decorate the button
editorObject = New FormEditor(outputStream, outputStream2)
Dim facade As FormFieldFacade = New FormFieldFacade()
facade.BackgroudColor = System.Drawing.Color.Yellow
facade.TextColor = System.Drawing.Color.Red
facade.Alignment = FormFieldFacade.AlignCenter
facade.Rotation = 0

editorObject.Facade = facade
editorObject.DecorateField(“btnPrint”)
editorObject.Save()
outputStream2.Seek(0, SeekOrigin.Begin)

Return outputStream2.GetBuffer() ’ this returns a formatted pushbutton with no text and no javascript, so I can’t even tell if the rotation was corrected, either.



Any ideas?

Hi Steve,

Thank you very much for considering Aspose.

We’re looking into the matter, however it’ll be helpful in investigating the problem that you share the PDF file you’re having problem with. You can attach the file with this forum.

We appreciate your patience and cooperation.
Regards,

I’m fairly certain this behavior works with any PDF but I’m using the attached PDF in particular, as it’s the template PDF for creating certificates on our website. I’ve attached the PDF at the state where the form fields were filled and then flattened, so all I need to do is add a “Print Certificate” button in the upper right-hand corner.

Hi Steve,

This issue has been logged as PDFKITNET-10196 in our issue tracking system. Our development team will be looking into the matter in detail and you’ll be updated via this forum as the issue is resolved.

We’re sorry for the inconvenience.
Regards,

Any update on the fix for this? I don’t see that this issue has been referred to in any release notes. An ETA would be nice…

Hi Steve,

I’m sorry that the ETA for this issue is not yet available.Our team is looking into this issue and you’ll be updated as some estimation is available.

We’re sorry for the inconvenience.
Regards,