Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor PDF generation using a new HtmlToPdfConverter #191

Merged
merged 2 commits into from
Sep 28, 2024

Conversation

axunonb
Copy link
Member

@axunonb axunonb commented Sep 28, 2024

Rename "Chromium" to "Browser" in config and code

  • Updated AppSettings.json to rename "Chromium" section to "Browser" for PDF generation.
  • Reflected this change across multiple files including ReportSheetCacheTests.cs, UnitTestHelpers.cs, and ReportSheetCache.cs.
  • Updated comments in ReportSheet.cshtml accordingly.
  • Simplified AppSettings.json by removing comments about AllowedUserNameCharacters and DefaultLockoutTimeSpan settings.

Refactor PDF generation

  • Updated README.md to reflect the correct Chromium version and added a note about rendering issues with Chromium 131.x.
  • Simplified the EnsureCacheFolder method in ReportSheetCache.cs by removing unnecessary directory existence checks and creation logic.
  • Added a new HtmlToPdfConverter class in HtmlToPdfConverter.cs to encapsulate the logic for converting HTML to PDF using either Puppeteer or a browser command line.
  • Refactored the GetOrCreatePdf method in ReportSheetCache.cs to use a new HtmlToPdfConverter class for generating PDF data, replacing the previous Puppeteer and browser command line logic.
  • Removed the GetReportSheetBrowser, MovePdfToCache, GetReportSheetPuppeteer, CreateReportSheetPdfBrowser, CreateHtmlFile, and DeleteTempPathFolder methods from ReportSheetCache.cs as they are now handled by the new HtmlToPdfConverter class.
  • Updated the ReportSheet action in Match.cs to use the new PDF generation logic.
  • Updated the Bootstrap CSS link in ReportSheet.cshtml to a newer version and adjusted the print styles accordingly.

* Updated AppSettings.json to rename "Chromium" section to "Browser" for PDF generation.
* Reflected this change across multiple files including ReportSheetCacheTests.cs, UnitTestHelpers.cs, and ReportSheetCache.cs.
* Updated comments in ReportSheet.cshtml accordingly.
* Simplified AppSettings.json by removing comments about `AllowedUserNameCharacters` and `DefaultLockoutTimeSpan` settings.
Refactor PDF generation

* Updated README.md to reflect the correct Chromium version and added a note about rendering issues with Chromium 131.x.
* Simplified the `EnsureCacheFolder` method in `ReportSheetCache.cs` by removing unnecessary directory existence checks and creation logic.
* Added a new `HtmlToPdfConverter` class in `HtmlToPdfConverter.cs` to encapsulate the logic for converting HTML to PDF using either Puppeteer or a browser command line.
* Refactored the `GetOrCreatePdf` method in `ReportSheetCache.cs` to use a new `HtmlToPdfConverter` class for generating PDF data, replacing the previous Puppeteer and browser command line logic.
* Removed the `GetReportSheetBrowser`, `MovePdfToCache`, `GetReportSheetPuppeteer`, `CreateReportSheetPdfBrowser`, `CreateHtmlFile`, and `DeleteTempPathFolder` methods from `ReportSheetCache.cs` as they are now handled by the new `HtmlToPdfConverter` class.
* Updated the `ReportSheet` action in `Match.cs` to use the new PDF generation logic.
* Updated the Bootstrap CSS link in `ReportSheet.cshtml` to a newer version and adjusted the print styles accordingly.
Copy link

sonarcloud bot commented Sep 28, 2024

@axunonb axunonb merged commit 7557457 into main Sep 28, 2024
4 checks passed
@axunonb axunonb deleted the pr/browser-pdf-gen branch September 28, 2024 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant