Hello
Would it be possible to add the ability to set custom page sizes such as A5 or using any custom dimensions such as 134mm x 233mm etc.
Specifically targeting Printed Books
+1
That would be useful, especially for printing manuals or books.
:+1:
Currently, it's possible to set the page size by customizing the theme. You can see where it's set:
https://github.com/asciidoctor/asciidoctor-pdf/blob/master/data/themes/default-theme.yml#L33
and where it's applied:
https://github.com/asciidoctor/asciidoctor-pdf/blob/master/lib/asciidoctor-pdf/converter.rb#L167
However, this is definitely a setting that makes sense to be able to override from within the document (or using an ad-hoc attribute assignment passed to the cli or API). I'm envisioning something like:
= Document Title
...
:pdf-page-size: A4
Does pdf-page-size sound like the right attribute name?
would this attribute be only for pdfs ?
if not, then how about this naming convention
pagesize-[x]
pagesize-pdf
pagesize-epub
Very likely this is only for PDFs. If we did decide to abstract it out, then perhaps we could say "print", but I'm not sure there's much value in adding that level of indirection.
I'm open to the the attribute name pagesize-pdf, though many of the attributes already read sentence style, so pdf-pagesize might be more comfortable for existing authors. Let's see what others have to say.
Was this released in 1.5 ?
Not yet. This is still scheduled to be completed. I'll mark it as a hackfest item as it's a nice self-contained change.
I decided to go with the attribute name pdf-page-size. Note that this attribute now supports setting the width and height using dimensions with units, including in, cm, mm and pt.
For example:
:pdf-page-size: [8.25in, 11.69in]
Units can also be used in the theme file.
Let me know if this looks good and I'll merge.
I've added support for the syntax width x height (e.g., 8.5in x 11in). I also switched to a manual and more strict parser instead of delegating to YAML. See https://github.com/asciidoctor/asciidoctor-pdf/commit/29b32931b38e844b7d59cd80ee0c9b4f73cb1362.
Most helpful comment
I decided to go with the attribute name
pdf-page-size. Note that this attribute now supports setting the width and height using dimensions with units, including in, cm, mm and pt.For example:
Units can also be used in the theme file.