Skip to content

Commit

Permalink
Removed nuget and code for pdf generation
Browse files Browse the repository at this point in the history
  • Loading branch information
Anjana Yadav committed Jul 19, 2024
1 parent 9ae3daf commit 7e3a5b8
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 32 deletions.
1 change: 0 additions & 1 deletion OFM.Infrastructure.WebAPI/OFM.Infrastructure.WebAPI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="8.0.2" />
<PackageReference Include="Microsoft.Identity.Client" Version="4.59.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.6" />
<PackageReference Include="Select.HtmlToPdf.NetCore" Version="24.1.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,38 +384,7 @@ public async Task<bool> CreateAllowanceEmail(SupplementaryApplication allowance,
if (newEmailId != null)
await NotificationSentSupp(allowance.ofm_allowanceid, _d365webapiservice, processId);

#region generate pdf for the email sent for approval
subject = "<div>&nbsp</div><div style = 'font-size:18pt;margin-left:8em'><span style = 'font-size:18pt'><b>Subject: " + subject + "</b></span></div><br/><br/><br/>";
emaildescription = string.Concat(Environment.NewLine, subject, Environment.NewLine, emaildescription);
SelectPdf.HtmlToPdf converter = new SelectPdf.HtmlToPdf();

try
{
SelectPdf.HtmlToPdfOptions options = new HtmlToPdfOptions();
converter.Options.MarginTop = 100; converter.Options.MarginLeft = 50; converter.Options.MarginRight = 40; converter.Options.MarginBottom = 10;
converter.Options.PdfPageOrientation = PdfPageOrientation.Landscape;
converter.Options.PdfPageSize = PdfPageSize.A4;
SelectPdf.PdfDocument doc = converter.ConvertHtmlString(emaildescription);
byte[] bytes = doc.Save();
HttpResponseMessage response1 = await _d365webapiservice.SendDocumentRequestAsync(_appUserService.AZPortalAppUser, ofm_allowance.EntitySetName, (Guid)allowance.ofm_allowanceid, bytes, string.Concat(allowanceNumber, ".pdf"));

if (!response1.IsSuccessStatusCode)
{
var responseBody = await response1.Content.ReadAsStringAsync();
_logger.LogError(CustomLogEvent.Process, "Failed to create notification pdf for approved supplementary the server error {responseBody}", responseBody.CleanLog());

//log the error
return await Task.FromResult(false);

}
}
catch (Exception ex)
{
_logger.LogError(CustomLogEvent.Process, "Failed to create notification pdf for approved supplementary {responseBody}", ex.InnerException.Message);

}

#endregion

}
if (allownaceStatusReason == (int)ofm_allowance_StatusCode.DeniedIneligible)
Expand Down

0 comments on commit 7e3a5b8

Please sign in to comment.