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

comments flushed out after refreshing page

New Here ,
Dec 04, 2020 Dec 04, 2020

Copy link to clipboard

Copied

I am using Adobe Embeded Javascript API

when i add comment in the PDF then it gets flushed out after refreshing page.

I want to persist these comments even after refreshing the page.

how can i do it?

TOPICS
How to , PDF Embed API

Views

273

Likes

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
Community Expert ,
Dec 04, 2020 Dec 04, 2020

Copy link to clipboard

Copied

When you refresh the page, you are reloading the uncommented PDF file from the server so you won't see any comments previously added.

 

But I'm unclear as to how you want it to work. When the comments are saved, do you want the comments to be private to each user where they get reloaded on each visit, or do you want to update the file on the server every time anyone makes a comment... or something else?

Likes

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 ,
Dec 06, 2020 Dec 06, 2020

Copy link to clipboard

Copied

We have to update the file on the server every time and anyone can makes a comment.

How we can do this?

could you please help us?

Likes

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
Adobe Employee ,
Dec 06, 2020 Dec 06, 2020

Copy link to clipboard

Copied

Likes

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 ,
Dec 07, 2020 Dec 07, 2020

Copy link to clipboard

Copied

with the help of above url getting updated pdf content .

 It's saving but in another file i.e "Piping Drawing.pdf" but i want to save comments in same file i.e mentioned in url "../Sample Searchable PDF.pdf" .

how we can achieve it?

 

example: 

content: {
            location: {
                url: "../Sample Searchable PDF.pdf",             
            },
        },
        metaData: {
            fileName: "Piping Drawing.pdf"
        }
 
Untitled.png
 
after click on save all added comments should save in same file. and user can see it after refreshing page also.
now it saving another file how we can do it?
 

Likes

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
Adobe Employee ,
Dec 07, 2020 Dec 07, 2020

Copy link to clipboard

Copied

Can you provide us the snippet of the Save Callback you have registered? 

Likes

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 ,
Dec 07, 2020 Dec 07, 2020

Copy link to clipboard

Copied

var viewerConfig = {
    showAnnotationTools: true,
    enableFormFilling: true,
};

/* Wait for Adobe Document Services PDF Embed API to be ready */
document.addEventListener("adobe_dc_view_sdk.ready"function () {
    /* Initialize the AdobeDC View object */
    var adobeDCView = new AdobeDC.View({
        /* Pass your registered client id */
        clientId: "4d7f1369c88548c593d979fd0532710a",
        /* Pass the div id in which PDF should be rendered */
        divId: "adobe-dc-view",
    });

    /* Invoke the file preview API on Adobe DC View object */
    adobeDCView.previewFile({
        /* Pass information on how to access the file */
        content: {
            /* Location of file where it is hosted */
            location: {
                url: "../Sample Searchable PDF.pdf",
                /*
                If the file URL requires some additional headers, then it can be passed as follows:-
                headers: [
                    {
                        key: "<HEADER_KEY>",
                        value: "<HEADER_VALUE>",
                    }
                ]
                */
            },
        },
        /* Pass meta data of file */
        metaData: {
            /* file name */
            fileName: "Piping Drawing.pdf"
        }
    }, viewerConfig);

    /* Define Save API Handler */
    var saveApiHandler = function (metaData, content, options) {
        console.log(metaData, content, options);
        return new Promise(function (resolve, reject) {
            /* Dummy implementation of Save API, replace with your business logic */
            setTimeout(function () {
                var response = {
                    code: AdobeDC.View.Enum.ApiResponseCode.SUCCESS,
                    data: {
                        metaData: Object.assign(metaData, { updatedAt: new Date()})
                    },
                };
                resolve(response);
            }, 2000);
        });
    };

    adobeDCView.registerCallback(
        AdobeDC.View.Enum.CallbackType.SAVE_API,        
        saveApiHandler,
        {}
    );
});

Likes

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
Adobe Employee ,
Dec 07, 2020 Dec 07, 2020

Copy link to clipboard

Copied

You need to write your file update implementation in the saveApiHandler, in which you can use the content buffer provided as an argument to update the file at the desired location.

Likes

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 ,
Dec 07, 2020 Dec 07, 2020

Copy link to clipboard

Copied

var saveApiHandler = function (metaData, content, options) {
        console.log(metaData, content, options);
        return new Promise(function (resolve, reject) {
            /* Dummy implementation of Save API, replace with your business logic */
            setTimeout(function () {
                var response = {
                    code: AdobeDC.View.Enum.ApiResponseCode.SUCCESS,
                    data: {
                        metaData: Object.assign(metaData, { updatedAt: new Date()})
                    },
                };
                resolve(response);
            });
        });  
    };

    adobeDCView.then(function (adobeViewer) {
        console.log("in..");
        adobeViewer.getAnnotationManager().then(function (annotationManager) {
            /* API to add annotations to PDF and return the updated PDF buffer */
            /* These APIs will work only when includePDFAnnotations is set to true in viewerConfig */
            annotationManager.addAnnotationsInPDF(content)
                .then(function (result) {
                    console.log("Annotations added to PDF successfully and updated PDF buffer returned.", result)
                })
                .catch(function (error) {
                    console.log(error)
                });        
        });
    }); 
 
 
added updated content buffer but file get downloaded after save.
don't want to download .
reflect changes in same file.
how could we do this?
 

Likes

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
Adobe Employee ,
Dec 07, 2020 Dec 07, 2020

Copy link to clipboard

Copied

I am not sure whether you are following the documentation or not. You need not to have any annotation manager for your use-case. 

As described in the comment of saveApiHandler itself that  /* Dummy implementation of Save API, replace with your business logic */, So, you have to write the code for uploading the content of the file in your desired location (where the file is residing currently).

Likes

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 ,
Dec 10, 2020 Dec 10, 2020

Copy link to clipboard

Copied

const saveApiHandler = (metaData: any, content:ArrayBuffer, options: any) => {
            console.log(metaData, content, options);
});
 
How can i get updated File object in saveApiHandler ?
I am stuck in writing updated content in File using Java.
Could you please tell If we can get File Object instead of Content.

Likes

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
Community Expert ,
Dec 10, 2020 Dec 10, 2020

Copy link to clipboard

Copied

There are multiple methods. I have an example here that converts the content to a base64 string and then constructs a URL to save the file.

Likes

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 ,
Dec 15, 2020 Dec 15, 2020

Copy link to clipboard

Copied

defaulthe898w6q9o15_0-1608099694634.png

 

Unable to see exiting comments text ? could you please help?

I am doing this in angular i can Add,Edit Delete comments but after save not able to see comments text.

 

Likes

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 ,
Dec 23, 2020 Dec 23, 2020

Copy link to clipboard

Copied

Hello,

 
Your answers help me a lot i need 1 more help.

I have done 1 example in angular 6 but I want to show the username who is going to add comments.
It shows a GUEST everytime.
 
I have added below API -
 
this.adobeDCView.registerCallback(
            window.AdobeDC.View.Enum.CallbackType.GET_USER_PROFILE_API,
            function () {
                return new Promise((resolve, reject) => {
                    resolve({
                        code: window.AdobeDC.View.Enum.ApiResponseCode.SUCCESS,
                        data: profile
                    });
                });
        }, {});
 
But while adding comments getting an error 
"dc-core.js:2 TypeError: this.props.data.creator.id.split is not a function".
 
Could you please help me to solve this error and show the name?
 
 
image.png
 
 

 

 

 

Likes

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
Adobe Employee ,
Dec 23, 2020 Dec 23, 2020

Copy link to clipboard

Copied

We would like to apologize for the inconvenience. Ideally, it should work after registering the GET_USER_PROFILE_API callback in the documented way https://www.adobe.com/devnet-docs/dcsdk_io/viewSDK/howtos_ui.html#user-profiles.

Could you please confirm if you are following the same? Also, if we can get the code snippet (configurations) you used with PDF Embed API for your website. 

Likes

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 ,
Dec 23, 2020 Dec 23, 2020

Copy link to clipboard

Copied

Yes Refering the same.

Attached snippet could you please check and let me know It's in angular 

 first.pngsecond.png

Likes

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
Community Expert ,
Jan 04, 2021 Jan 04, 2021

Copy link to clipboard

Copied

LATEST

I'm not proficient at Angular. Sorry.

Likes

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
Community Expert ,
Dec 23, 2020 Dec 23, 2020

Copy link to clipboard

Copied

I show examples of creating and setting the user profile at this CodePen

Likes

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