Is there a way to include code in a template to set the pdf page orientation differently for a specific content type? Or some other way to do this?
Is there a way to include code in a template to set the pdf page orientation differently for a specific content type? Or some other way to do this?
Comments
Comment #1
jcnventuraNot currently. The page orientation is a module-wide configuration that is not possible to change at each content type.
It would be possible to add code to do it, but I don't have the time to do it, nor do I think that that feature is in great demand.
João
Comment #2
jcnventuraNo further info in two weeks. Closing the issue.
Comment #3
Musicious commentedHi,
I understand this topic was closed. I love your module and thank you for your work.
I do believe that this functionality would be amazing and could be very useful.
I very much need this. I am quite sure others may want this too.
Thanks
Comment #4
g.anedda commentedHi, we have the same problem here, but we have arranged a "dirty" solution for the problem.
Modify the file print_pdf.pages.inc at this point (modifications delimited by comments)
And add this new piece
at the beginning of template pages of the content types that you need to have changed.
This dirty solution let you change temporary your chosen orientation to let you get a pdf oriented as you want.
Comment #5
Skispcs commentedDo you think it is possible to do this with a view?
I can currently print a View using this module but I want this one view to print in landscape while the regular pages print in portrait.
I tried adding
to the header as PHP input but that did not work.
Comment #6
Skispcs commentedMade this work by adding
to views-view.tpl.php
and I added the other part to the print_pdf.pages.inc.
I am sure that there is a better way by making a new custom views template but for now all of the views I need on this site should be in landscape so it works.
Comment #7
ice5nake commentedI'd love to see this happen and it sounds like there have been several users requesting it.
The hack above uses global variables which feels really dirty to me. It seems like there should at least be a cleaner way to set this within your template.php file or even at the top of a template.
Comment #8
jcnventuraDuplicate of #1366296: Add ability to set Paper Size and Orientation per Content Type and Per Node
Comment #9
louis delacretaz commentedA quick way to set paper orientation per content is to add a hook_alter to print_pdf.pages.inc in each function that sets $print_pdf_page_orientation. ie _print_pdf_dompdf() _print_pdf_tcpdf() and _print_pdf_wkhtmltopdf()
Then in your custom module add a hook_print_pdf_page_orientation_NODETYPE_alter to change the orientation