Skip to content
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

Parse the AcroForm dictionary #12226

Closed
timvandermeij opened this issue Aug 17, 2020 · 4 comments
Closed

Parse the AcroForm dictionary #12226

timvandermeij opened this issue Aug 17, 2020 · 4 comments

Comments

@timvandermeij
Copy link
Contributor

We don't really use this data now, but it could contain the default appearance for form elements. It seems like the current font code for text widgets is dead as fontRefName is never set, so we should parse this dictionary and extract the font information from it.

@Snuffleupagus
Copy link
Collaborator

[...] as fontRefName is never set,

Also, note that's a slightly misleading name and it really ought to be changed to loadedName (or possibly fontLoadedName) as part of fixing this issue.

@calixteman
Copy link
Contributor

I'm not sure to understand this issue...
Don't we already do that:
https://github.com/mozilla/pdf.js/blob/master/src/core/annotation.js#L815-L824 ?

@timvandermeij
Copy link
Contributor Author

timvandermeij commented Aug 27, 2020

You're right that we now at least use the data for printing in contrast to before where we didn't use it at all. This issue is about using it for non-form rendering, so just as normal annotations. For printing we render the annotation onto the canvas, but for displaying we render an overlay element so e.g., text selection is possible. That code still doesn't work properly; look at

let font = null;
if (
this.data.fontRefName &&
this.page.commonObjs.has(this.data.fontRefName)
) {
font = this.page.commonObjs.get(this.data.fontRefName);
}
this._setTextStyle(element, font);
}
for example and notice that there is no code that actually sets fontRefName.

@timvandermeij
Copy link
Contributor Author

Closing since this code is now replaced by working code and we use the default appearance properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants