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
Tile two pages with rotations #440
Conversation
I'm confused: Is this about cutting pages to pieces or joining them together? Maybe it's only me but when I hear tiling I think of cutting to pieces (tiles). |
It is about putting the content of two pages onto a single page. |
I see, if you think about it this way, tiling makes sense. Maybe "joining" leaves less room for misunderstandings but if I'm the only one confused here we may es well continue using "tiling". Thanks for the clarification! Unfortunately I don't have time to dive into this new feature, I still have Windows CI and the Annotations bug on my todo list, but it sounds like a great addition to PDF Arranger 👍 |
Looks like a good start. Using temporary files is not a problem imo. I have no good ideas how to handle crops. (rendering pages to images and tile the images, but that is probably not what we want)
Maybe it could check that an even number of pages are selected and then tile them two by two. Or then it could be like it is now. |
This pull request introduces 2 alerts when merging b8b47e2 into 20370a4 - view on LGTM.com new alerts:
|
This pull request introduces 1 alert when merging 06e0f51 into 20370a4 - view on LGTM.com new alerts:
|
Let's make that decision later. The current version only stitches 2 pages. Sometimes pages that logically should be stitchable are not.
A and B should have exactly the same dimensions - unfortunately in practice they are not guaranteed to have this. I assume that we have to relax the criterion when pages are stitchable to allow for some rounding error. I consider this a minor point. |
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 found one case that does not work as expected. To reproduce:
- Open a pdf and rotate all pages 90 degrees
- Export
- Open the exported file
- Stick two pages -> it does not look right
Some things I would still do:
- Delete the "source" pages
- Insert the new page after last selected page
- Maybe do a scroll_to_selection() to center the stitched page in window. (because cell size probably change after the operation and the page could be lost out of sight otherwise)
I am not happy with the integration into the undo manager. To restore the original two pages, you have to undo twice. Both the deletion of the original pages and the pageadder are a single action that is tracked. I don't know how exactly the undo manager works and currently do not see an easy way out, do you? |
@jeromerobert wrote the undo manager. I haven't looked into this specific problem but it sounds doable to me. Maybe understanding and modifying the undo manager is necessary. |
* Pages with rotation rotate the content and move the content to the final position. * Pages with a mediabox [x1, y1, x2, y2] where x1, y1 > 0 create a temporary page such that the mediabox is [0, 0, width, height]. Crop creates such pages. This facilitates the side-by-side placement of pages because rotations are around (0,0). * Without a tmp page, it is not possible to stitch pages where the glue side is cropped. Ex: Crop A l: 0, r: 50%, crop B l: 50%, r:0, stitch [A | B]. * Pages with scaling create a temporary page
Should have rebased earlier - would not have encountered my problem with the undo manager. Great work again, kbengs |
Nice. Found a few more things:
|
In case anyone is interested, the Fujitsu Scan Snap Organizer Viewer has a stitch feature they call Merge, with "Merge Vertically" and "Merge Horizontally" as the two options. One has to select the two pages and right-click to see it in the context menu. I also support the idea of some sort of bulk stitching method, where a user could, say, select a contiguous group of even amount of pages and pdfarranger would execute the stitches on each pair from left to right. I realize this is not easy to code, but it sure would make for a powerful feature and a nice compliment to the "Split Pages" feature. |
Hi, any progress on this ? I would love this feature <3 Thanks. Being able to put two A4 paper into one A4 paper (by scaling and rotating) would be really usefull. |
This was implemented in #847 |
First proposal towards page tiling #246.
Justification of the design decision:
We now have to rotate the content (not just the page orientation). To compensate, we have to shift the content back into the first quadrant of the Cartesian coordinate system. Rotations work recursively. Hence, it is a challenge to tile more than two arbitrarily rotated pages in a single step. Therefore the functionality is limited to two pages and the (hopefully correct) offsets are hardcoded. I consider this easier to maintain than solving equations to get the shifts right. This is not a limitation because it is possible to apply tiling repeatedly.
Known issues:
Input needed: