Code not working

Document doc = new Document("input.docx");
PdfSaveOptions saveOptions = new PdfSaveOptions
{
    Compliance = PdfCompliance.PdfA2a,
    EmbedFullFonts = true,
    FontEmbeddingMode = FontEmbeddingMode.Always
};
doc.Save("output.pdf", saveOptions);

This code does not work in vb.net; any advice? Thanks you.

@Ckramer1959

You reported that the provided C# code does not work in VB.NET, and you’re looking for advice on how to make it functional. The code you shared is a C# example for converting a Word document to PDF with specific compliance and font embedding settings.

The provided C# code can be converted to VB.NET syntax with proper keyword and syntax adjustments, such as using Dim for variable declarations, With for object initialization, and End Class for closing the class definition . Aspose.Words for .NET supports VB.NET, and the provided C# code should work after proper conversion to VB.NET syntax .

Here is the equivalent VB.NET code:

Dim doc As New Document("input.docx")
Dim saveOptions As New PdfSaveOptions With {
 .Compliance = PdfCompliance.PdfA2a,
 .EmbedFullFonts = True,
 .FontEmbeddingMode = FontEmbeddingMode.Always
}
doc.Save("output.pdf", saveOptions)

This conversion maintains the same functionality as the original C# code, using VB.NET’s syntax for object initialization and variable declaration. Make sure you have the necessary Aspose.Words for .NET NuGet package installed in your VB.NET project .