forked from ddrilling/AsbCloudServer
remove deprecated iTextSharp
This commit is contained in:
parent
f7afa8638e
commit
40076f0ec2
@ -41,7 +41,6 @@
|
||||
<PackageReference Include="ClosedXML" Version="0.96.0" />
|
||||
<PackageReference Include="FluentValidation.AspNetCore" Version="11.2.2" />
|
||||
<PackageReference Include="itext7" Version="7.2.3" />
|
||||
<PackageReference Include="iTextSharp" Version="5.5.13.3" />
|
||||
<PackageReference Include="Mapster" Version="7.3.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
|
||||
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="6.23.1" />
|
||||
|
@ -1,12 +1,12 @@
|
||||
using iTextSharp.text;
|
||||
using iTextSharp.text.pdf;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using CliWrap;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading;
|
||||
using System;
|
||||
using iText.Kernel.Pdf;
|
||||
using iText.Kernel.Utils;
|
||||
|
||||
namespace AsbCloudInfrastructure.Services.DrillingProgram.Convert
|
||||
{
|
||||
@ -17,21 +17,17 @@ namespace AsbCloudInfrastructure.Services.DrillingProgram.Convert
|
||||
|
||||
private static void MergeFiles(IEnumerable<string> inputFiles, string outFile)
|
||||
{
|
||||
using var stream = new FileStream(outFile, FileMode.Create);
|
||||
using var doc = new Document();
|
||||
using var pdf = new PdfCopy(doc, stream);
|
||||
doc.Open();
|
||||
var inputFilesList = inputFiles.ToList();
|
||||
foreach (var file in inputFilesList)
|
||||
using var docResult = new PdfDocument(new PdfWriter(outFile));
|
||||
var merger = new PdfMerger(docResult);
|
||||
|
||||
foreach (var fileName in inputFiles)
|
||||
{
|
||||
var reader = new PdfReader(file);
|
||||
for (int i = 0; i < reader.NumberOfPages; i++)
|
||||
{
|
||||
pdf.AddPage(pdf.GetImportedPage(reader, i + 1));
|
||||
}
|
||||
pdf.FreeReader(reader);
|
||||
reader.Close();
|
||||
using var doc = new PdfDocument(new PdfReader(fileName));
|
||||
merger.Merge(doc, 1, doc.GetNumberOfPages());
|
||||
doc.Close();
|
||||
};
|
||||
|
||||
docResult.Close();
|
||||
}
|
||||
|
||||
private static (string programFile, string programArg) GetOptionsStartupProcess (string inputFileName, string resultFileDir)
|
||||
|
Loading…
Reference in New Issue
Block a user