//去水印
string[] stModule = new string[8]
{
"u0002u2006u2006u2003",
"u0003u2006u2006u2003",
"u0005u2005u2000u2003",
"u0003u2000",
"u000F",
"u0002u2000",
"u0003",
"u0002"
};
Assembly assembly = Assembly.GetAssembly(typeof(Aspose.Slides.License));
Type typeLic = null, typeIsTrial = null, typeHelper = null;
foreach (Type type in assembly.GetTypes())
{
if ((typeLic == null) && (type.Name == stModule[0]))
{
typeLic = type;
}
else if ((typeIsTrial == null) && (type.Name == stModule[1]))
{
typeIsTrial = type;
}
else if ((typeHelper == null) && (type.Name == stModule[2]))
{
typeHelper = type;
}
}
if (typeLic == null || typeIsTrial == null || typeHelper == null)
{
throw new Exception();
}
object lic = Activator.CreateInstance(typeLic);
int findCount = 0;
foreach (FieldInfo field in typeLic.GetFields(BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance))
{
if (field.FieldType == typeLic && field.Name == stModule[3])
{
field.SetValue(null, lic);
++findCount;
}
else if (field.FieldType == typeof(DateTime) && field.Name == stModule[4])
{
field.SetValue(lic, DateTime.MaxValue);
++findCount;
}
else if (field.FieldType == typeIsTrial && field.Name == stModule[5])
{
field.SetValue(lic, 1);
++findCount;
}
}
foreach (FieldInfo field in typeHelper.GetFields(BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance))
{
if (field.FieldType == typeof(bool) && field.Name == stModule[6])
{
field.SetValue(null, false);
++findCount;
}
if (field.FieldType == typeof(int) && field.Name == stModule[7])
{
field.SetValue(null, 128);
++findCount;
}
}
if (findCount < 5)
{
throw new NotSupportedException("无效的版本");
}
//转换
Presentation ppt = new Presentation(FileFullName);
ppt.Save(SaveFileName, Aspose.Slides.Export.SaveFormat.Pdf);