Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Wed Nov 30, 2022 10:24 pm

Hello,
i have an issue using this code below to convert xml content to pdf.

Code: Select all
using MemoryStream readMs = new(File.ReadAllBytes("RC_SDI8384254279.xml"));
using MemoryStream writeMs = new();
Document document = new();
        document.LoadFromStream(readMs, FileFormat.);
        if (document.IsContainMacro)
        {
            document.ClearMacros();
        }

        ToPdfParameterList pdfParameterList = new()
        {
            IsEmbeddedAllFonts = true,
            DisableLink = true
        };
        document.SaveToFile("c:\\temp\\pdf.pdf", pdfParameterList);


The exception retrieved by the code is "NotSupportedException".

Code: Select all
System.NotSupportedException: The file format cannot be supported.
   at Spire.Doc.Document.LoadFromStream(Stream stream, FileFormat fileFormat, String password)
   at Spire.Doc.Document.LoadFromStream(Stream stream, FileFormat fileFormat)


I attached the xml file used by our test.
Can you help me please or let me know if the librariy doen't support this kind of conversion?

fabrizio.lazzarotto
 
Posts: 14
Joined: Mon Feb 28, 2022 4:16 pm

Thu Dec 01, 2022 9:49 am

Hi,

Thanks for your inquiry.
Kindly note that our Spire.Doc is based on MS Word standard. For your xml, it is not Office OpenXML format. Sorry our Spire.Doc at present doesn’t support converting this xml. If it is available in the future. We will let you know as soon as possible.

Sincerely,
Triste
E-iceblue support team
User avatar

Triste.Dai
 
Posts: 1000
Joined: Tue Nov 15, 2022 3:59 am

Return to Spire.Doc