-
Notifications
You must be signed in to change notification settings - Fork 1
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
exporting/printing logbooks #4
Comments
There is some limited functionality to export a logbook as PDF. It was hacked together just as a proof of concept and it's fairly untested. In fact I just noticed it was a bit broken, you will have to pull It's not exposed in the UI at this time. Ypu can use it like this: Try it and see if it solves your use case, otherwise feel free to report an issue with your findings. Exporting as a simple HTML file could also be an idea. |
Hej, somehow I only get an empty pdf file returned. Btw: what do I need to do in order to take any changes in the backend-source take effect in docker? I am running a Best Daniel |
Hmm, I see the same thing, but only when running in docker compose. Interesting, could it be that nginx or uwsgi somehow strips it out? I'm not really the expert on those parts of the system though. But I'll have a look. By the way, I found a flag to wget that keeps the logbook name of the PDF file:
Anyway, for development, I run the backend locally with:
and then to get the frontend up, in another shell
The UI should be available on http://localhost:3000. Look in the readme for some clues on how to install locally if needed. If you want to play around with the PDF export that might work better. |
By the way, the commands to rebuild the docker images work fine here, but I find that it's more helpful to skip the "-d" switch to "docker-compose up" while testing, since then you can see logging output directly in the shell. |
OK, I think the problem is with the version of wkhtmltopdf in the image, it errors out with a message about not being able to connect to a display. Probably the same issue as wkhtmltopdf/wkhtmltopdf#2037 :( That's annoying. I'll try to come up with a solution, but as far as I can remember pdfkit didn't seem like a perfect solution anyway, just the easiest to get working. So maybe it's a better idea to look for something else. |
thanks a lot for debugging! I would be also fine with a printer-friendly version as html. |
Yes, in fact the current PDF export converts to HTML fists and then turns that into PDF :) The body of the entries are stored as HTML anyway so the conversion is trivial. A "download=html" feature should be easy to implement, it essentially just needs to skip the pdfkit step. |
okay, let me check if I can handle it myself |
Please make a pull request if you get something working! Looking at the code now, I think the main part that's missing is handling of image attachments. For HTML export they probably need to be base64 encoded and inlined directly in the document instead of linking to the files. |
álright, so wget is fine, then it seems, that it is a firefox issue? |
Ah, I did not try with a browser. I see the same thing with firefox. I wonder if it's caused by some response header ("Cache-Control: public, max-age=43200") which is probably set by nginx. I'm not sure that affects downloaded files though. This header can also be inspected with "wget -S", but since wget doesn't cache stuff between runs, it won't affect it. |
okay, I started to play around with the nginx setting. I guess it would be smart in general to disable any caching for the api location, right? |
(Answered from my work account by mistake, re-posting to be less confusing :) Thanks for investigating, I don't have time to look into this right now but maybe it's actually flask that generates this header somewhere in the "send_file()" response. It's only really for attachments where it would make sense to cache responses, so we can definitely turn it off elsewhere. |
Please have a look at PR #16! |
Hej,
I would love to have an export feature for logbooks in elogy, or at least a print view.
I could think of writing a simple JSON parser to put the result from an http request into a printer-friendly format, but I guess, all this is already included in the frontend of elogy.
So actually one would just need a template with only the logbook entries displayed.
One might also think of included nested logbooks recursively or only showing entries which have the current logbook as direct parent.
Do you think this would be possible?
Best
Daniel
The text was updated successfully, but these errors were encountered: