Got "XForm object must represent pdf stream" error while parsing specific pdf files using Aspose.PDF.Net v22.6.0

Got “XForm object must represent pdf stream” errFamz.pdf (235.3 KB)
while parsing attached pdf files.
It only failed on attached files.

version: Aspose.PDF.22.6 for .Net/C#

error message:
System.ArgumentException: XForm object must represent pdf stream.
at Aspose.Pdf.XForm…ctor(#=zBHbPhCWM5m5_rquUytI0YYDwLzd5b8ZiEA== #=z4u8Mi$w7_eZV, Boolean #=z2F24KLM=)
at Aspose.Pdf.XForm…ctor(#=zBHbPhCWM5m5_rquUytI0YYDwLzd5b8ZiEA== #=z4u8Mi$w7_eZV)
at Aspose.Pdf.Annotations.AppearanceDictionary.#=z5$K2zVs=(String #=zsIrBRts=)
at Aspose.Pdf.Annotations.AppearanceDictionary.get_Item(String key)
at Aspose.Pdf.Facades.Form.#=zfMHMzgVBSFG2(WidgetAnnotation #=zaYKpRV8=)
at Aspose.Pdf.Facades.Form.#=zgU_7hrk=(WidgetAnnotation #=zaYKpRV8=)
at Laserfiche.BPMServer.Tests.DocumentServices.Pdf.AsposePdfDebug.Debug(String filePath, String fileName)

sample code to reproduce:
var path = Path.Combine(filePath, fileName);
// Create Form Object
var form = new Aspose.Pdf.Facades.Form();
// Open Document
form.BindPdf(path);
foreach (var fieldName in form.FieldNames.ToList())
{
var type = form.GetFieldType(fieldName);
var facade = form.GetFieldFacade(fieldName);
var value = form.GetField(fieldName);

    Console.WriteLine(type);
    Console.WriteLine(facade.Caption);
    Console.WriteLine(value);
}

@gf4t47

We have logged this problem in our issue tracking system as PDFNET-52094. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

It would be a different error message if switch the sample code order
var type = form.GetFieldType(fieldName);
var facade = form.GetFieldFacade(fieldName);
=>
var facade = form.GetFieldFacade(fieldName);
var type = form.GetFieldType(fieldName);

System.InvalidCastException: Unable to cast object of type ‘#=z7usxSOiZOgmwJ1s6llAcNBNksNXspZJVCQ==’ to type ‘#=zmyKBWDM0wMjrmYB_5UCLrqxlGC44mhZKtg==’.
at #=zZ6lUGLojU6wvByyTys0oP_3swhQa0nMoTkm1NOTxiIhPEFAEdQ==.#=zYqLvF9s=()
at Aspose.Pdf.Operators.SelectFont.#=zJdpj$Vs=(#=zH7ccyGbxhZj8jJl9LKSppqcA6hnPMuQ5RwhKY$h8RqVe #=zsNMNVmI=)
at Aspose.Pdf.Operator…ctor(Int32 #=zGgjhL5M=, #=zH7ccyGbxhZj8jJl9LKSppqcA6hnPMuQ5RwhKY$h8RqVe #=zsNMNVmI=)
at Aspose.Pdf.Operators.TextOperator…ctor(Int32 #=zGgjhL5M=, #=zH7ccyGbxhZj8jJl9LKSppqcA6hnPMuQ5RwhKY$h8RqVe #=zsNMNVmI=)
at Aspose.Pdf.Operators.TextStateOperator…ctor(Int32 #=zGgjhL5M=, #=zH7ccyGbxhZj8jJl9LKSppqcA6hnPMuQ5RwhKY$h8RqVe #=zsNMNVmI=)
at Aspose.Pdf.Operators.SelectFont…ctor(Int32 #=zGgjhL5M=, #=zH7ccyGbxhZj8jJl9LKSppqcA6hnPMuQ5RwhKY$h8RqVe #=zsNMNVmI=)
at #=zZ6lUGLojU6wvByyTys0oP_3swhQa0nMoTkm1NOTxiIhPEFAEdQ==.#=zJjdztSM=(Int32 #=zGgjhL5M=)
at Aspose.Pdf.Operator.#=zkDHJnKU=(Int32 #=zGgjhL5M=, #=zH7ccyGbxhZj8jJl9LKSppqcA6hnPMuQ5RwhKY$h8RqVe #=zsNMNVmI=)
at Aspose.Pdf.Annotations.DefaultAppearance.#=z9dHfHP4=(#=zPG$JvF_hMEVmEDdLmIWeznCHLAmZXjJ7dQ== #=zj0qfgxL99OnGykRZKg==)
at Aspose.Pdf.Annotations.DefaultAppearance…ctor(#=zPG$JvF_hMEVmEDdLmIWeznCHLAmZXjJ7dQ== #=zj0qfgxL99OnGykRZKg==)
at Aspose.Pdf.Annotations.WidgetAnnotation.get_DefaultAppearance()
at Aspose.Pdf.Facades.Form.GetFieldFacade(String fieldName)

Also under Aspose.PDF v19.2, the same code/file cause a null reference error
System.NullReferenceException: Object reference not set to an instance of an object.
at Aspose.Pdf.Facades.Form.#=zJJUbGMM4rmLF(WidgetAnnotation #=zhE5o5Lw=)
at Aspose.Pdf.Facades.Form.#=zOccM2mo=(WidgetAnnotation #=zhE5o5Lw=)

Hope those information would help.

@gf4t47

We have logged this detail in our issue tracking system. We will inform you once there is an update available on this issue.

The issues you have found earlier (filed as PDFNET-52094) have been fixed in Aspose.PDF for .NET 23.5.

Hello Aspose,

I have the same problem with the Java variant. Is it fixed for Java too?
Thank you and best regards

Otto

@otto.eisenschmid

Yes, every fix is ported into equivalent version of Aspose.PDF for Java. You can please try using it and let us know if issue still persists.