Feature request: Mixed page orientation #1564
Comments
Unless you provide a patch or a technical suggestion on how to accomplish this (in terms of changes required in QT), this is unlikely to get implemented. |
So you think changes in QT are needed? Why? |
See QPrinter::setOrientation -- it is up to the printer driver to pick up changes or not, and I don't think that the PDF print driver in QT handles it correctly. |
QPrinter::PdfFormat support page orientation set. At least in Qt 4.8.5 from Debian jessie. next code generate pdf with 3 pages (portrait, landscape, again portrait):
|
Pleas re-open issue. |
@fjoho: I think that point 1 can be achieved by moving For point 2, it will require changes at the WebKit level so that part remains unchanged. |
Why move orientation from being a PdfGlobal property? Just add --page-orientation as a PdfObject property. If --page-orientation is set, then override PdfGlobal property for that page. |
Are you willing to contribute a patch? I'm not interested in it as such, but will review/integrate a patch which implements this. |
I do not have enough experience with C++ to help with this. If you re-open the issue then maybe someone else will help? Many will probably have use for this sooner or later. |
I haven't seen any major C++ contributions to this project other than from @pruiz in the last two years. I don't think that I will be able to focus on feature requests or minor bugs until wkhtmltopdf is ported to Qt5, as that is a massive effort in itself. I have a very simple criterion: if the bug is simple to solve i.e. taking less than 2-3 hours effort, I will solve it immediately otherwise it won't be addressed. If I do get time in future, I can easily track such issues by the label -- I mark such issues as PatchNeeded or UpstreamChangeNeeded. |
Was that implemented? |
Don't think so, but i will love to see it implemented. |
here we go: +1. Now, a year passed since it was filed, how is your take on that currently? |
@tomw1808: I don't really have time to take it up. I'm quite busy in my day job and my 1-year old kid takes up almost all of the free time, so any effort that I put here is mostly in the |
@ashkulz I totally understand that. I am having private side projects myself and a family aside (or vice versa), its almost impossible to keep work-life balance while still developing for my own projects. Unfortunately I am no qt developer, or I would take on that. I hope someone will hear my prayers and hop on to contribute to that really awesome project. Wish you all the best for you and your family! Thanks for writing back and a good day from Austria. |
@tomw1808: Thanks for the appreciation 👍 |
@ashkulz , I am thinking about an approach that
Does that make sense ? Will update once I have an implementation available. It might take some time since my C++ is rusty. |
Looking forward to this :) |
I think the approach might not work as I though. By the time code gets down to printing pages, all JS has already been executed. Flow of the code seems to be
So, info provided by JS would be lost by the time PDF is rendered. This might still work if there is some kind of callback each time QT starts rendering a new page. Will investigate further over next weekend. |
Add a command line option "--custom-orientations" to specify custom page orientation for each URL. Example is "wkhtmltopdf.exe --custom-orientations PLP page1.html page2.html page3.html test_unit_03.pdf" In this example, three URLs are supplied and "PLP" indicates page orientation for each URL (Portrait for 1st, Landscape for 2nd and Portrait for third)
Need help with testing this implementation. Change : shamitv@0330bd0 Windows Binary : https://github.com/shamitv/wkhtmltopdf/releases/tag/v0.12.2.5 HOWTO : (Optional) parameter --custom-orientations. Value of the parameter should be a string with one character for each input URL. Character can be P or L for Portrait / Landscape. Example : |
@shamitv I can't test ( I get error and i can't correct it( /usr/bin/xvfb-run: line 166: 28785 Segmentation fault (core dumped) DISPLAY=:$SERVERNUM XAUTHORITY=$AUTHFILE "$@" 2>&1 |
Which platform are you testing it on? I can try recreating on the same platform (Linux/Windows distribution, version and 64 v/s 32 bit) |
@shamitv |
@shamitv As AmeliRiddle, I can't test it. I get an error (crash) while generating a pdf with more than 1 html file. This is the command line I use to test it : Are you still working on this feature ? |
@eadelon , thanks for the feedback. Would it be possible for you to reproduce this issue with this Binary : https://github.com/shamitv/wkhtmltopdf/releases/tag/v0.12.2.5 ? |
Just downloaded and tested this on windows 2008R2 64bit and does work with multi format pages PLP with a title page and a toc built. However there is an issue with 100% widths not filling landscape pages 100%. A 100% table width does fill a portrait page fully but only 75% of a landscape page, so there is an issue with this - landscape pages having 25% whitespace on the right hand side. Any ideas? If this could be sorted I'll start using it. Many Thanks. |
Hi, would it be possible to provide sample html files / urls to test this issue with width of table ? |
Here you go, 3 html files with tables set 100% width. Resulting PDF shows ok title page and table of contents but the widths are Called from perl using my $output_part_file1 = system qq{"$filepath" --custom-orientations PLP $title_file $template_toc where $filepath" is path to executable $title_file is qq{cover "titlepath and filename" $template_toc is qq{toc} etc. Cheers Pat. On Mon, Feb 1, 2016 at 4:45 PM, Shamit Verma notifications@github.com
|
Tested with some more HTML and the result is always the same. Where you have 3 html files and you want Portrait followed by Landscape followed by Portrait. The first file is rendered correctly Portrait with the correct width and styling, colours etc.. Just to note also that header-right and footer-right on the Landscape page is correctly positioned to the far right of the page. Looks like page size settings may need to be applied along with the landscape global override I'm afraid. Pat. |
OK here is my offering... Implemented a new PDF Object parameter --page-orientation with a value of P for portrait and L for landscape. Given 3 HTML files where you want First Landscape, Second Portrait and Third Landscape invoke as follows: wkhtmltopdf.exe part_1.htm --page-orientation L part_2.htm --page-orientation P part_3.htm --page-orientation L Output.pdf Follow the instructions for building on debian jessie 64bit as per the install.md file then overwrite the src and include directories with the attached and then build your binaries. Tested on Windows 2008R2, Unbuntu 14LTS and Debian Jessie. Thanks to @shamitv for showing the way, the issue with his code was that you needed to change the orientation in 2 places - once while printing as his does but also on web page build. Pat. |
@PerlTester: can you make a PR with your changes? |
Yes happy to do but need to figure out howto :-) I am a Github newbie |
Maybe this article can be a starting point? |
Thanks. I'll give it go over the next day or so. Pat. On Thu, May 12, 2016 at 2:06 PM, Ashish Kulkarni notifications@github.com
|
It will be great to have this feature included. |
@PerlTester Is this merged with the main repo? |
Hi damodaran, I created a pull request last year but the maintainer said it crashed for him though it works for me on multiple platforms, Linux and windows, ... maybe you can message him to see where its at @askulz Thanks |
Hi, All |
It will be great to have this feature included. |
any news? |
Would be great to have this feature |
Hi, any good news ? |
New pull request |
Just for info I have provided a new v.2019 push request so hopefully this
can finally make its way into the master.
PerlTester
…On Mon, Aug 5, 2019 at 9:52 AM Mohammad Reza Bahmany < ***@***.***> wrote:
Hi, any good news ?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1564?email_source=notifications&email_token=AAUT4NLEJQGLVPZTA24T66LQC7L3HA5CNFSM4AMSXPH2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3Q7YAY#issuecomment-518126595>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAUT4NM47UXLYJ6GVBXNQODQC7L3HANCNFSM4AMSXPHQ>
.
|
Some ideas how to implement mixed page orientation:
The text was updated successfully, but these errors were encountered: