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

Implement updates in pdf reader #128

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

Implement updates in pdf reader #128

libreliodev opened this issue Oct 10, 2014 · 13 comments

Comments

@libreliodev
Copy link
Owner

We need to make it possible for users of our apps (especially those who use our native mobile apps) to get some updates without loading again the whole pdf. To start with, the only updates we will handle will be annotations/links.

This should work as follows:

  • when loading a pdf file, the reader should check if the header "x-amz-meta-update" is present; if it is, it should download/read the plist specified by this header (for example myfile_updates.plist).
    Here is a simple example of such plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>p1</key>
    <array>
        <dict>
            <key>Action</key>
            <string>Add</string>
            <key>ID</key>
            <string>323</string>
            <key>Link</key>
            <string>http://www.google.com</string>
            <key>Rect</key>
            <string>114.7812 772.2025 132.5 785.2025</string>
        </dict>
        <dict>
            <key>Action</key>
            <string>Remove</string>
            <key>ID</key>
            <string>14</string>
            <key>Link</key>
            <string>http://www.apple.com</string>
            <key>Rect</key>
            <string>104.7812 772.2025 132.5 785.2025</string>
        </dict>
    </array>
</dict>
</plist>
  • before displaying a page and adding the links on the page, the reader should check wether there are updates on this page; all links marked as "Remove" should be removed , all links marked as "Add" should be added
@AlirezaAlgo
Copy link
Collaborator

@libreliodev plist format maybe a little different

@libreliodev
Copy link
Owner Author

@serverfire Thanks for your quick answer.

plist format maybe a little different

Can you explain what you mean?

@AlirezaAlgo
Copy link
Collaborator

I meant data structure not format.
This plist sample you've included divides annots with their page. But it is not an efficient data structure for our case.
At the time i implemented annot editor(in admin) the data structure was an array of annots and they have pageid if it requires.

@AlirezaAlgo
Copy link
Collaborator

@libreliodev Although we can change it to this sample. Because now it pdf file itself is not going to be updated.

@libreliodev
Copy link
Owner Author

@serverfire OK, if possible change it to this sample; it's going to be more simple afterwards, at least on iOS.

@libreliodev
Copy link
Owner Author

@serverfire By the way, is it OK for you to handle the modifications this way, when displaying the page?

@AlirezaAlgo
Copy link
Collaborator

@libreliodev It is also easier to update annots using this sample.
Sorry i was wrong.

@libreliodev
Copy link
Owner Author

@serverfire We are now going to start implementing this on iOS. If there is anything wrong or not suitable in the syntax, please inform us urgently.

@AlirezaAlgo
Copy link
Collaborator

@libreliodev
I should note few facts for update plist.

  1. Action = Add may not have ID.
  2. Action = Add may refer to editing existing link.
  3. Action = Remove only has ID
  4. Editing existing link should override properties supplied with it.
  5. Every entry should have SubType. For now its value is Link.
  6. Every link does have a LinkType where its possible values are (url, page).
  7. LinkType = page should have Dest which is the destination page number.

I think that's it.
Tell me what do you think.

@libreliodev
Copy link
Owner Author

@serverfire

  1. Action = Add may not have ID.

OK

  1. Action = Add may refer to editing existing link.

OK

  1. Action = Remove only has ID

OK

  1. Editing existing link should override properties supplied with it.

OK

  1. Every entry should have SubType. For now its value is Link.

No. The update plist might be used in the future for other formats than pdf, and keep the same structure. We only manage “Links”.

  1. Every link does have a LinkType where its possible values are (url, page).

No. For internal pages, please use goto://[pagenumber]

  1. LinkType = page should have Dest which is the destination page number.

Thanks.=

@AlirezaAlgo
Copy link
Collaborator

@libreliodev
OK. Hopefully I'll complete these tasks today.

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

@libreliodev Done!

AlirezaAlgo added a commit that referenced this issue Oct 14, 2014
@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