|
@@ -26,7 +26,7 @@ namespace PDF_Office.Helper
|
|
|
public static CPDFConverterImg imgConverter = null;
|
|
|
public static CPDFConverterRTF rtfConverter = null;
|
|
|
public static CPDFConverterHTML htmlConverter = null;
|
|
|
- public static async Task<bool> WordConvert(string inputpath, string outputpath, OnProgress getProgress, List<int> pageIndexLists, string pawssword)
|
|
|
+ public static async Task<bool> WordConvert(string inputpath, string outputpath, OnProgress getProgress, List<int> pageIndexLists, string pawssword, CPDFConvertWordOptions wordOptions = null)
|
|
|
{
|
|
|
bool result = false;
|
|
|
try
|
|
@@ -37,7 +37,7 @@ namespace PDF_Office.Helper
|
|
|
string outputFileName = Path.GetFileNameWithoutExtension(inputpath);
|
|
|
ConvertError error = ConvertError.ERR_UNKNOWN;
|
|
|
string filename = GetFileNameAddSuffix(outputFolder, outputFileName, ".docx");
|
|
|
- result = await Task.Run(() => wordConverter.Convert(outputFolder, ref outputFileName, pageArray, ref error, getProgress));
|
|
|
+ result = await Task.Run(() => wordConverter.Convert(outputFolder, ref outputFileName, wordOptions, pageArray, ref error, getProgress));
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
@@ -46,7 +46,7 @@ namespace PDF_Office.Helper
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- public static async Task<bool> PPTConvert(string inputpath, string outputpath, OnProgress getProgress, List<int> pageIndexLists, string pawssword)
|
|
|
+ public static async Task<bool> PPTConvert(string inputpath, string outputpath, OnProgress getProgress, List<int> pageIndexLists, string pawssword, CPDFConvertPPTOptions pptOptions=null)
|
|
|
{
|
|
|
bool result = false;
|
|
|
try
|
|
@@ -60,7 +60,7 @@ namespace PDF_Office.Helper
|
|
|
|
|
|
string filename = GetFileNameAddSuffix(outputFolder, outputFileName, ".ppt");
|
|
|
|
|
|
- result = await Task.Run(() => pptConverter.Convert(outputFolder, ref outputFileName, pageArray, ref error, getProgress));
|
|
|
+ result = await Task.Run(() => pptConverter.Convert(outputFolder, ref outputFileName, pptOptions,pageArray, ref error, getProgress));
|
|
|
if (result)
|
|
|
{
|
|
|
if (File.Exists(outputFileName))
|
|
@@ -124,7 +124,7 @@ namespace PDF_Office.Helper
|
|
|
// return result;
|
|
|
//}
|
|
|
|
|
|
- public static async Task<bool> CSVConvert(string inputpath, string outputpath, OnProgress getProgress, List<int> pageIndexLists, string pawssword)
|
|
|
+ public static async Task<bool> CSVConvert(string inputpath, string outputpath, OnProgress getProgress, List<int> pageIndexLists, string pawssword, CPDFConvertCsvOptions csvOptions =null)
|
|
|
{
|
|
|
bool result = false;
|
|
|
try
|
|
@@ -136,7 +136,7 @@ namespace PDF_Office.Helper
|
|
|
string outputFileName = Path.GetFileNameWithoutExtension(inputpath);
|
|
|
ConvertError error = ConvertError.ERR_UNKNOWN;
|
|
|
string filename = GetFileNameAddSuffix(outputFolder, outputFileName, ".csv");
|
|
|
- result = await Task.Run(() => csvConverter.Convert(outputFolder, ref outputFileName, pageArray, ref error, getProgress));
|
|
|
+ result = await Task.Run(() => csvConverter.Convert(outputFolder, ref outputFileName, csvOptions, pageArray, ref error, getProgress));
|
|
|
|
|
|
}
|
|
|
catch (Exception ex)
|
|
@@ -146,7 +146,7 @@ namespace PDF_Office.Helper
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- public static async Task<bool> TxtConvert(string inputpath, string outputpath, OnProgress getProgress, List<int> pageIndexLists, string pawssword)
|
|
|
+ public static async Task<bool> TxtConvert(string inputpath, string outputpath, OnProgress getProgress, List<int> pageIndexLists, string pawssword,CPDFConvertTxtOptions txtOptions =null)
|
|
|
{
|
|
|
bool result = false;
|
|
|
try
|
|
@@ -158,7 +158,7 @@ namespace PDF_Office.Helper
|
|
|
string outputFileName = Path.GetFileNameWithoutExtension(inputpath);
|
|
|
ConvertError error = ConvertError.ERR_UNKNOWN;
|
|
|
string filename = GetFileNameAddSuffix(outputFolder, outputFileName, ".txt");
|
|
|
- result = await Task.Run(() => txtConverter.Convert(outputFolder, ref outputFileName, pageArray, ref error, getProgress));
|
|
|
+ result = await Task.Run(() => txtConverter.Convert(outputFolder, ref outputFileName, txtOptions, pageArray, ref error, getProgress));
|
|
|
|
|
|
}
|
|
|
catch (Exception ex)
|
|
@@ -245,7 +245,7 @@ namespace PDF_Office.Helper
|
|
|
|
|
|
}
|
|
|
|
|
|
- public static async Task<bool> ImgConvert(string inputpath, string outputpath, OnProgress getProgress, List<int> pageIndexLists,string pawssword, ImgType type,string imageType=".png")
|
|
|
+ public static async Task<bool> ImgConvert(string inputpath, string outputpath, OnProgress getProgress, List<int> pageIndexLists,string pawssword,string imageType=".png", CPDFConvertImgOptions imgOptions = null)
|
|
|
{
|
|
|
bool result = false;
|
|
|
try
|
|
@@ -258,7 +258,7 @@ namespace PDF_Office.Helper
|
|
|
ConvertError error = ConvertError.ERR_UNKNOWN;
|
|
|
if (imageType == ".png" || imageType == ".jpg")
|
|
|
{
|
|
|
- result = await Task.Run(() => imgConverter.Convert(outputFolder, ref outputFileName, pageArray, type, ref error, getProgress));
|
|
|
+ result = await Task.Run(() => imgConverter.Convert(outputFolder, ref outputFileName, imgOptions, pageArray, ref error, getProgress));
|
|
|
}
|
|
|
else
|
|
|
{ //创建缓存文件夹
|
|
@@ -280,7 +280,7 @@ namespace PDF_Office.Helper
|
|
|
//预览图缓存
|
|
|
string saveName = Guid.NewGuid().ToString();
|
|
|
string savePath = Path.Combine(folderPath, saveName);
|
|
|
- result = await Task.Run(() => imgConverter.Convert(folderPath, ref saveName, pageArray, type, ref error, getProgress));
|
|
|
+ result = await Task.Run(() => imgConverter.Convert(folderPath, ref saveName, imgOptions, pageArray, ref error, getProgress));
|
|
|
ImageMagickPDFToImage(imageType, saveName, outputFolder, outputFileName);
|
|
|
DirectoryInfo di = new DirectoryInfo(folderPath);
|
|
|
di.Delete(true);
|
|
@@ -299,7 +299,7 @@ namespace PDF_Office.Helper
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- public static async Task<bool> RTFConvert(string inputpath, string outputpath, OnProgress getProgress, List<int> pageIndexLists, string pawssword)
|
|
|
+ public static async Task<bool> RTFConvert(string inputpath, string outputpath, OnProgress getProgress, List<int> pageIndexLists, string pawssword, CPDFConvertRTFOptions rtfOptions=null)
|
|
|
{
|
|
|
bool result = false;
|
|
|
try
|
|
@@ -309,7 +309,7 @@ namespace PDF_Office.Helper
|
|
|
string outputFolder = outputpath;
|
|
|
string outputFileName = Path.GetFileNameWithoutExtension(inputpath);
|
|
|
ConvertError error = ConvertError.ERR_UNKNOWN;
|
|
|
- result = await Task.Run(() => rtfConverter.Convert(outputFolder, ref outputFileName, pageArray, ref error, getProgress));
|
|
|
+ result = await Task.Run(() => rtfConverter.Convert(outputFolder, ref outputFileName, rtfOptions,pageArray, ref error, getProgress));
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|