Closed pgodwin closed 2 years ago
This may be a duplicate of #7631.
Didn't have a luck fixing it on pdf.js side itself. So in the meantime, had a workaround to manually rotate the fields on load.
in the annotation_layer.js
I've added the ff in TextWidgetAnnotationElement
element.setAttribute('data-rotation', this.page.rotate);
Then added this fix after the event textlayerrendered
const inputs = Array.from(document.getElementsByTagName('input'));
for (const input of inputs) {
const rotation = +input.getAttribute('data-rotation');
if (rotation > 0 && input.offsetParent) {
const oldWidth = input.offsetParent.clientWidth;
const oldHeight = input.offsetParent.clientHeight;
input.style.transform = `rotate(${-1 * rotation}deg)`;
input.style.width = `${oldHeight}px`;
input.style.height = `${oldWidth}px`;
let to = 0;
if (rotation === 90) {
to = oldHeight / 2;
} else if (rotation === 270) {
to = oldWidth / 2;
}
input.style.transformOrigin = `${to}px ${to}px`
}
}
What's the status on this? I use pdf.js as part of FoundryVTT (for online RPGs)
@calixteman I vaguely remember you saying you had a fix for something like this?
Yeah I've something somewhere in my stack.
Any news on this?
Any news on this ?
Once #15060 lands, we should make sure the issues duplicated to this are actually all fixed.
I checked all duplicates, they were all fixed!
Acrobat form fields are not rotated correctly on the page.
Attach (recommended) or Link to PDF file here: private-patient-hospital-claim.pdf
Configuration:
Steps to reproduce the problem:
renderInteractiveForms
totrue
on the viewerWhat is the expected behavior? (add screenshot) Adobe Reader 11:![image](https://user-images.githubusercontent.com/1046558/37754539-a38b699e-2ded-11e8-9277-a85a85364134.png)
What went wrong? (add screenshot) Text fields did not rotate with the page correctly:![image](https://user-images.githubusercontent.com/1046558/37754502-8abec9f6-2ded-11e8-831e-627ceffd018e.png)
Link to a viewer (if hosted on a site other than mozilla.github.io/pdf.js or as Firefox/Chrome extension): Default viewer from pdfjs-1.10.88-dist. Edit, tested on mozilla.github.io/pdf.js with the same issue