Skip to content

Conversation

@ArgoZhang
Copy link
Member

@ArgoZhang ArgoZhang commented Oct 27, 2025

Link issues

fixes #7012

Summary By Copilot

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Merge the latest code from the main branch

Summary by Sourcery

Add a new PdfOptions class and extend the IHtml2Pdf interface and its default service implementation to support optional PDF customization parameters.

New Features:

  • Introduce PdfOptions to configure PDF export settings
  • Add optional PdfOptions parameter to all IHtml2Pdf methods

Enhancements:

  • Update DefaultHtml2PdfService implementation to accept and pass through PdfOptions

Copilot AI review requested due to automatic review settings October 27, 2025 04:45
@bb-auto bb-auto bot added the enhancement New feature or request label Oct 27, 2025
@bb-auto bb-auto bot added this to the 9.11.0 milestone Oct 27, 2025
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Oct 27, 2025

Reviewer's Guide

This PR enhances the HTML-to-PDF service by introducing an optional PdfOptions parameter across all export methods, updating interface and implementation signatures, and defining a new PdfOptions class to hold PDF-specific settings.

Class diagram for new PdfOptions and updated IHtml2Pdf interface

classDiagram
    class PdfOptions {
        +bool Landscape
    }
    class IHtml2Pdf {
        +PdfDataAsync(string url, PdfOptions? options = null) Task<byte[]>
        +PdfStreamAsync(string url, PdfOptions? options = null) Task<Stream>
        +PdfDataFromHtmlAsync(string html, IEnumerable<string>? links = null, IEnumerable<string>? scripts = null, PdfOptions? options = null) Task<byte[]>
        +PdfStreamFromHtmlAsync(string html, IEnumerable<string>? links = null, IEnumerable<string>? scripts = null, PdfOptions? options = null) Task<Stream>
    }
    IHtml2Pdf --> PdfOptions : uses
Loading

File-Level Changes

Change Details Files
Extend IHtml2Pdf service methods to accept PdfOptions
  • Add optional PdfOptions parameter to PdfDataAsync and PdfStreamAsync
  • Add optional PdfOptions parameter to PdfDataFromHtmlAsync and PdfStreamFromHtmlAsync
IHtml2Pdf.cs
DefaultHtml2PdfService.cs
Introduce PdfOptions configuration class
  • Create PdfOptions class with a Landscape property
Options/PdfOptions.cs

Assessment against linked issues

Issue Objective Addressed Explanation
#7012 Add a PdfOptions parameter to all relevant Html2Pdf service and interface methods.
#7012 Implement the PdfOptions class to encapsulate PDF export options.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

sourcery-ai[bot]
sourcery-ai bot previously approved these changes Oct 27, 2025
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes - here's some feedback:

  • Add detailed XML doc comments for the new 'options' parameter on each interface method to clarify its purpose and usage.
  • Consider extending PdfOptions with additional PDF settings (e.g., page size, margins, headers/footers) or renaming it to better reflect its current minimal properties.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Add detailed XML doc comments for the new 'options' parameter on each interface method to clarify its purpose and usage.
- Consider extending PdfOptions with additional PDF settings (e.g., page size, margins, headers/footers) or renaming it to better reflect its current minimal properties.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new PdfOptions parameter to the HTML-to-PDF conversion API, enabling configuration of PDF export settings such as landscape orientation. The changes introduce a new PdfOptions class and update all methods in the IHtml2Pdf interface to accept an optional options parameter.

  • Added PdfOptions class with Landscape property for controlling PDF orientation
  • Updated all four methods in IHtml2Pdf interface to accept optional PdfOptions parameter
  • Updated version numbers for the package releases

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
src/BootstrapBlazor/Options/PdfOptions.cs New class defining PDF export configuration options
src/BootstrapBlazor/Services/IHtml2Pdf.cs Interface updated to include PdfOptions parameter in all methods
src/BootstrapBlazor/Services/DefaultHtml2PdfService.cs Default implementation updated to match interface signature changes
src/BootstrapBlazor/BootstrapBlazor.csproj Version numbers incremented for both beta and release candidate versions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Oct 27, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (b3f199e) to head (7688b29).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #7013   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          741       742    +1     
  Lines        32397     32398    +1     
  Branches      4485      4485           
=========================================
+ Hits         32397     32398    +1     
Flag Coverage Δ
BB 100.00% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ArgoZhang ArgoZhang merged commit 045fa2e into main Oct 27, 2025
7 checks passed
@ArgoZhang ArgoZhang deleted the feat-pdf branch October 27, 2025 05:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(Html2Pdf): add PdfOptions parameter

2 participants