MiltonBalaOfficial / IncreaseAndDecreasePageDimensions

Increases and decreases page dimensions.
1 stars 0 forks source link

Feature Request: Xournal++ Backgrounds for the new added space #2

Open 6xthFNGR opened 1 week ago

6xthFNGR commented 1 week ago

Hey,

may I ask if its possible to get the standard Xournal++ Backgrounds filling the added "empty" space?

So, instead of transparent/grey space Screenshot from 2024-11-24 13-32-22

Setting Xournal++ backgrounds for the new space similar to this: Screenshot from 2024-11-23 21-45-13

Im not sure if its maybe possible to elevate the source PDF Background Layer ontop of another Layer your Plugin creates, so your Layer becomes the true background?

Priority to me: High

Thanks ahead

PS: Please add some donation button into Git :)

MiltonBalaOfficial commented 1 week ago

It is not possible right now, but you can apply trick to make it more presentable. If you want the area presenting better, then go to preference > view > background color between pages and change the color according to your PDF background. But keep it mind that If you print the document the area will remain transparent!

Robin-Sch commented 1 week ago

Iirc this was working before, or at least with the work around I mentioned on the Xournal++ repo. Although I was working with the Xournal++ lines layout, not pdf (which I guess breaks it)

6xthFNGR commented 1 week ago

@MiltonBalaOfficial Thank you for the advice. Is there any way you or @Robin-Sch like to contribute in fixing it - maybe as Robin suggested using a different feature (lines layout?). I can not interprete the code, but if that quirk can be solved in any way this Plugin would be really satisfactory!

Maybe its possible to copy/paste the background Layer, place it onto a intermediate layer (Layer 1), replace the background layer with X++ "Inser Page" Backgrounds and create Layer 2 for the regular user inputs?

Robin-Sch commented 1 week ago

I wonder if it would be possible to set the background: https://github.com/xournalpp/xournalpp/blob/98f602113a6b335ccb415fa9da13fd67094e284f/plugins/luapi_application.def.lua#L412 and then call changesize? Or would that just overwrite the pdf?

Maybe its possible to copy/paste the background Layer, place it onto a intermediate layer (Layer 1), replace the background layer with X++ "Inser Page" Backgrounds and create Layer 2 for the regular user inputs?

Sadly it seems like the plugin system doesn't allow for changing layers easily like that

MiltonBalaOfficial commented 1 week ago

Maybe its possible to copy/paste the background Layer

I have studied the file format and cannot find a way. As like as the other background cannot be cut/copy/paste, the PDF background also cannot be copy paste. But a rectangle with solid fill (color as the pdf) can be copy/pasted over the blank space after increasing the page. Then have to annotate on the second layer, keeping the solid filled rectangle on first layer and the PDF as background layer. If the rectangle is drawn for the first page then It can be pasted on all the pages through the help of a plugin

MiltonBalaOfficial commented 1 week ago

would that just overwrite the pdf?

yes!

Robin-Sch commented 1 week ago

https://github.com/xournalpp/xournalpp/issues/1815#issuecomment-1728503660

I'll take a look if I can get this to work tmrw, it sounds promising?

MiltonBalaOfficial commented 1 week ago

xournalpp/xournalpp#1815 (comment)

I'll take a look if I can get this to work tmrw, it sounds promising?

I tried to work with images, But the app becomes laggy to a great extent and it is very annoying. https://github.com/xournalpp/xournalpp/issues/1815#issuecomment-1728431681, You may try and let me know about the progress.

Robin-Sch commented 1 week ago

Did you manage to get the lua plugin for vips to work? I get some error related to the "ffi" module: https://github.com/libvips/lua-vips/issues/86

MiltonBalaOfficial commented 1 week ago

Did you manage to get the lua plugin for vips to work? I get some error related to the "ffi" module: libvips/lua-vips#86

No, I never worked with vips. Actually I used openboard before shifting to Xournal. I had to import many notes to Xournal. Then I tried to work with the images that openboard saves in its file format. But that didn't work well (laggy issue). So, I write Python parser to convert the openboard strokes to Xournal strokes.

MiltonBalaOfficial commented 1 week ago

may I ask if its possible to get the standard Xournal++ Backgrounds filling the added "empty" space?

Though Xournal++ background cannot be added to the empty space right now, I have tried to make the area looks like the pdf background, the background will remain when printing or saved in other format. Try the updated plugin and give your feedback. ReadMe is also updated, just follow the instruction.

I think you will love the updated version.

6xthFNGR commented 5 days ago

I think you will love the updated version. Hello Milton!

Today I finally had some time to tinker a little bit with your plugin.

I have to say, I really love your workaround. While it’s not a full substitute for features like grids or snapping to a grid in X++, it’s amazing how you managed to implement such a useful solution given the limitations of what a plugin can modify within the program.

Now that your plugin has matured so much, perhaps it’s worth considering reaching out to the X++ developers to ask whether the background feature could be made accessible to plugins? It seems like there’s a real use case for it, and your work demonstrates its value.

Minor Feedback for You: When I increase a page horizontally, it appears that there’s also a slight increase vertically. I know this isn’t an issue with your code, as it clearly specifies no increase for the other axis. However, X++ seems to render it this way. It’s not something I think requires immediate action, but I wanted to point it out so you can reproduce the behavior and take a look if needed.

Here’s the setup where I noticed this:

---> If possible, it would be nice if the Toggles Names would change so I can see the setting, like: "Toggle Document Base Adjustment: Set to cm" or "Toggle Document Base Adjustment: Set to %", as well as "Toggle Fill Empty Space: On" or "Toggle Fill Empty Space: Off" if that is possible by some simple if/else addition of your code?

Lets continue: Screenshot 1: Zoomed in heavily (500%+), you can see that the PDF background sits flush with the bottom border. However, the minor white line on the right side is not part of my PDF background! It must be something in X++, as the same PDF opened in a standard PDF viewer does not show this white line.

Screenshot from 2024-11-28 20-28-32


Setp 2: I IncreaseRightAll by cm with white colored pen. Screenshot 2: You can see, the PDF background now does not touches the bottom border but some additional white space is created

Screenshot from 2024-11-28 20-29-26


Setp 3: I than IncreaseRightAll with a blue Pen: Screenshot 3: You can see that the same white space is now blue.

Screenshot from 2024-11-28 20-30-25


Setp 4: I than IncreaseRightAll with a purple Pen. Screenshot 4: You can see that the same blue line now is purple... and so forth.

Screenshot from 2024-11-28 20-30-41


Saving the changes to create a new .xopp file and then reopening it, the same visual behavior persists.

I haven’t yet tested the IncreaseBottom feature to see if the same behavior occurs with vertical height, but you get the idea and can likely reproduce or test this behavior on your own machine.

As I mentioned earlier, I suspect this is due to X++ itself, and it’s probably not something you can fix. For me, it doesn’t seem like a major issue at the moment. However, I noticed it immediately while increasing the page size, so I wanted to share this feedback with you.

--> This might be of interest to the X++ developers and could help them pinpoint where the issue originates.

When I’m back at the office next week, I’ll make sure to send you a couple more coffees as a thank-you! :)

Thanks again for all your great work!

MiltonBalaOfficial commented 5 days ago

I wanted to share this feedback

Thanks for your feedback, I will try to fix the issues if it can be solved with my knowledge. Let me allow some time.

MiltonBalaOfficial commented 5 days ago

I IncreaseRightAll by cm with white colored pen. Screenshot 2: You can see, the PDF background now does not touches the bottom border but some additional white space is created

Issue solved, give a try and give feedback if any new issue arises

MiltonBalaOfficial commented 5 days ago

If you want any other plugin that can help you, or any idea that can be achieved through plugin that can save time or enhance user experience let me know. It will be great playing with the codes!

MiltonBalaOfficial commented 5 days ago

Zoomed in heavily (500%+), you can see that the PDF background sits flush with the bottom border. However, the minor white line on the right side is not part of my PDF background! It must be something in X++, as the same PDF opened in a standard PDF viewer does not show this white line.

yes, it is a Xournal++ issue.

MiltonBalaOfficial commented 5 days ago

---> If possible, it would be nice if the Toggles Names would change so I can see the setting, like: "Toggle Document Base Adjustment: Set to cm" or "Toggle Document Base Adjustment: Set to %", as well as "Toggle Fill Empty Space: On" or "Toggle Fill Empty Space: Off" if that is possible by some simple if/else addition of your code?

I have tried something as you wished, do the changes meet your expectation?

MiltonBalaOfficial commented 5 days ago

Now that your plugin has matured so much, perhaps it’s worth considering reaching out to the X++ developers to ask whether the background feature could be made accessible to plugins? It seems like there’s a real use case for it, and your work demonstrates its value.

Try to make a feature request on Xournalapp repository. If the implementation is easy the devs may consider it, though I have no idea whetether it is easy or complicated.

6xthFNGR commented 5 days ago

Hey,

Just a quick update:

I tried your new version—thank you for the quick edit! May I ask if it’s possible to implement a way to toggle "Fill Empty Space" without requiring X++ to restart? That would be incredibly useful, as it would allow users to change the setting on-the-fly while working, switching back and forth as needed.

Why would this help?

This flexibility would be ideal, as I like to extend PDF background pages with your pen color workaround ("Fill Empty Space" On), but whenever I "Insert Page," I prefer to have "Fill Empty Space" set to Off.

Regarding your new toggle descriptions: Personally, I would prefer to see the current state displayed, such as "Fill Empty Space: On" or "Fill Empty Space: Off", when hovering over the toggle. However, I’m fine with your preference of describing what will happen when the toggle is pressed again. No need to update or reupload anything for this—just sharing my thoughts.

Thanks again for your great work!

MiltonBalaOfficial commented 5 days ago

May I ask if it’s possible to implement a way to toggle "Fill Empty Space" without requiring X++ to restart? That would be incredibly useful, as it would allow users to change the setting on-the-fly while working, switching back and forth as needed.

With a little more research with the code I have found a way to do that dynamically while the app is running, but the menu name cannot be changed dynamically through plugin till now as the app gets the menu name while loading. If you toggle the functionality message will be shown displaying the current state though. As you can change the adjustment or fill/empty functionality on-the-fly but the menu name cannot be changed isn't it better to set fixed menu names as Toggle %-based/cm-based adjustment and Toggle fill /blank extra space? what is your opinion? you might suggest another fixed menu name.

I am working with the code, after getting your opinion I will finish the work and upload it.

6xthFNGR commented 4 days ago

That sounds amazing! Im excited for the updated version! Sure - fixed menu names are fine as soon as the code is dynamic!

MiltonBalaOfficial commented 4 days ago

I have finished working with the code and uploaded the upgraded version. give a try and give me feed back

6xthFNGR commented 4 days ago

Works like a charm! I can even see on the same page that toggling "Fill Empty Space" on and off while increasing the space works dynamically: "Fill Empty Space" is correctly written to its layer, and for pages with X++ backgrounds, the entire background increases seamlessly. :)

Screenshot from 2024-11-29 21-06-58

It feels like we’re reaching the end of this journey with the privileges and features a plugin can achieve! What a quick ride.

@Robin-Sch how do you like the progress so far?

Thank you again for your excellent work and fast response time. As mentioned, I’ll send some coffees your way as soon as I’m back at the office. :)

MiltonBalaOfficial commented 4 days ago

It feels like we’re reaching the end of this journey with the privileges and features a plugin can achieve! What a quick ride.

Yes, this might be the best result a plugin can deliver. Feel free to reach out if you need any assistance in the future—I’ll be glad to help. Your feedback has been really helpful in improving the plugin. I’ve learned a lot about plugins while working on this one, and I’ve genuinely enjoyed this journey with you.

Robin-Sch commented 4 days ago

Damn.... Good job 💪 I'll take a look at the code in a few days (as I'm quite busy atm) and see if I can improve some things!

MiltonBalaOfficial commented 4 days ago

Damn.... Good job 💪 I'll take a look at the code in a few days (as I'm quite busy atm) and see if I can improve some things!

I am trying to minimize the code, after uploading the code, please review it.

MiltonBalaOfficial commented 4 days ago

Final version (removed repetition) is uploaded, waiting for the feedback from the users and developers. Thanks all.