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

Save PDF instead of download only #6

Open
elvirusDE opened this issue Dec 14, 2020 · 10 comments
Open

Save PDF instead of download only #6

elvirusDE opened this issue Dec 14, 2020 · 10 comments
Labels
enhancement New feature or request

Comments

@elvirusDE
Copy link
Contributor

Could it be possible to save the annotated PDF to the original file instead of being able to only download it? Like a "save"-button in the secondary toolbar right next to the download button. That would be awesome.

We are using this plugin to annotate documents in the nextcloud for some users. They have to be able to see the annotations. So the current workflow is: The annotator opens a PDF file from a user, annotates it, then downloads it. Then he deletes the original file and uploads the annotated file. That could be much simpler if there were a save button which just combines the annotations and the pdf and saves it to the path of the original file.

Is this somehow possible?

Best regards,
elvirus

@fancycode
Copy link
Member

If the annotated file replaces the original PDF, the annotations can not be removed in the future.
Maybe another solution would be a way to save the annotated PDF in Nextcloud with a different filename?

@elvirusDE
Copy link
Contributor Author

elvirusDE commented Dec 15, 2020

Ok, good point. So with a press on the save button the user should be prompted with a text input to enter a file name. The original file name could be inserted as a default placeholder. With that mechanism in place, the user could decide, wether he wants to replace the original file or make a copy of it.
In our use case we do want the original file to be replaced and we don't care if the annotations could not be removed. It is about a teacher correcting her pupils works.

If you cannot implement this functionality at the moment, could you point me in the right direction so that I could start developing it? Maybe with some helpful comments from your side we could get it working...

@fancycode
Copy link
Member

The combined file is available on the server at

merged = add_text_annotations(merged, data.text, tempdir);

Here an upload to Nextcloud would have to be implemented. I don't know about the necessary APIs though.

Another way would be to add an API to Nextcloud that downloads the combined file from the server and stores it internally. For that I would have to read API documentation first, too.

@fancycode fancycode added the enhancement New feature or request label Jan 4, 2021
@szaimen
Copy link
Contributor

szaimen commented Mar 2, 2021

This feature would be really great 👍

@lbdroid
Copy link

lbdroid commented Apr 4, 2021

There is no need to rename the file when saving. Nextcloud keeps old versions (3-dots button --> details --> versions), so the original file will always remain available.

@lbdroid
Copy link

lbdroid commented Apr 5, 2021

I need to add 2 cents to this request, it is an ABSOLUTELY CRITICAL feature that it will be able to save-IN-PLACE (i.e., withOUT renaming). In fact, the "download" option can be removed altogether -- it is completely unnecessary since Nextcloud can provide download functionality after saving.

The problem with being restricted to download-only, is that it doesn't offer any utility that can't be done better with a standalone pdf annotator. Trying to use this within Nextcloud means annotating the file, downloading, and then uploading. Using a standalone annotator means only changing the order of that -- download, then annotate, then upload -- no benefit here.

Following a successful save, it should also clear all annotations for that document from the database, having already been applied to the document.

@lbdroid
Copy link

lbdroid commented Apr 5, 2021

@fancycode - Here's the easy sauce;

curl -T somefile.pdf -H 'X-Requested-With: XMLHttpRequest' -H "User-Agent: Mozilla/5.0 (Android) Nextcloud-android" --cookie 'the cookie' https://nextcloud.your.tld/remote.php/webdav/path/to/file.pdf

** Note that that creates a PUT request.

The user-agent header there is to bypass a cross-site request forgery check in lib/Connector/Sabre/Auth.php
The cookie comes from the connection headers https://github.com/strukturag/pdfdraw/blob/master/server/server.js#L861 -- i.e. "socket.handshake.headers".

And every time you upload the file like that, its a new version with old versions still recoverable in the "versions" menu, so always keep the same name.

The only data missing in server.js to accomplish this is the "path/to/" component of the file path, which I'm sure is easy enough at the frontend code to find and pass along to the backend.

@PJSymes
Copy link

PJSymes commented Sep 2, 2021

This feature would be really great 👍

This is an important feature that would allow me to use this App as a replacement PDF reader on tablets whilst keeping the documents in a centralised location

@szaimen
Copy link
Contributor

szaimen commented Sep 2, 2021

I suggest you try this fork as it has many missing features already done: https://gitlab.com/nextcloud-other/nextcloud-annotate

@PJSymes
Copy link

PJSymes commented Sep 2, 2021 via email

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

5 participants