Free Support Forum - aspose.com

Convert XFA to Standard PDF

Hi There

  1. When I Open XFA document and make the existing button invisible and save. Saved XFA PDF I don’t see the button.
  2. When I opened the changed XFA document and save it as Standard PDF, Standard PDF will show button as visible.

following is the code.

Document document = new Document(dataDir + “MBPL01.pdf”);
XmlNamespaceManager nsmgr = new XmlNamespaceManager(document.Form.XFA.XDP.NameTable);
nsmgr.AddNamespace(“tpl”, document.Form.XFA.Template.NamespaceURI);

        Int16 icount = 0;
        foreach (XmlNode field in document.Form.XFA.Template.SelectNodes("//tpl:field", nsmgr))
        {

            if (field.SelectSingleNode("tpl:ui/tpl:button", nsmgr) != null)
            {
                System.Xml.XmlAttribute btnAttr = document.Form.XFA.XDP.CreateAttribute("presence");
                btnAttr.Value = "invisible";
                field.Attributes.Append(btnAttr);
            }              

        }

     document.Save(dataDir);

        document.Dispose();

        Document doc = new Document(dataDir);
        doc.Form.Type = FormType.Standard;

        dataDir = @"C:\WritePDF\Standard_Acro_WithoutBut.pdf";

        doc.Save(dataDir);

@TuanAmith,

Kindly send us your source PDF document. We will investigate your scenario in our environment, and share our findings with you.

MBPL01.pdf (116.2 KB)
Standard_AcroForm_out.pdf (128.4 KB)
Hi imran
i have uploded two PDF files. MBPL01 is the orginal XFA file without any changes and Standard_AcroForm_out.pdf is the file with removed “Save” button.
when i create an standard pdf file with Standard_AcroForm_out.pdf it will show me the removed “save” button.

Thanks

@TuanAmith,

We managed to replicate the said behavior of the button visibility in our environment. It has been logged under the ticket ID PDFNET-44580 in our bug tracking system. We have linked your post to this ticket and will keep you informed regarding any available updates.

Hi Imran

Do you know when I will get a response to above error?

Also, I found another issue with XFA PDF file conversion that is.

When I load the Document object as a MemoryStream and try to convert the file to standard PDF and try to open the file in Acrobat it says “There was an error opening this document. This file cannot be opened because it has no Pages”. But it works fine if I load Document object directly with the file path.

byte[] fileBytes = await content.ReadAsByteArrayAsync();
MemoryStream Mstream = new MemoryStream(fileBytes);
Document document = new Document(Mstream);
document.Form.Type = FormType.Standard;
document.Save(@“C:\ReadPDF\xfaFile.pdf”);

@TuanAmith,

We have tested your scenario with the latest version 18.4 of Aspose.PDF for .NET API, and could not replicate the said problem. Please open this PDF document and let us know how that goes in your environment: xfaFile.pdf (66.5 KB)

Hi Imran

I found out how issue is generated. When I have signature pad installed in my computer and populate XFA form without signing the signature field and then try to convert to standard format. I get this issue where standard PDF generate without pages. When I generate XFA PDF with signature field filled with signature pad it will convert to Standard PDF without any issue.

Thanks

Hi Imran

Please test on this XFA file. This file Signature field is empty.
Thanks

MBPL01_NoSignature.pdf (81.4 KB)

@TuanAmith,

We managed to replicate the said error in our environment. It has been logged under the ticket ID PDFNET-44603 in our bug tracking system. We have linked your post to this ticket and will keep you informed regarding any available updates.

Hi Imran

Will you able to give me a ETA for two tickets which you created. When will I be able to see a fix for second issue ticket 44603. This is a critical one if I can get a fix for this I will be able to create a standard PDF from XFA even when there is no signature in signature fields. If your development team can prioritise these fixes sooner our company can go for licensing of your product.

Thanks & regards,

@TuanAmith,

The linked ticket IDs PDFNET-44580 and PDFNET-44603 have just been identified and could take time because there are other high priority tickets in the queue. We recommend our clients to post their critical issues (or ticket IDs) in the paid support forum. Please refer to this helping link: Aspose support options

Hi Imran

To obtain paid support forum do we have to get product license or is there any other level of paid method we can obtain to use the paid Service. The reason is that two tickets generated in your end are show stoppers for our project, If ASPOSE couldn’t resolve this issue then by getting license will be meaningless unless someone can grantee a fix in your end timely manner.

Thanks & regards,
Tuan

@TuanAmith,

After purchasing the paid support, you can raise the priority of linked ticket IDs PDFNET-44580 and PDFNET-44603. Please note, we don’t grantee about the immediate fix. Furthermore, we will let you know once a reliable estimate is available.

We have created another thread in the Aspose.Purchase forum, one of my fellow workers will assist you soon there. Forum thread:
https://forum.aspose.com/t/how-to-get-the-paid-support/176483