Skip to content

[Fix] Add support for documents with 270 degree of page rotation #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jesusmongedev
Copy link

Fix #3

  • Properly display pdfs with 270 page rotation, and expected behavior when selecting areas.

@@ -161,7 +161,7 @@ export class PdfViewer<D extends object> extends Component<PdfViewerProps<D>, Pd
for (const page of pages) {
const width = page.view[2];
const height = page.view[3];
const orientation = page.rotate === 90 ? PDFOrientation.LANDSCAPE : PDFOrientation.PORTRAIT;
const orientation = page.rotate === 270 ? PDFOrientation.LANDSCAPE : PDFOrientation.PORTRAIT;
Copy link

Choose a reason for hiding this comment

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

I think it should be

Suggested change
const orientation = page.rotate === 270 ? PDFOrientation.LANDSCAPE : PDFOrientation.PORTRAIT;
const orientation = Math.abs(page.rotate) === 90 || Math.abs(page.rotate) === 270 ? PDFOrientation.LANDSCAPE : PDFOrientation.PORTRAIT;

since according to metadata2go 90 and -90 are possible valid values for landscape

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.

The Area Selection must have support for documents with 270 degree of page rotations.
2 participants