Skip to content

Conversation

@hussam-apryse
Copy link
Collaborator

Description

This is a new WebViewer sample added by Kevin Kim.
He created this sample to help new users of WebViewer understand the requirements for linearization when loading a document into WebViewer.

Resources

Jira Task: https://apryse.atlassian.net/browse/AS-127

Checklist

  • I understand that this is a public repo and my changes will be publicly visible

If you are adding a new sample

  • I have added an entry to the root level README
  • The name of my sample is consistent with the other samples
  • I have added a README to my sample
  • The sample is fully functional
  • I have updated lerna.json with the new sample name

If you are removing an old sample

  • I have removed the entry from the root level README
  • I have removed the sample from lerna.json

This is a new WebViewer sample added by Kevin Kim.
He created this sample to help new users of WebViewer understand the requirements for linearization when loading a document into WebViewer.
- Added sample to `lerna.json`
- Added sample to `README.md`
Copy link

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 WebViewer sample demonstrating how to implement PDF linearization for optimized web viewing. The sample includes a complete client-server setup showing range request handling for linearized PDFs.

Key changes:

  • New React + Vite frontend with WebViewer integration to display and check PDF linearization status
  • Express server implementing HTTP range requests for serving linearized PDFs
  • Sample registered in lerna.json and root README

Reviewed changes

Copilot reviewed 15 out of 17 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
webviewer-linearization/tools/copy-webviewer-files.cjs Script to copy WebViewer library files to the client public directory
webviewer-linearization/server/server.js Express server with CORS configuration and range request handling for linearized PDFs
webviewer-linearization/package.json Project dependencies and scripts for running the client-server application
webviewer-linearization/client/vite.config.js Vite configuration for the React frontend
webviewer-linearization/client/src/main.jsx React application entry point
webviewer-linearization/client/src/index.css Global styles for the application
webviewer-linearization/client/src/App.jsx Main React component with WebViewer integration and linearization check
webviewer-linearization/client/src/App.css Styles for the App component
webviewer-linearization/client/index.html HTML entry point for the Vite application
webviewer-linearization/client/eslint.config.js ESLint configuration for code quality
webviewer-linearization/client/README.md Standard Vite + React template documentation
webviewer-linearization/README.md Sample-specific documentation with setup and usage instructions
webviewer-linearization/.gitignore Git ignore patterns for the sample
lerna.json Added webviewer-linearization to the packages list
README.md Added link to the new linearization sample

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need this PDF file? It is best to reference the file to the AWS files for any samples.

Copy link
Collaborator Author

@hussam-apryse hussam-apryse Jan 6, 2026

Choose a reason for hiding this comment

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

I am not sure.
It looks like the code in server.js lines 31-86 is about demonstrating how to serve a linearized file that is hosted on the server.
It might be possible to use a file hosted on the AWS, but it might require changing this code extensively and perhaps altering the CORS policy as well.
I could reach out to Kevin Kim about changing it to make it like this and see if he can make the needed changes while keeping the code needed to demonstrate how to serve linearized files.

const range = req.headers.range;

// Set common headers
// res.set('Access-Control-Allow-Origin', '*'); // this is not required as CORS middleware already adds the origin header
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this line intended to be commented out?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It looks like the line is commented out because the CORS policy is explicitly defined in lines 18-24 in this code using the cors npm package to allow access to the specific origin of http://localhost:5173

The line that is commented out looks like it's part of the starting Node Express server code that allows blanket access from any origin (*) so it is commented out to use the CORS policy instead.

We could perhaps remove this line instead, I am thinking.

Copy link
Collaborator

@DavidEGutierrez DavidEGutierrez left a comment

Choose a reason for hiding this comment

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

@hussam-apryse , please review comments and edit as necessary, provide a reply and ask the requester to review before we merge.

hussam-apryse and others added 2 commits January 6, 2026 14:30
Remove unused sample document URLs from `server.js`

Co-authored-by: Copilot <[email protected]>
Expanded Description of Linearization and its role in improving user experience.
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.

3 participants