Converting from XFA dynamic pdf to Normal PDF

Hi i am Using Aspose_PDF .Net 20.9 where i am converting from XFA Dynaminc pdf to Normal pdf containng more then 1 pages in each pdf. It is not getting converted into Normal pdf and Exception have been caught. COuld you please look into it on urgent priority. for only 1 page dynamic pdf having 2 fields it is converting successfully for 1 PDF having multple pages is not getting converted attached 2 sample file. COnverted success and Not convrtedpdf

below code is used

 try
            {
                // ExStart:DynamicXFAToAcroForm
                // The path to the documents directory.
                string dataDir = @"D:\\XFA\\Input\\";
                string dataDirDESC = @"D:\\XFA\\Output\\";
                // Load dynamic XFA form
                //Console.WriteLine("Loading XFA PDF");
               // string dataDir = RunExamples.GetDataDir_AsposePdf_Forms();

                // Load dynamic XFA form
                Document document = new Document(dataDir + "Mandate.pdf");

                // Set the form fields type as standard AcroForm
                //document.Form.SignDependentElementsRenderingModeWhenConverted = Aspose.Pdf.Forms.Form.SignDependentElementsRenderingModes.RenderFormAsSigned;
                document.Form.Type = FormType.Standard;
                document.Flatten();

                dataDirDESC = dataDirDESC + "Standard_AcroForm_out2.pdf";
                // Save the resultant PDF
                //document = new Document(dataDirDESC);
                document.Save(dataDirDESC);
               // document = new Document(dataDirDESC);
                // ExEnd:DynamicXFAToAcroForm
                Console.WriteLine("\nDynamic XFA form converted to standard AcroForm successfully.\nFile saved at " + dataDirDESC);
                Console.WriteLine(document.Form.Type);
                            }    
           catch(Exception excep)
            {
                excep.GetBaseException();
                Console.WriteLine("Exception Caught");

            }
       
           }

convrtedpdf.pdf (554.9 KB)
NOT_convrtedpdf.pdf (1.8 MB)

@bablugupta059

Could you please share which type of exception you are facing while converting XFA to Standard Acroform using API. We tested the scenario in our environment and were not able to notice any exception. However, we noticed that the output document had formatting issues and was not converted correctly.

Therefore, we have logged an issue as PDFNET-48773 in our issue tracking system. We will further look into its details and keep you posted with the status of its rectification. Please be patient and spare us some time.

We are sorry for the inconvenience.

Hi Ali,

Thanks for your response. I have requested License file and issue was not there but i saw original Dynamic file is of 4 pages and after converting it changed to 2 pages i have attached both sample file here;below is the code snippet, we are about to purchase the license once this POC is success , please help us to evaluate and making decision to go further for purchase. if it doesn’t work we are afraid to go ahead.

// Initialize license object
Aspose.Pdf.License license = new Aspose.Pdf.License();
// Set license
license.SetLicense(licensefile);
Console.WriteLine(“License set successfully.”);
// Load dynamic XFA form
Document document = new Document(dataDir + “OriginalDynamicFile.pdf”);

            // Set the form fields type as standard AcroForm
            //document.Form.SignDependentElementsRenderingModeWhenConverted = Aspose.Pdf.Forms.Form.SignDependentElementsRenderingModes.RenderFormAsSigned;
            //for (int pagecount = 1; pagecount <= document.Pages.Count; pagecount++)
            //{
                document.Form.Type = Aspose.Pdf.Forms.FormType.Standard;
                //  document.Flatten();

                dataDirDESC = dataDirDESC + "6017675 - Dynamic form-Converted.pdf";
                // Save the resultant PDF
                //document = new Document(dataDirDESC);
                document.Save(dataDirDESC);
                // document = new Document(dataDirDESC);
                // ExEnd:DynamicXFAToAcroForm
                Console.WriteLine("\nDynamic XFA form converted to standard AcroForm successfully.\nFile saved at " + dataDirDESC); 

6017675 - Dynamic form-Converted.pdf (1.8 MB)
NOT_convrtedpdf.pdf (1.8 MB)

@bablugupta059

We have already noticed this issue in our environment and all details have been logged within the ticket which we shared with you. We will let you know as soon as it is resolved. Please give us some time.

We apologize for the inconvenience.

thanks ,we will wait for your response

Thnaks
Bablu