Aspose PDF - support macro?

Hello, we are using Aspose in our product, and we have a customer with concern about PDF file that may include malware macro command.

I saw some post in the past that aspose doesn’t, currently, support running macro command from PDF files. I just want to make sure.

Thank you

@avitwito

Aspose.PDF allows loading a sequence of PCL commands into memory and use this sequence many times, for example, to print page header or set one formatting for a set of pages.

If parsed PCL file contains macros commands the result of parsing will strongly differ from the source file, because macros commands are not supported.

Could you please share some more detail about your requirement along with input PDF that contains the macros? Please also share the expected output that you want after using Aspose.PDF APIs. We will then provide you more information about your query.

thank you for your reply, we have a security concern. we are using Aspose.Total to render pdf file to stream and then we creating an png file.

looks like that:
protected override Stream RenderDocumentOverride(Stream stream, int page, CancellationToken cancellationToken)
{
using (Presentation presentation = new Presentation(stream))
{
if (presentation.Slides.Count <= page)
{
throw new IndexOutOfRangeException($“Page number ‘{page}’ exceeds the number of pages in the document ({presentation.Slides.Count}).”);
}

using (Bitmap bmp = presentation.Slides[page].GetThumbnail(1, 1))
{
    MemoryStream result = new MemoryStream();
    bmp.Save(result, ImageFormat.Png);
    return result;
}

}
}

so to refine my question here, in the above case, if the pdf include some macro command, will the command run upon using the pdf stream?

@avitwito

Aspose.PDF does not run the macros command while import PDF into its DOM.

thank you! :slight_smile:

@avitwito

Please feel free to ask if you have any question about Aspose.PDF, we will be happy to help you.