• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Adobe Embed Not Saving

New Here ,
Aug 06, 2022 Aug 06, 2022

Copy link to clipboard

Copied

Hello! Just started using the Embed API. I am viewing a file from an DigitalOcean Spaces storage but when I save after marking it up, it doesn't update. Any help would be appreciated! Here is my code:

<!DOCTYPE html>
{% load static %}
<html lang="en">
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta id="viewport" name="viewport" content="width=device-width, initial-scale=1"/>

    <link rel="shortcut icon" href="{% static 'assets/images/favicon.png' %}" />
</head>

<body style="margin: 0px">
 <div id="adobe-dc-view"></div>
 <script src="https://documentcloud.adobe.com/view-sdk/viewer.js"></script>
 <script>
        var document_url = '{{ url }}';
        var file_name = '{{ filename }}';
        var read_only = {{ read_only }};
        var adobe_key = '{{ adobe_embed_key }}';

        const profile = {
            userProfile: {
                name: '{{ user.name }}',
                firstName: '{{ user.fname }}',
                lastName: '{{ user.lname }}',
                email: '{{ user.email }}'
            }
        };

        const saveOptions = {
            autoSaveFrequency: 0,
            enableFocusPolling: false,
            showSaveButton: true
        };
    </script>
    <script type="text/javascript" src="{% static 'assets/js/htw/adobe-embed.js' %}"></script>
</body>
</html> 

Here is the JS:

document.addEventListener("adobe_dc_view_sdk.ready", function() {
    var adobeDCView = new AdobeDC.View({
         clientId: adobe_key,
         divId: "adobe-dc-view"
    });

    adobeDCView.registerCallback(
        AdobeDC.View.Enum.CallbackType.SAVE_API,
        function(metadata, content, options) {
            return new Promise((resolve, reject) => {
                resolve({
                    code: AdobeDC.View.Enum.ApiResponseCode.SUCCESS,
                    data: {
                        metaData: { fileName: document_url }
                    }
                });
            });
        }, saveOptions
    );

    adobeDCView.registerCallback(
        AdobeDC.View.Enum.CallbackType.GET_USER_PROFILE_API,
        function() {
            return new Promise((resolve, reject) => {
                resolve({
                    code: AdobeDC.View.Enum.ApiResponseCode.SUCCESS,
                    data: profile
                });
            });
        },
    );

    adobeDCView.previewFile({
        content: {
            location: {
                url: document_url
            }
        },
        metaData: {
            fileName: file_name,
            hasReadOnlyAccess: read_only
        }
    });
});
TOPICS
PDF Embed API

Views

370

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Employee , Aug 08, 2022 Aug 08, 2022

Because you need to implement code to take the bits and save it yourself. We give you a hook to notice and customize the save process, but you have to actually handle doing it.

Votes

Translate

Translate
Adobe Employee ,
Aug 08, 2022 Aug 08, 2022

Copy link to clipboard

Copied

Because you need to implement code to take the bits and save it yourself. We give you a hook to notice and customize the save process, but you have to actually handle doing it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 08, 2022 Aug 08, 2022

Copy link to clipboard

Copied

LATEST

Yup, I realized that shortly after. Working now, thanks!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources