-
-
Notifications
You must be signed in to change notification settings - Fork 93
PDF rendering support #1619
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
base: main
Are you sure you want to change the base?
PDF rendering support #1619
Conversation
…rd system and text transforms etc, but should be good now.
…in render; fix times-roman
…er / rich.Settings: it wasn't using the args passed in shaper anyway, and it is just cleaner to have one definitive location for global rich text settings (font names etc), so cleaned that up.
…ll at all -- offsets are off
…roperties control pagination. just needs testing of that and floats
…ive transform -- pdf and svg renderers actually need the incremental one, not Cumulative! fixes pdf rendering of svgs (modulo missing features).
…thors to just a string so you can do random formatting on it.
…ays, using to center figures, prevent page breaks on headers, etc.
… the commentary about changes.
kkoreilly
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments through content.
| // Authors are the optional authors of the page. | ||
| Authors []string | ||
| // Authors are the optional author(s) of the page. | ||
| Authors string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why a string not a slice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it is awkward and unnecessary to have to parse and format. Just put everything as it should be in a string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe, but there also may be some contexts where it is useful to have each author separately. For example, if in content we want to have automatically generated author pages where you can see everything that someone has written, you need each author separately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated thoughts on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just think it is too complex to deal with the formatting issues for academic-level author strings, where for example you need to be able to put affiliation symbols and other such things. When we implement search functionality, it would be easy to search within author string for name(s) etc. If we end up needing separate author strings later, it is easier to add those and then have them format into the current Authors string, which is the definitive record, so let's just put that on the stack and deal with it if/when it becomes necessary, OK?
| }) | ||
| }) | ||
| tree.Add(p, func(w *core.Button) { | ||
| w.SetText("PDF").SetIcon(icons.PictureAsPdf).SetTooltip("PDF generates and opens / downloads the current page as a printable PDF file. See the Settings/Printer panel (Command+,) for settings.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Placing this in the main toolbar by default is rather aggressive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?? this is essential functionality, that works in all cases!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Especially having it at the start of the toolbar takes attention away from other buttons that are presumably more important for most people. I would rather have a general scene context menu button for PDF that you can use in any context (not just content), which would be quite useful.
Or if it is specific to content, still put it in a context menu, or at least not at the start of the toolbar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how to add a default item at the end of the toolbar. we can add it to the overflow, but not to the end. it is very small. I suggest you let this one go for now and file an issue if you really want.
kkoreilly
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments through gpu.
kkoreilly
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments through math32.
kkoreilly
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments up to paginate.
|
|
||
| func init() { | ||
| paint.NewSVGRenderer = svgrender.New | ||
| paint.NewPDFRenderer = pdfrender.New |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the impact of always importing the pdf renderer on binary size? Should this be more optional?
If it is included in every app, then we might as well put export to pdf in the default scene context menu.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it IS already in the core namespace, via the Grab snapshot keybinding (Control+Shift+G) -- try it! drops SVG, PDF, and PNG versions! Key point: you need a keyboard shortcut, not a menu, because otherwise the menu shows up in the snapshot!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Presumably we could have a menu button that uses Defer or something like that to wait until the menu is closed before grabbing a snapshot. It's hard for an end user to know about Control+Shift+G, and it is also a nonstandard shortcut as far as I know. What about a print button with shortcut Cmd+P?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about another issue? sounds like it could be a bit complex and finding shortcuts is nontrivial, although the docs/keymaps page does suggest that Control+Shift+P is not taken. forget about Control+P however: that is core emacs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want to try to get this working now, or should I file a separate issue? If we aren't doing this now, then what are you proposing we do with the pdf button in the toolbar?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
file separate issue. I would just keep the PDF where it is because it is small and useful and not really doing any harm, while providing key benefit for some users / sites.
kkoreilly
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments through rich.
kkoreilly
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All reviewed!
…th margins in printer settings.
…ally), including WrapPi convenience function, along with associated tests, including for previously untested Truncate and IntMultiple functions.
…e gets set as fully transparent color, in which case text render mode should not render stroke.
…ugs, and MinAngleDiff for subtracting angles.
converting code from tdewolff canvas PDF rendering to support direct rendering to PDF files.