Unable to add metadata to ppt converted to pdf archive

I have a function where I convert several formats to a PDF-archive, among them using the Aspose.Slides.Presentation for ppt and the Aspose.Slides.Pptx.PresentationEx for pptx. I use the PdfCompliance to set the compliance of the pdf to PdfA1b.

The problem occurs when trying to add metadata to the "ppt and pptx"-pdf. All other formats work fine:

I use the PdfXmpMetadata class to bind the pdf to the file. The error occurs when I use the RegisterNamespaceURI function. I get an error message:

Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

Has anybody experienced this?

Hi Eskild,

Thanks for considering Aspose.Slides.

I have tried to understand the issue shared by you. I like clarification and further elaboration of your following comments please. What I have perceived is that when your presentation contains metadata then it failed to export to PDF. Please share the source presentation along with the code snippet used to further investigate the issue.

“The problem occurs when trying to add metadata to the “ppt and pptx”-pdf. All other formats work fine:”

If you are interested in adding the meta characters in PPT/PPTX then it is not possible in Aspose.Slides for .NET at the moment. However, you may access the meta characters associated with text frames. The information about the supported meta characters can be found here. The following sample code may help you in accessing the meta characters associated with text frames. Please share if I may help you any further in this regard.

public static void ReplaceDate()
{
    Presentation pres = new Presentation("D:\\Aspose DFvata\\TestDate.ppt");
    Slide slide = null;
    int numSlides = pres.Slides.LastSlidePosition;
    int x = 0, y = 0, w = 0, h = 0;

    for (int slideNum = 1; slideNum < pres.Slides.Count; slideNum++)
    {
        slide = pres.GetSlideByPosition(slideNum);
        foreach (Shape shape in slide.Shapes)
        {
            if (shape.TextFrame != null)
            {
                TextFrame frame = shape.TextFrame;
                if (frame.MetaCharacters != null)
                {
                    MetaCharacterType type = frame.MetaCharacters[0];
                    switch (type)
                    {
                        case MetaCharacterType.DateTime:
                            slide.HeaderFooter.DateTimeVisible = false;
                            slide.HeaderFooter.IsDateTimeVisible = false;

                            x = shape.X;
                            y = shape.Y;
                            w = shape.Width;
                            h = shape.Height;
                            break;

                        case MetaCharacterType.Footer:
                            break;

                        case MetaCharacterType.GenericDateTime:
                            break;

                        case MetaCharacterType.Header:
                            break;

                        case MetaCharacterType.SlideNumer:
                            break;

                        default:
                            break;
                    }
                }
            }
        }

        if (x >= 0 && y >= 0)
        {
            Shape temshape = slide.Shapes.AddRectangle(x, y, w, h);
            temshape.AddTextFrame("Hello World");
        }
    }

    pres.Write("D:\\Aspose Data\\TestDate.ppt");
}

Thanks and Regards,

The attached file will fail no matter what ppt or pptx you convert to Pdf. As mentioned it doesn't fail in the conversion, it fails when adding metadata to the converted file on the line:

xmpMetaData.RegisterNamespaceURI("company", "http://www.company.com/ns/");

Hi Eskild,

I have worked with the code snippet shared by you and have been able to observe the issue shared. An issue with ID 30383 has been created in our issue tracking system to further investigate and resolve the issue. We will share the further information with you once the issue is resolved.

We are sorry for your inconvenience,

What's the status on this issue?

Hi Eskild,


I regret to share that I have verified from our issue tracking system and unfortunately the issue has not been scheduled yet. I have requested our development team to share the updated status of the issue. I will share the response with you as soon as it is shared by them.

We are sorry for your inconvenience,

More problems have arisen with adding metadata to PDF-A

Adding metadata to PDF-documents converted to PDF-A will fail in many cases with an error-message: "The field couldn't be added due to some restrictions."

Hi Eskild,


We are sorry for your inconvenience.

I have tried Aspose.Slides for .NET 7.4.0 and Aspose.Pdf 7.9.0 on my end to investigate the issue using shared sample project. I have observed unhandled XMLException at the point of saving presentation this time. I have taken Aspose.Pdf team on board as well to investigate whether the issue now lies on Aspose.Pdf end. I also request you to please share the sample project and source data to reproduce your error as well. I will share my further feedback based on that.

Many Thanks,

Hi Eskild,


I have discussed the issue with Aspose.Pdf support team and have shared the modified sample code for your convenience which works without an issue. Please use the shared sample project and share the issue with us if it is still there.

Many Thanks,