Skip to content

Commit

Permalink
Merge pull request #718 from bcgov/dev-rook-merge-OIPC
Browse files Browse the repository at this point in the history
dev-OIPC merge to dev-rook
  • Loading branch information
milosdes authored Jan 16, 2024
2 parents 9986336 + 4356c7f commit 5c5c762
Show file tree
Hide file tree
Showing 32 changed files with 1,617 additions and 851 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<PackageReference Include="SkiaSharp" Version="2.88.6" />
<PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="2.88.6" />
<PackageReference Include="Syncfusion.HtmlToPdfConverter.QtWebKit.Net.Core" Version="19.1.0.63" />
<PackageReference Include="Syncfusion.Pdf.Net.Core" Version="23.1.40" />
<PackageReference Include="Syncfusion.Pdf.Net.Core" Version="23.2.7" />
</ItemGroup>

</Project>
84 changes: 43 additions & 41 deletions MCS.FOI.S3FileConversion/MCS.FOI.DocToPDF/DocFileProcessor.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

using Serilog;
using Syncfusion.DocIO.DLS;
using Syncfusion.DocIO.DLS;
using Syncfusion.DocIORenderer;
using Syncfusion.Pdf;

Expand Down Expand Up @@ -41,33 +41,35 @@ public DocFileProcessor(Stream SourceStream)
{
try
{
using (WordDocument wordDocument = new WordDocument(SourceStream, Syncfusion.DocIO.FormatType.Automatic))
{
wordDocument.RevisionOptions.CommentDisplayMode = CommentDisplayMode.ShowInBalloons;
wordDocument.RevisionOptions.CommentColor = RevisionColor.Blue;

//Creates an instance of DocIORenderer.
using (DocIORenderer renderer = new DocIORenderer())
{
using PdfDocument pdfDocument = renderer.ConvertToPDF(wordDocument);
//Save the PDF file
//Close the instance of document objects
pdfDocument.Save(output);
pdfDocument.Close(true);
converted = true;

}
}
using (WordDocument wordDocument = new WordDocument(SourceStream, Syncfusion.DocIO.FormatType.Automatic))
{

wordDocument.RevisionOptions.CommentDisplayMode = CommentDisplayMode.ShowInBalloons;
wordDocument.RevisionOptions.CommentColor = RevisionColor.Blue;
wordDocument.RevisionOptions.ShowMarkup = RevisionType.Deletions | RevisionType.Insertions;

using (DocIORenderer renderer = new DocIORenderer())
{
using PdfDocument pdfDocument = renderer.ConvertToPDF(wordDocument);
//Save the PDF file
//Close the instance of document objects
pdfDocument.Save(output);
pdfDocument.Close(true);
converted = true;

}

}
}
catch (Exception e)
{
string errorMessage = $"Exception occured while coverting a document file, exception : {e.Message}";
message = $"Exception happened while accessing File, re-attempting count : {attempt} , Error Message : {e.Message} , Stack trace : {e.StackTrace}";
Log.Error(message);
Console.WriteLine(message);
if (attempt == FailureAttemptCount)
{
throw new Exception(errorMessage);
if (attempt == FailureAttemptCount)
{
throw new Exception(errorMessage);
}
Thread.Sleep(WaitTimeinMilliSeconds);
}
Expand All @@ -82,28 +84,28 @@ public DocFileProcessor(Stream SourceStream)
throw;
}
return (converted, output);
}

public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}

protected virtual void Dispose(bool disposing)
{
if (disposing)
{
if (this.SourceStream != null)
{
this.SourceStream.Close();
this.SourceStream.Dispose();
}

if (output != null) output.Dispose();
// free managed resources
}

public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}

protected virtual void Dispose(bool disposing)
{
if (disposing)
{
if (this.SourceStream != null)
{
this.SourceStream.Close();
this.SourceStream.Dispose();
}

if (output != null) output.Dispose();
// free managed resources
}

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.DocIO.Net.Core" Version="23.1.40" />
<PackageReference Include="Syncfusion.DocIO.Net.Core" Version="23.2.7" />
<PackageReference Include="SkiaSharp" Version="2.88.6" />
<PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="2.88.6" />

<PackageReference Include="Serilog" Version="2.10.0" />
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" />
<PackageReference Include="Serilog.Extensions.Logging" Version="3.0.1" />
<!--<PackageReference Include="System.Drawing.Common" Version="5.0.2" />-->
<PackageReference Include="Syncfusion.DocIORenderer.Net.Core" Version="23.1.40" />
<PackageReference Include="Syncfusion.Pdf.Net.Core" Version="23.1.40" />
<PackageReference Include="Syncfusion.DocIORenderer.Net.Core" Version="23.2.7" />
<PackageReference Include="Syncfusion.Pdf.Net.Core" Version="23.2.7" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Syncfusion.XlsIO.Net.Core" Version="23.1.40" />
<PackageReference Include="Syncfusion.XlsIORenderer.Net.Core" Version="23.1.40" />
<PackageReference Include="Syncfusion.Pdf.Net.Core" Version="23.1.40" />
<PackageReference Include="Syncfusion.XlsIO.Net.Core" Version="23.2.7" />
<PackageReference Include="Syncfusion.XlsIORenderer.Net.Core" Version="23.2.7" />
<PackageReference Include="Syncfusion.Pdf.Net.Core" Version="23.2.7" />
<PackageReference Include="SkiaSharp" Version="2.88.6" />
<PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="2.88.6" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@
<PackageReference Include="Serilog" Version="2.10.0" />
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" />
<PackageReference Include="Serilog.Extensions.Logging" Version="3.0.1" />
<PackageReference Include="SkiaSharp" Version="2.88.6" />
<PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="2.88.6" />
<PackageReference Include="MsgReader" Version="4.2.1" />
<PackageReference Include="Syncfusion.DocIO.Net.Core" Version="23.1.40" />
<PackageReference Include="Syncfusion.DocIORenderer.Net.Core" Version="23.1.40" />
<PackageReference Include="Syncfusion.HtmlToPdfConverter.QtWebKit.Net.Core" Version="20.3.0.56" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="7.0.0" />
<PackageReference Include="SkiaSharp" Version="2.88.3" />
<PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="2.88.3" />
<PackageReference Include="MsgReader" Version="4.5.0" />
<PackageReference Include="Syncfusion.HtmlToPdfConverter.QtWebKit.Net.Core" Version="20.3.0.56" />
<PackageReference Include="Syncfusion.Pdf.Net.Core" Version="23.2.7" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="5.0.0" />
</ItemGroup>

</Project>
Loading

0 comments on commit 5c5c762

Please sign in to comment.