We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Reading Field property to find if the Field is printable

Hello,

I am testing this new FormEditor.GetFieldAppearance(fieldName) method (in Facades) feature in Aspose.Pdf for .NET 7.5.0 for the ability to retrieve the Field property if it is printable.




I have a few pdf forms to test against this.
  • 1 form the whole page is printable (File --> Properties --> Security tab --> Document Restrictions Summary --> Printing allowed).
  • 1 form the page is (File --> Properties --> Security tab --> Document Restrictions Summary --> Printing: Not Allowed)
  • 1 form just at the field level, (right click field --> Properties --> General --> Common Properties --> Form Field ---> Visible but doesn't print).
  • 1 form at the field level I have (right click field --> Properties --> General --> Common Properties --> Form Field ---> "hidden, but printable")
Based on the code snippet from the thread, for all these the method returns "Default" for me except the last one gives me the ArgumentException was unhandled because it could not find the field.

I looked for updated api documentation for possible expected results, but could not find the updated documentation for this feature.

I could understand the 1st 2 tests would return default, but not sure about the 3rd example. Any insight?

Thanks.

Hello, I haven’t heard back, but maybe rephrasing what I’m looking for might help.


What would the expected return result be when I call FormEditor.GetFieldAppearance(fieldName) for a pdf form with a field whose form field is “visible but not printable”?

Based on the Annotation flag enum could it be any of these?

Invisible, Hidden, Print, NoZoom, NoRotate, NoView, ReadOnly, Locked, ToggleNoView, LockedContents.

I don’t think “Default” would be expected? I’m getting Default though not sure why.

How about for “Hidden, but Printable”? Should I be getting “Hidden” returned back? I’m also getting “Default.” in this case

Here’s some code snippet if you think it would help.
string UnPrintablePdfPath = @“D:\xxxxx\TestNotPrintableField.pdf”;

Aspose.Pdf.InteractiveFeatures.Annotations.AnnotationFlags expectedResults, actualResults;

//test notprintable doc
Aspose.Pdf.Document doc2 = new Aspose.Pdf.Document(UnPrintablePdfPath);
Aspose.Pdf.Facades.FormEditor form2 = new Aspose.Pdf.Facades.FormEditor();
form2.BindPdf(doc2);

//visible but not printable
expectedResults = Aspose.Pdf.InteractiveFeatures.Annotations.AnnotationFlags.Hidden;
actualResults = form2.GetFieldAppearance(“Corporation name”); //textbox
Assert.AreEqual(expectedResults, actualResults);

Thanks in advance for your help!

Hi Anthony,


Sorry for the delayed response.

I have gone through your requirement and in order for us to fully test this behavior, we would be requiring the source PDF file. Can you please share the sample PDF document. We are sorry for this inconvenience.

Absolutely! A pdf file that can be tested with the code in my previous post is attached.

Hi Anthony,

Thanks for providing additional information. Unfortunately while using Adobe Reader 11.0, I couldn't view field properties, as you described in your post. Can you please share the product detail you are using for the purpose?

Sorry for the inconvenience faced.

Best Regards

Hello,

Please try Adobe Acrobat XI not Reader.

Right click on the pdf file and choose "Edit with Adobe Acrobat"

You should then be able to hover over those fields and right click to their properties.

Hi Anthony,


Thanks for sharing the details.

I have tested the scenario and I am able to reproduce the same issue that the value Default is being returned for many form fields. However when I have tried getting properties against “txtFormPreparedBy” field present on first page, the value being returned is Print, NoView, which seems to be correct. But the values for other fields being returned is Default which is not correct. For
the sake of correction, I have logged it in our issue tracking system as
PDFNEWNET-34698. We
will investigate this issue in details and will keep you updated on the status
of a correction.

We
apologize for your inconvenience.

Thanks Nayyer.

Is it possible you can tell me the values for txtCity? I think that one is setup as Visible, but does not print

aortega527:
Is it possible you can tell me the values for txtCity? I think that one is setup as Visible, but does not print
Hi Anthony,

When I have tried retrieving the properties of txtCity field (3rd last field on last page), the property being returned it Default. In the event of any further query, please feel free to contact.

Hi Anthony,


We have further investigated the issue PDFNEWNET-34698 and following are our observations. Field properties is set of flags (“Hidden”, “Print”, etc.)

  • txtFormPreparedBy field is printable but not visible that’s why “Print, NoView” flags are set.
  • txtCity field is visible but not printable. That’s why these flags are not set.

AnnotationFlags.Default value means that no flags are set (i.e. 0). The “Default” for txtCity field means that just no flags set for this field which is correct.