Skip to main content
Participant
December 27, 2022
Question

Adobe document preview fails with CORS error

  • December 27, 2022
  • 1 reply
  • 323 views

We have a scenario where we have an adobe pdf document which is rendering successfully on UI. This document asks the user to sign digitally. After the user signs this document, it shall render successfully on UI with digital signature but this time the document fails to render on UI with CORS error though we see 'File Preview Error' on browser.

We have already registered our domain with adobe with 'PDF embed API' and used the generated ClientID in our code.

We see following CORS error on console: -

Our code looks like as follow: -

readyPromise: Promise<any> = new Promise((resolve) => {
    if (window.AdobeDC) {
      resolve('');
    } else {
      document.addEventListener('adobe_dc_view_sdk.ready', () => {
        resolve('');
      });
    }
  });

previewFile(divId: string, documentUrl: string) {
    const config: any = {
      clientId: 'client_id',
    };
    if (divId) {
      config.divId = divId;
    }
    this.adobeDCView = new window.AdobeDC.View(config);

    const previewFilePromise = this.adobeDCView.previewFile({
      content: {
        location: {
          url: 'https://secure.eu1.adobesign.com/document/cp/3AAABLblqZhAnnaCqNZcTFsYRHPJjIGS6IJiY6aGNHtpJ21P-AkJNdvQue_M5bDRKtTGcbIuYUnM-E70FsHemg3CZ_miEqxNv/document.pdf'
        },
      },
      metaData: {
        fileName: 'DemoFile.pdf',
      }
    }, {
      showAnnotationTools: false,
      showLeftHandPanel: false
    });

    return previewFilePromise;
  }

Kindly help.

    This topic has been closed for replies.

    1 reply

    Vinay5E3EAuthor
    Participant
    December 28, 2022

    Any update ?