Error converting VSDX file to PDF/A

MO.00004-AX.04-Triptico.vsdx.zip (752.5 KB)

When trying to convert the file MO.00004-AX.04-Triptico.vsdx to PDF/A, an error occurs. Testing the conversion to PDF it works.

PdfSaveOptions options = new PdfSaveOptions();
options.SaveFormat = SaveFileFormat.Pdf;

if (ConversionConfiguration.IsPDFA)
{
options.Compliance = PdfCompliance.PdfA1a;
}
ConvertedFilePath = Path.ChangeExtension(OriginalFilePath, “pdf”);
diagram.Save(ConvertedFilePath, options);

This error occurs in the Save method:

Service.ConverterService+d__9] - Image loading failed.
System.ArgumentException: Image loading failed.
at .(Stream , ␦ , Boolean )
at .tream , ␦ )
at.(Stream , ␦ )
at Aspose.Drawing.Bitmap…ctor(Stream stream, Boolean useIcm)
at Aspose.Drawing.Bitmap…ctor(Stream stream)
at …ctor(Byte[] )
at . )
at . )
at( )
at( )
at ( )
at( )
at ( )
at( )
at ( )
at( )
at ( )
at . )
at .(Stream , PdfSaveOptions, Diagram )
at InvokeStub_.(Object, Span`1)
at System.Reflection.MethodBaseInvoker.InvokeWithFewArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
— End of stack trace from previous location —
at d.(Exception )
at d(Object )
at d(MethodBase , Boolean)
at d.␦(d , )
at d.()
at d.(Boolean )
— End of stack trace from previous location —
at d.(Exception )
at d(Object )
at d.()
at d.␦(d , )
at d.()
at d.(Boolean )
— End of stack trace from previous location —
at d.(Exception )
at d(Object )
at d.()
at d.(Object , UInt32)
at d.(Boolean )
at d.(Boolean )
at d.(Object[] , Type[], Type[] , Object[] )
at d.(Int32 , Type[], Type[] , Boolean )
at d. , )
at d.()
at d.(Boolean )
— End of stack trace from previous location —
at d.(Exception )
at d(Object )
at d.()
at d.␦(d , )
at d.()
at d.(Boolean )
— End of stack trace from previous location —
at d.(Exception )
at d(Object )
at d.()
at d.(Object , UInt32)
at d.(Boolean )
at d.(Boolean )
at d.(Object[] , Type[], Type[] , Object[] )
at d.(Stream , String, Object[] , Type[] , Type[] , Object[] )
at d(Stream , String, Object[] )
at d.(Stream , String, Object[] )
at Aspose.Diagram.Diagram.Save(String filename, SaveOptions options)

@everaldo

It appears you are encountering an issue when trying to convert a VSDX file to PDF/A format, while the conversion to standard PDF works without any problems. The error message suggests that there is a problem with loading an image during the conversion process.

Cause: The issue may stem from unsupported or corrupted image formats within your VSDX file, or potentially from hidden pages or corrupt elements that are not compatible with PDF/A standards.

Solution: Here are some steps to troubleshoot and resolve this issue:

  1. Check Image Formats: Verify that all images used in your VSDX file are in supported formats. Unsupported or corrupted image formats can lead to loading failures.

  2. Update Aspose.Diagram: Ensure you are using the latest version of Aspose.Diagram, as newer releases may contain bug fixes or improvements related to PDF/A conversion.

  3. Set Compliance Correctly: Confirm that you are setting the compliance to PdfA1a as intended. If you are uncertain, try using PdfA1b to see if it resolves the issue.

  4. Export Hidden Pages: If your diagram contains hidden pages, set the ExportHiddenPage option to true to include them in the conversion.

  5. Check for Corrupt Elements: Open the VSDX file in Visio and inspect it for any corrupt elements or unsupported features that may not translate well into PDF/A.

Here’s a minimal code snippet to ensure you are setting the options correctly:

PdfSaveOptions options = new PdfSaveOptions();
options.SaveFormat = SaveFileFormat.Pdf;

if (ConversionConfiguration.IsPDFA)
{
    options.Compliance = PdfCompliance.PdfA1b; // Try PdfA1b if PdfA1a fails
    options.ExportHiddenPage = true; // Include hidden pages if necessary
}

ConvertedFilePath = Path.ChangeExtension(OriginalFilePath, "pdf");
diagram.Save(ConvertedFilePath, options);

Next Steps: If the issue persists after trying these steps, please share more details about the specific elements in your VSDX file that might be causing the problem. This information will help in diagnosing the issue further.

Let me know if this helps!

@everaldo
Thanks for the template file.
We reproduced the problems you mentioned by converting your template VSDX file to PDF/A in net8. We found exception in net8 with aspose.drawing.common . We need to evaluate your issue in details.

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): DIAGRAMNET-53794

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

The issues you have found earlier (filed as DIAGRAMNET-53794) have been fixed in this update. This message was posted using Bugs notification tool by philip.zhou