Pattern-Projector / pattern-projector

https://www.patternprojector.com/
MIT License
87 stars 19 forks source link

"Export regular PDF" button with selected layers but no stitching #305

Open sashasewist opened 4 months ago

sashasewist commented 4 months ago

OK, this is totally not related to projecting, but would be so amazingly useful to all the sewists printing from mobile. They have no way of saving or printing layers right now. The only app that allows viewing layers on screen is Xodo but it still prints and saves all layers, so mobile users are stuck having all layers printed. I'm thinking something like changing PP stitch function to have two export PDF buttons instead of one: "Export stitched PDF" (same function as current Export PDF button with same tool tip) "Export regular PDF" (tool tip: "Export PDF with selected layers, without any stitching/layout change") If this feature is implemented I will promote it in the non-projecting groups and highly encourage people to click to donate since it will be such a life saver for the printing crowd.

courtneypattison commented 4 months ago

I think this needs to be a standalone app because PP is so not ready for mobile and really projector specific! I keep considering making it but I worry about how much work it would be. I feel super waffley on this one. It's a really good idea...

I'm going to keep this issue open and comment when I'm more decisive.

cfcurtis commented 4 months ago

The functionality is 90% there, so it's mostly exposing it on the UI... but I agree with Courtney that it doesn't really fit in with the current projector-specific workflow. Maybe PP needs a sister site named "pattern printer" that just lets you load a PDF, select layers, and send to the printer.

The biggest issue with printing from mobile is that the ability to print at 100% is inconsistent at best. For my phone/printer combo (Android/Brother), there is no scaling option when I print, and everything is "shrink to fit". Fine when I'm printing colouring pages for my kid, less fine when it's a pattern! I would hesitate to recommend people print from mobile unless they really know what they're doing.

courtneypattison commented 4 months ago

I decided to try and do something like "pattern printer" based on this issue. I quickly gave up on sending it to the printer though since it fails miserably on iOS (of course)! Just a super simple web utility for exporting layers. There are definitely issues with "shrink to fit," inconsistent loading across apps, etc. but it may work well enough to help a few people out. I'll open source it in the next few days for you folks to look at but for now here's a demo version: https://pdf-peeler.web.app/ It needs some love but I thought I'd share a demo in the meantime.

cfcurtis commented 4 months ago

That was quick!

I gave it a test on my phone, I like how you have the layer names pop up on top of the PDF for small screens. I tested on a random Jalie pattern and for some reason one of my selected layers didn't save properly, so I'm guessing that's a bug with the implementation in PP as well.

I'm not sure how serious you are about making this happen (I know time is limited!), but I have a few suggestions for things to add:

courtneypattison commented 4 months ago

I gave it a test on my phone, I like how you have the layer names pop up on top of the PDF for small screens. I tested on a random Jalie pattern and for some reason one of my selected layers didn't save properly, so I'm guessing that's a bug with the implementation in PP as well.

Yeah PP will have the same problem! In the latest version, I decided to convert the pattern to png, then back to pdf to avoid issues like this. It renders so differently across browsers/pdf viewers otherwise and the intended use is for printing so the vectors don't need to be preserved.

  • Page range selection for those documents with the instructions and pattern together
  • A text box to edit the file name (could be populated with the default name, then people can edit if they want)

To address both these issues I decided to open the PDF in the browser's pdf viewer instead of downloading it so the user can select page range, change file name, and print/download from there.

  • Some way to go back and load a new document without just refreshing the page

There is a button to do this in the bottom toolbar. I'm trying to do as little text as possible since translations are extra work! Any thoughts on a better icon/location?

Thank you so much for the feedback!!!

cfcurtis commented 4 months ago

Yeah PP will have the same problem! In the latest version, I decided to convert the pattern to png, then back to pdf to avoid issues like this. It renders so differently across browsers/pdf viewers otherwise and the intended use is for printing so the vectors don't need to be preserved.

I'm admittedly a vector snob, but I'd be a bit miffed if I was expecting to just change layer default visiblity and it went and rasterized on me. I think pdf-lib had an issue with Jalie patterns in general so it was probably a poor choice of test pattern. Have you run into this problem with others?

To address both these issues I decided to open the PDF in the browser's pdf viewer instead of downloading it so the user can select page range, change file name, and print/download from there.

Makes sense, no use duplicating features! On Android this doesn't actually do anything different though, it still downloads the file and opens in your default PDF viewer (or prompts you to choose a viewer). That said, minor thing.

  • Some way to go back and load a new document without just refreshing the page

There is a button to do this in the bottom toolbar. I'm trying to do as little text as possible since translations are extra work! Any thoughts on a better icon/location?

I totally missed it, I see it now! I like the new intro page as well (and I know translations are a headache!)

Thank you so much for the feedback!!!

Thanks for being receptive, I know you just started working on this and it's so easy to say "oh, just add xyz"... feel free to say no and I understand.

courtneypattison commented 4 months ago

I'm admittedly a vector snob, but I'd be a bit miffed if I was expecting to just change layer default visiblity and it went and rasterized on me. I think pdf-lib had an issue with Jalie patterns in general so it was probably a poor choice of test pattern. Have you run into this problem with others?

I have. I've just done a horrible job of documenting the issues! I'll open a few issues in PP and share some mangled PDFs. I'm thinking start with the png hack until the vector based approach is more robust. The main use of the tool is for printing so I'm picking my poison here based on that!

cfcurtis commented 4 months ago

Sounds like pdf-lib isn't quite ready for prime time! For that matter mangling doesn't always seem to work either, that Vogue one you sent me has an error on the page. Darn these complicated edge cases.

The png hack seems like a good compromise - I would suggest bumping the resolution up to 300 DPI for printing if mobile can handle it!

courtneypattison commented 4 months ago

The png hack seems like a good compromise - I would suggest bumping the resolution up to 300 DPI for printing if mobile can handle it!

I was thinking at least 160 since that's what Firefox does for printing! I'll have to test it out to see how big the files get.