We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How can I determine if a PDF has XFA in it?

Thread ID:

Created:

Updated:

Platform:

Replies:

145735 Jul 4,2019 06:26 PM UTC Mar 10,2021 03:12 PM UTC Xamarin.Forms 4
loading
Tags: PDF
Will Autio
Asked On July 4, 2019 06:30 PM UTC

Well, that is about it. When our app gets a pdf, I'd like to be able to check if it has XFA forms within it. How can I do that?


  PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument(filePath); 
            //Get the loaded XFA form. 
            PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm; 

but .XfaForm nolonger seems to be valid.

Thanks!

Surya Kumar [Syncfusion]
Replied On July 8, 2019 12:22 PM UTC

Hi Will, 

Greetings from Syncfusion. 

At present we do not have support for determining if the PDF document is XFA enabled, but we have support for filling XFA form fields along with Acroform in the same API. Documentation link for the same can be found in below link: 
UG link : 

Could you please let us know what is your exact need for identifying XFA form documents so that we can assist you better. 

Regards, 
Surya Kumar 


Scott Barber
Replied On March 8, 2021 12:37 AM UTC

Hi there, we have recently found ourselves in this situation.

We have a solution which flattens PDFs which are uploaded from users system. Unfortunately it's possible that the user can upload an XFA form. We would like to be able to detect if it is of this type so we can call the flatten XFA function.

Thanks!

Sowmiya Loganathan [Syncfusion]
Replied On March 8, 2021 12:09 PM UTC

Hi Scott,   

We have analyzed your requirement “Detect XFA form in the given PDF document” and at present we do not have support for this. Currently we are validating on this and will update the further details on March 10, 2021.   

Regards,  
Sowmiya Loganathan 


Sowmiya Loganathan [Syncfusion]
Replied On March 10, 2021 03:12 PM UTC

Hi Will,  
 
On our further analysis ,we can able find the document contains XFAForm or not in sample level using below workaround. 
Please refer the below code snippet, 
        private bool IsXFADocument(string filePath) 
        { 
            bool isXfa = false; 
 
            PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument(filePath); 
            //Get the loaded XFA form.  
 
            PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm; 
 
            int count = loadedForm.Fields.Count; 
 
            loadedDocument.Close(); 
            //If the loaded field count is greater than zero then its a XFA document.  
            if (count > 0) 
                isXfa = true; 
            return isXfa;        
        }  
 
Kindly try the above solution in your end and Let us know, if you need any further information in this. 
 
Regards, 
Sowmiya Loganathan 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon