Skip to content

feat: custom start page property for f-pdf-viewer #232

Closed
b0ink wants to merge 2 commits intothoth-tech:8.0.xfrom
b0ink:feat/pdfviewer-custom-start-page
Closed

feat: custom start page property for f-pdf-viewer #232
b0ink wants to merge 2 commits intothoth-tech:8.0.xfrom
b0ink:feat/pdfviewer-custom-start-page

Conversation

@b0ink
Copy link

@b0ink b0ink commented Aug 11, 2024

Description

Implements an optional [startPage] input property to the f-pdf-viewer component that accepts a page number that the pdf viewer will scroll to when it renders.

This PR adds [startPage]="2" to only the f-pdf-viewer used in the tutor inbox section, so that tutors no longer have to scroll past the initial page in every submission.

Example:

    <f-pdf-viewer [pdfUrl]="pdfUrl" [startPage]="2"></f-pdf-viewer>

Notes:
The startPage property will default to 1 if it's not passed in the component.
However, if startPage is 1, the initial scrollToPage(this.startPage) function will not be called in onPageRendered() since users could already be scrolling down before this is called - and onLoaded() is called too soon to use scrollToPage(). (Overall behaviour remains the same)

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • Testing this requires a multi-page PDF, so you can temporarily copy over doubtfire-api/test_files/submissions/1.2P.pdf into the doubtfire-api/test_files/unit_files/ directory and rename it to sample-student-submission.pdf to override the original single page PDF
  • Alternatively, login as a student and upload a multi-page PDF to a task that atutor has access to, then run rake submission:generate_pdfs in doubtfire-api
  • Login as atutor and select any unit, then select either the Inbox or Task Explorer dropdown
  • Ensure you're not using the native PDF viewer by keeping the toggle icon (next to the download icon) in the off position.
  • When selecting a submission from the list, the pdf-viewer will automatically load the PDF submission from the second page

Testing Checklist:

  • Tested in latest Chrome
  • Tested in latest Safari
  • Tested in latest Firefox

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

@b0ink
Copy link
Author

b0ink commented Apr 6, 2025

merged in upstream

@b0ink b0ink closed this Apr 6, 2025
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