-
Notifications
You must be signed in to change notification settings - Fork 500
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
Support page layout (landscape/portrait) per page #490
Comments
I like this idea, except that the correct way to do this is by using a block attribute on the page break macro.
or simply
I've proposed something similar in #250 (comment). |
Of course, we could consult the |
I do not know the asciidoctor codebase well enough so could you clarify: When you say document attribute, are those the top-level attributes or those per block (context)? It may be easier and less invasive to only support block attribute on page_break macro. |
Top-level. They are often defined in the document header, but can also be defined between any two blocks.
Your solution works, it's just that you are essentially using a global variable (document attribute) to control the behavior of a local component (the block). This is exactly why block-level attributes were introduced. You can define settings directly on the block node. It's also more semantic.
This is the direction I'm leaning. We should probably support both size and layout. |
Not sure in what stage of development this is at the moment, but if it is being developed, I would like to suggest to give the end user not only the ability to specify the page orientation, but also the page size. For example, it would be great if I could have an A3 landscape page inside an otherwise A4 portrait document. That A3 page could be used for detailed graphics, a huge table, a scaled down blue print, etc. When printed, the A3 page can be neatly folded, inline with the rest of the pages. Marc. |
That sounds reasonable. The risk in this feature is that there are several places (I think) where we assume that the size of every page is the same. We could no longer make that assumption, or we'd have to enable a flag to disable it (and thus compute each time or on specified pages). |
This would be awesome to have. I've gotten requests about this from my users now as well. |
@veeg Could you share how you achieved your hack so I can use that until the full implementation is done? |
@mojavelinux I would think something like
Or
would make sense to control this. Then you should move layout to "base" since this will be the baseline default unless overridden in the document.
|
bump |
1 similar comment
bump |
Merged. We don't yet have support for controlling the margins per page, so all pages still get the same margins. |
When using Asciidoctor PDF backend,
works to flip the page, but
doesn't flip it back. |
@dalemartin Uh oh! We could be missing a test. Could you file a new issue so that I can address it specifically? |
For sure. EDIT: I opened #1091. |
Prawn supports different page layout per page. (through start_new_page and Document.new).
Asciidoctor-pdf could support toggle-able page layout for next page to be started.
I hacked abit on the source to experiment a bit, but did not find any clean solution.
I replaced all calls to start_new_page with a super method that takes the current node and retrieves
the :page-layout: attribute from it. But this probably would not work if the start_new_page is called in a block without this attribute set. This attribute should probably work similar to the :numbered: (sectnum?) toggling. Thus, it would need to be present in all blocks?
Given the following ADoc source:
I was able to produce this PDF:
layout.pdf
I'm looking for both discussion and suggestions to how this could be implemented (if of course this is at all anything you desire to be part of Asciidoctor-pdf). I'd be more than happy to work on it further.
The text was updated successfully, but these errors were encountered: