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

Finalize pdf editor #129

Closed
libreliodev opened this issue Oct 10, 2014 · 21 comments
Closed

Finalize pdf editor #129

libreliodev opened this issue Oct 10, 2014 · 21 comments

Comments

@libreliodev
Copy link
Owner

This is a continuation of #46.

We have decided to make a few changes, compared with #46:

  • we will not save edits made using the online pdf editor in the pdf file. Rather, we will use an update plist, as described in Implement updates in pdf reader #128.
  • subsequently, we will not use a json file to store annotations temporarily, we will use this update plist file.

This should work as follows:

  • when saving edits made using the interface defined in Implement pdf annotations editor #46:
    • save the updates in a file called [NameOfPdf]_updates.plist
    • add a new metadata in the S3 pdf file: x-amz-meta-update = [NameOfPdf]_updates.plist (this should be possible using the AWS SDK )
@AlirezaAlgo
Copy link
Collaborator

@libreliodev I've got AccessDenied error at save process.
Command was copyObject where send a PUT request.
Here is the request curl.

curl 'https://librelio-europe.s3-eu-west-1.amazonaws.com/developer/sportguide/Sportguide_044/Sportguide_044.pdf__tmp__copy__' \
-X PUT -H 'Host: librelio-europe.s3-eu-west-1.amazonaws.com' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:32.0) Gecko/20100101 Firefox/32.0' \
-H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' \
-H 'Accept-Language: en-us,en;q=0.5' -H 'Accept-Encoding: gzip, deflate' \
-H 'X-Amz-User-Agent: aws-sdk-js/2.0.0-rc13' -H 'x-amz-copy-source: developer/sportguide/Sportguide_044/Sportguide_044.pdf' \
-H 'Content-Type: application/octet-stream; charset=UTF-8' \
-H 'X-Amz-Date: Mon, 13 Oct 2014 09:35:49 GMT' \
-H 'Authorization: AWS <Autorization Code>' \
-H 'Referer: http://localhost/libreliodev/dist/admin/pdf-annotation-editor.html?waurl=developer%2Fsportguide%2FSportguide_044%2FSportguide_044.pdf'\
 -H 'Origin: http://localhost' --data ''

@libreliodev
Copy link
Owner Author

@serverfire Why do you need copyobject?

@AlirezaAlgo
Copy link
Collaborator

@libreliodev It's the only way we can modify object's metadata.
Here's my doc I'm working with.
http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/frames.html

@libreliodev
Copy link
Owner Author

@serverfire There is no obvious reason why you get this "access denied" error. I will investigate, but it will take some time. This might have something to do with ACL, which you are not allowed to set. Maybe copyobjectneeds it. Please let me know if you finally solve the issue.

@AlirezaAlgo
Copy link
Collaborator

@libreliodev Fixed!

Problem was from me.
CopySource Should also mention bucket.
Sorry about that.

@AlirezaAlgo
Copy link
Collaborator

@libreliodev Change in CORS required for ajax requests.
Using this header including the other one allows ajax access to all headers.

Access-Control-Expose-Headers: x-amz-meta-update

@AlirezaAlgo
Copy link
Collaborator

Here's more accurate sample.

Access-Control-Expose-Headers: Accept-Ranges, Content-Encoding, Content-Length, Content-Range, Etag, Last-Modified, Accept-Encoding
, x-amz-meta-update

@libreliodev
Copy link
Owner Author

@serverfire x-amz-meta-updatehas been added

AlirezaAlgo added a commit that referenced this issue Oct 14, 2014
@AlirezaAlgo
Copy link
Collaborator

@libreliodev Done!

@libreliodev
Copy link
Owner Author

@serverfire Can you tell me how to test that? When trying to click on Edit Links from the Publications page, the whole pdf takes some time to load entirely, and then nothing is displayed

@AlirezaAlgo
Copy link
Collaborator

@libreliodev
Try to load this link. pdf-annotation-editor.html?waurl=developer%2Fsportguide%2FSportguide_0401%2FSportguide_0401.pdf
What was the link you had problem with it?

AlirezaAlgo added a commit that referenced this issue Oct 14, 2014
@AlirezaAlgo
Copy link
Collaborator

Few bugs has been fixed in last commit.

AlirezaAlgo added a commit that referenced this issue Oct 14, 2014
@AlirezaAlgo
Copy link
Collaborator

@libreliodev

Can you tell me how to test that? When trying to click on Edit Links from the Publications page, the whole pdf takes some time to load entirely, and then nothing is displayed

Sorry for inconvenience, That problem was because a file was missing.

@libreliodev
Copy link
Owner Author

@serverfire Congrats, this looks really nice. We are currently testing, and will be reporting bugs in separate issues.

@libreliodev
Copy link
Owner Author

@serverfire I tried loading Wind 355 and removed one link from the cover page. When I looked on the plist on the server, there were 4 links ("added") on the page (the 4 links I had not removed) and none removed. Is this a bug or a misunderstanding?

AlirezaAlgo added a commit that referenced this issue Oct 15, 2014
@AlirezaAlgo
Copy link
Collaborator

@libreliodev Almost all bugs you mentioned is fixed.

@libreliodev
Copy link
Owner Author

@serverfire When removing a link from a page, I still can't see the Remove entry in the plist

@AlirezaAlgo
Copy link
Collaborator

@libreliodev Are you sure You're saving it?
It will store changes in localstorage before saving it.

@libreliodev
Copy link
Owner Author

@serverfire Sorry for the late answer. Yes, sure. For some reason, the plist is updated (modification date-time are changed), but the contents seem to remain the same.

AlirezaAlgo added a commit that referenced this issue Oct 16, 2014
@AlirezaAlgo
Copy link
Collaborator

@libreliodev I got the bug! :)
Fix is uploaded.
Sorry it took so long.

@libreliodev
Copy link
Owner Author

Successfully tested

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants