Skip to content
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

Cookbook printing (requires server side rendering) #781

Open
stormbyte opened this issue Jul 28, 2021 · 18 comments
Open

Cookbook printing (requires server side rendering) #781

stormbyte opened this issue Jul 28, 2021 · 18 comments
Labels
enhancement New feature or request

Comments

@stormbyte
Copy link

It is possible to print recipes and it is possible to put recipes in a cookbook.
But the cookbook has no print option

Add a button under /books next to edit / delete that prints all the recipes in a book

@stormbyte stormbyte added the enhancement New feature or request label Jul 28, 2021
@vabene1111
Copy link
Collaborator

recipes are currently rendered on the front end using javascript. that means that in order to print you need to open a page. There is an option to render vue templates on the server but that has not been implemented yet thus printing of cookbooks is sadly not yet possible.

it is however planned so this feature will definitely be implemented in the future #742

@vabene1111 vabene1111 changed the title Print the cookbook Cookbook printing (requires server side rendering) Jul 29, 2021
@timdonovanuk
Copy link

I would say the same for meal plan would be awesome :) Thank you.

@vabene1111
Copy link
Collaborator

makes sense, better printing and exporting views/systems

@wechsler42
Copy link

Hi there,
I would like to second the meal plan printing feature. A nicely printed meal plan stuck to a cupboard or a fridge would be really useful. Anyway, thanks for providing us this mice piece of software.

@vabene1111
Copy link
Collaborator

thank you, this is definitely also planned, once server side rendering is there we can have print views for everything. Maybe we will also build some dedicated views for kiosk modes/tablets etc.

@vabene1111 vabene1111 mentioned this issue Jan 18, 2022
3 tasks
@thumm
Copy link
Contributor

thumm commented Jan 31, 2022

Besides rendering the page, another solution could be to generate a PDF via a markup file. As far as I understand it correctly, parts of the recipe description are already defined as markdown text. Using a markdown template file containing placeholders, the placeholders can be replaced with the already existing markdown text and additional recipe data. The result file can then be processed with any markdown processor able to produce pdf output.

@vabene1111
Copy link
Collaborator

that is correct and would likely be an easy fix but would also mean that we have to maintain a second layout with all features the normal recipe view supports, thats why we so far have held of on doing this. there is the new "expiremental" PDF exporter which can export complete cookbooks.

@Timtam
Copy link

Timtam commented Feb 7, 2022

Hello there,

I haven't found an issue for the pdf exporter specifically yet, that's why i'm asking here. I tried using the PDF exporter today using a Docker setup, but it seems like the Docker setup doesn't automatically download or contain the local chromium needed to build the PDF. Is PDF export supported via Docker, means can we somehow get the Chromium to download within the docker or is a specific Chromium docker image of tandoor already available? Thanks.

@vabene1111
Copy link
Collaborator

i think it should download the chromium instance on the first run which might take some time but i am not sure. The exporter is marked "experimental" and this is exactly one of the reasons for that 😂

if its not downloaded automatically i dont know how to get it into the container, maybe by manually executing into the container and running it but i am not sure.

@Timtam
Copy link

Timtam commented Feb 7, 2022

OK, so I updated to 1.0.5 and 1.0.6 from a previous release, so that means that I already got a fully working database and everything up and running, which might be the case that Chromium wasn't downloaded since it wasn't a fresh instance. Its just guesswork though, didn't check the code for that. It might however be an idea to make Chromium a default within the Docker containers (bake it in with the image), provide extra images for Docker + Chromium or allow to download it via environment variable (maybe attach it to the experimental pdf exporter variable?). There should be some way to get Chromium into Docker though at some point, when the pdf exporter isn't experimental anymore at the latest though I think.
You're right, its experimental and I am willing to give it a shot, thought i'd report it back here :).

@vabene1111
Copy link
Collaborator

thanks for the feedback. The exporter will stay experimental because the fundamental technology needs to change. The exporter was contributed by a member of the community because he solved a problem for himself and the solution works to a certain degree (by using chromium and a browser rendering library). This is good enought that we integrated it into the main version but i not meant to be the solution in the long term (as proper server side rendering is preferable for this).

but thank you for the feedback, i totally understand what you mean and if we were to stay with this techology it would make perfect sense

@vabene1111 vabene1111 mentioned this issue Feb 18, 2022
@dsm1212
Copy link

dsm1212 commented Mar 16, 2022

Meanwhile is there any other scheme to get to a printed cookbook from Tandoor content? The app Cook'n has a nicely integrated physical cookbook option that includes placing the order, I wonder if export could get a path to that? It's a paid product though so we'd have to buy it. I'd like to start using tandoor, but we are looking to create a cookbook of family recipes as a gift soon.

@smilerz
Copy link
Collaborator

smilerz commented Mar 16, 2022

@dsm1212 - what services are used to get a printed cookbook? is that clear or is it directly from Cook'n

@dsm1212
Copy link

dsm1212 commented Mar 16, 2022

It seems to be some service they are providing, I don't see a book vendor mentioned. I don't have the product but there is an older video here that shows the steps. I've seen the books in other demo clips having pictures with the recipes so I think they have improved from what you see here:

https://www.youtube.com/watch?v=Z6Ehg7qia-0

I think they changed the product interface a lot since that video. It's a cloud subscription now.

@smilerz
Copy link
Collaborator

smilerz commented Mar 16, 2022

very helpful! thanks

@dsm1212
Copy link

dsm1212 commented Mar 16, 2022

On that subject though, this looks promising but I can't find the actual api. Probably would have to contact blurb to get access to their library and you would have to test with them somehow to make sure results are good. I do see they have free book making tools. Maybe I will install one of those and see if I could import content somehow.
https://www.blurb.com/print-api-software

@vabene1111
Copy link
Collaborator

that is a very intersting idea. I think it still requires implementing PDF export before but having a nice and quick way to build physical cookbooks would be cool. We were also already planning to add the ability to place content pages into books which might be interesting for this as well

@taulen
Copy link

taulen commented Apr 21, 2024

Tried exporting as pdf today.
Nothing seemed to be happening, so checked the logs, and this is what I see there.
Any ideas ? Bug/issue or something on my end ?

::ffff:172.30.0.4 - - [21/Apr/2024:03:15:52 +0200] "GET /export-response/4/ HTTP/1.0" 200 22308 "https://****.****.no/export/?r=1" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36" Exception in thread Thread-5 (do_export): Traceback (most recent call last): File "/usr/local/lib/python3.12/threading.py", line 1073, in _bootstrap_inner self.run() File "/usr/local/lib/python3.12/threading.py", line 1010, in run self._target(*self._args, **self._kwargs) File "/opt/recipes/cookbook/integration/integration.py", line 68, in do_export files = self.get_files_from_recipes(recipes, el, self.request.COOKIES) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/recipes/cookbook/integration/pdfexport.py", line 56, in get_files_from_recipes return asyncio.run(self.get_files_from_recipes_async(recipes, el, cookie)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/runners.py", line 194, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 685, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "/opt/recipes/cookbook/integration/pdfexport.py", line 18, in get_files_from_recipes_async browser = await launch( ^^^^^^^^^^^^^ File "/opt/recipes/venv/lib/python3.12/site-packages/pyppeteer/launcher.py", line 307, in launch return await Launcher(options, **kwargs).launch() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/recipes/venv/lib/python3.12/site-packages/pyppeteer/launcher.py", line 148, in launch self.proc = subprocess.Popen( # type: ignore ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/subprocess.py", line 1026, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/local/lib/python3.12/subprocess.py", line 1953, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: '/root/.local/share/pyppeteer/local-chromium/1181205/chrome-linux/chrome'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

9 participants