|
@@ -230,7 +230,7 @@ namespace PDF_Master.Helper
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- public static void ImageMagickPDFToImage(string imageType, string filePath, string outputFolder, string outputFileName, ref string FileName)
|
|
|
+ public static void ImageMagickPDFToImage(string imageType, string filePath, string outputFolder, string outputFileName, ref string FileName,double density=150)
|
|
|
{
|
|
|
FileName = CommonHelper.CreateFolder(outputFolder + "\\" + outputFileName);
|
|
|
ZipFile.ExtractToDirectory(filePath, FileName);
|
|
@@ -254,6 +254,8 @@ namespace PDF_Master.Helper
|
|
|
{
|
|
|
//Save frame as jpg
|
|
|
//image.Format = MagickFormat.Jp2;
|
|
|
+ //水平垂直DPI
|
|
|
+ image.Density = new Density(density);
|
|
|
image.Write(file.Remove(file.LastIndexOf(".png"), 4) + imageType);
|
|
|
}
|
|
|
// 删除该文件
|
|
@@ -266,7 +268,6 @@ namespace PDF_Master.Helper
|
|
|
var settings = new QuantizeSettings();
|
|
|
settings.Colors = 256;
|
|
|
images.Quantize(settings);
|
|
|
-
|
|
|
// Optionally optimize the images (images should have the same size).
|
|
|
images.Optimize();
|
|
|
|
|
@@ -351,7 +352,7 @@ namespace PDF_Master.Helper
|
|
|
string saveName = Guid.NewGuid().ToString();
|
|
|
string savePath = Path.Combine(folderPath, saveName);
|
|
|
result = await Task.Run(() => imgConverter.Convert(folderPath, ref saveName, imgOptions, pageArray, ref error, getProgress));
|
|
|
- ImageMagickPDFToImage(imageType, saveName, outputFolder, outputFileName, ref FileName);
|
|
|
+ ImageMagickPDFToImage(imageType, saveName, outputFolder, outputFileName, ref FileName, imgOptions.ImageDpi);
|
|
|
DirectoryInfo di = new DirectoryInfo(folderPath);
|
|
|
di.Delete(true);
|
|
|
}
|
|
@@ -538,11 +539,10 @@ namespace PDF_Master.Helper
|
|
|
{
|
|
|
word = new Microsoft.Office.Interop.Word.Application();
|
|
|
}
|
|
|
- Microsoft.Office.Interop.Word.Document document = null;
|
|
|
|
|
|
word.Visible = false;
|
|
|
word.ShowWindowsInTaskbar = true;
|
|
|
- document = word.Documents.Open(sourcepath, OpenAndRepair: true);
|
|
|
+ Microsoft.Office.Interop.Word.Document document = word.Documents.Open(sourcepath);
|
|
|
var page = document.PageSetup;
|
|
|
page.PaperSize = paperSize;
|
|
|
if (margin > 0)
|