Skip to content

feat(PdfReader): print pdf function support stream#7361

Merged
ArgoZhang merged 9 commits intomainfrom
feat-pdf
Dec 18, 2025
Merged

feat(PdfReader): print pdf function support stream#7361
ArgoZhang merged 9 commits intomainfrom
feat-pdf

Conversation

@ArgoZhang
Copy link
Copy Markdown
Member

@ArgoZhang ArgoZhang commented Dec 18, 2025

Link issues

fixes #7360

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

Enhance the PdfReader sample to document and demonstrate new stream-based printing capabilities and related configuration options.

New Features:

  • Document the ability to set PDF content via streams and configure the download file name in the PdfReader sample.

Enhancements:

  • Update the PdfReader demo page with Font Awesome stylesheet usage and descriptive guidance for new configuration options.
  • Add localized strings for the updated PdfReader demo content in both English and Chinese locales.
  • Adjust the server project configuration to support the updated PdfReader demo and assets.

Copilot AI review requested due to automatic review settings December 18, 2025 02:07
@bb-auto bb-auto Bot added the enhancement New feature or request label Dec 18, 2025
@bb-auto bb-auto Bot added this to the v10.1.0 milestone Dec 18, 2025
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Dec 18, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds documentation and localization-supported UI hints to the PdfReader sample demonstrating font-awesome integration and new stream/filename-related PdfReader features, with corresponding locale entries and project updates.

Flow diagram for rendering localized PdfReader sample hints

flowchart TD
  A_UserOp[User opens PdfReaders_sample_page] --> B_Locale[Determine_current_locale]
  B_Locale --> C_LoadStrings[Load_localized_strings_from_en_US_or_zh_CN]
  C_LoadStrings --> D_RenderIntro[Render_PdfReader_normal_intro]
  D_RenderIntro --> E_RenderFA[Render_font_awesome_description_as_MarkupString]
  E_RenderFA --> F_ShowLink[Show_FA_stylesheet_link_snippet]
  F_ShowLink --> G_RenderList[Render_UL_with_stream_and_filename_descriptions]
  G_RenderList --> H_UserReads[User_reads_hints_on_stream_and_download_filename_features]
Loading

File-Level Changes

Change Details Files
Enhance the PdfReader demo to document font-awesome dependency and new stream/filename options.
  • Insert a localized paragraph explaining the PdfReader Font Awesome icon usage.
  • Show a code snippet for including the Font Awesome stylesheet via the BootstrapBlazor assets helper.
  • Add a bullet list describing how to set a PDF stream and configure the download file name, using localized rich-text strings.
src/BootstrapBlazor.Server/Components/Samples/PdfReaders.razor
Wire up localization text and any necessary project metadata for the updated PdfReader sample.
  • Add/adjust en-US localization strings for the new PdfReader descriptions (FA icon usage, setting PDF stream, download filename).
  • Add/adjust zh-CN localization strings mirroring the new PdfReader descriptions.
  • Update the server project file if needed to reference assets or packages required by the updated sample and Font Awesome usage.
src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj
src/BootstrapBlazor.Server/Locales/en-US.json
src/BootstrapBlazor.Server/Locales/zh-CN.json

Assessment against linked issues

Issue Objective Addressed Explanation
#7360 Implement stream support for the PdfReader print PDF function in the codebase (so that PDFs can be printed from a stream, not only from files/URLs).

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 Dec 18, 2025
Copy link
Copy Markdown
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 and they look great!

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location> `src/BootstrapBlazor.Server/Components/Samples/PdfReaders.razor:10-14` </location>
<code_context>
 <PackageTips Name="BootstrapBlazor.PdfReader" />

 <DemoBlock Title="@Localizer["PdfReaderNormalText"]" Introduction="@Localizer["PdfReaderNormalIntro"]" Name="Normal">
+    <p>@((MarkupString)Localizer["PdfReaderFAIconDesc"].Value)</p>
+    <Pre>&lt;link rel="stylesheet" href="@@Assets["_content/BootstrapBlazor.FontAwesome/css/font-awesome.min.css"]" /&gt;</Pre>
+    <ul class="ul-demo">
+        <li>@((MarkupString)Localizer["PdfReaderSetPdfStreamDesc"].Value)</li>
+        <li>@((MarkupString)Localizer["PdfReaderDownloadFileNameDesc"].Value)</li>
+    </ul>
     <section ignore class="row form-inline g-3" style="--bb-input-group-label-width: 176px;">
</code_context>

<issue_to_address>
**🚨 issue (security):** Casting localized strings to MarkupString can introduce XSS risk if the content is not fully trusted or strictly controlled.

These casts mean any HTML in the resource strings will be rendered directly. If the resources can ever be influenced by user input or external systems, this becomes an XSS vector. If they’re guaranteed to be static, controlled strings shipped with the app, it’s safer to explicitly whitelist which keys may contain HTML or wrap this in a helper (e.g., `Localizer.AsHtml("key")`) so HTML rendering is centralized and harder to misuse elsewhere.
</issue_to_address>

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.

# Conflicts:
#	src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj
@ArgoZhang ArgoZhang dismissed sourcery-ai[bot]’s stale review December 18, 2025 02:10

The merge-base changed after approval.

Copy link
Copy Markdown
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 stream support for the print PDF function in the PdfReader component, fixing issue #7360. The changes primarily focus on documentation and localization updates to inform users about new streaming capabilities.

  • Adds localization strings documenting FontAwesome dependency, streaming methods (SetPdfStreamAsync/SetPdfBase64DataAsync), and DownloadFileName parameter
  • Updates PdfReaders.razor demo page with enhanced documentation showing how to use the streaming features
  • Updates BootstrapBlazor.PdfReader package from version 10.0.18 to 10.0.21

Reviewed changes

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

File Description
src/BootstrapBlazor.Server/Locales/zh-CN.json Adds Chinese localization for PdfReader FontAwesome dependency, streaming methods, and download filename configuration
src/BootstrapBlazor.Server/Locales/en-US.json Adds English localization for PdfReader FontAwesome dependency, streaming methods, and download filename configuration
src/BootstrapBlazor.Server/Components/Samples/PdfReaders.razor Enhances demo page documentation with FontAwesome reference instructions and feature descriptions for streaming and download functionality
src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj Updates BootstrapBlazor.PdfReader package version to 10.0.21 to support new streaming features

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

@ArgoZhang ArgoZhang merged commit f51e049 into main Dec 18, 2025
4 checks passed
@ArgoZhang ArgoZhang deleted the feat-pdf branch December 18, 2025 02:10
@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 18, 2025

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #7361   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          747       747           
  Lines        32760     32760           
  Branches      4540      4540           
=========================================
  Hits         32760     32760           
Flag Coverage Δ
BB 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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(PdfReader): print pdf function support stream

2 participants