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);
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=)
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.