Skip to content

Conversation

wojtekmaj
Copy link
Owner

@wojtekmaj wojtekmaj commented Sep 23, 2025

Closes #2020

Potential breaking change: customRenderer must now include canvas parameter for it to function properly.

Closes #2020

Potential breaking change: customRenderer must now include canvas parameter for it to function properly.
@jspath-ankored
Copy link

Hi @wojtekmaj just wondering what your timeframe is on merging this and deploying a new version.

Thanks for your work on this library!

@wojtekmaj wojtekmaj requested a review from Copilot October 3, 2025 15:28
Copy link

@Copilot 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

Updates the pdfjs-dist dependency from version 5.3.93 to 5.4.149, which introduces a breaking change requiring the canvas parameter in RenderParameters. The PR ensures compatibility by adding the canvas property to render contexts and updating the LinkService implementation to match the new interface requirements.

  • Updated pdfjs-dist dependency to version 5.4.149
  • Added canvas parameter to RenderParameters in Canvas component and test file
  • Updated LinkService implementation with new required methods and reordered existing methods

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.

File Description
packages/react-pdf/package.json Updates pdfjs-dist dependency version
packages/react-pdf/src/Page/Canvas.tsx Adds canvas property to RenderParameters for compatibility
test/CustomRenderer.tsx Adds canvas property to test RenderParameters
packages/react-pdf/src/LinkService.ts Updates LinkService with new methods and reorders existing methods

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

link.href = url;
link.rel = this.externalLinkRel || DEFAULT_LINK_REL;
link.target = newWindow ? '_blank' : this.externalLinkTarget || '';
goToXY(): void {
Copy link
Preview

Copilot AI Oct 3, 2025

Choose a reason for hiding this comment

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

The goToXY method lacks parameter documentation. Based on the PDF.js interface, this method should accept parameters like (x, y, destArray). Consider adding JSDoc comments to document the expected parameters even if the implementation is empty.

Suggested change
goToXY(): void {
/**
* Scrolls to the specified coordinates on the page.
* @param {number} x - The x-coordinate to scroll to.
* @param {number} y - The y-coordinate to scroll to.
* @param {any} destArray - The destination array as per PDF.js interface.
*/
goToXY(x: number, y: number, destArray: any): void {

Copilot uses AI. Check for mistakes.

@wojtekmaj wojtekmaj merged commit 8f5e60a into main Oct 3, 2025
15 checks passed
@wojtekmaj wojtekmaj deleted the pdfjs-dist-5.4.149 branch October 3, 2025 15:29
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.

Fix: Update pdfjs-dist dependency to include Safari compatibility fix
2 participants