Is there a way to get the filesize in the PDF Embed API

New Here ,
Mar 31, 2022 Mar 31, 2022

Copy link to clipboard

Copied

Hi. I am dynamically loading a file in the PDF Embed API. I can get the file metadata (eg the page count etc). However, I don't see any option to get the file-size.

 

My use-case requires me to check the file-size - and only show the annotation tools for files that are smaller than 5mb.

TOPICS
PDF Embed API

Views

66

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

correct answers 1 Correct answer

Community Beginner , Apr 01, 2022 Apr 01, 2022

Hi @vmit 
Thanks for using PDF Embed API.  Currently PDF Embed API doesn't provides any API to get the file size. 

 

However, for your use you can try out below suggestions:

  1. Download the file as blob and read the file size as shown here https://developer.mozilla.org/en-US/docs/Web/API/Blob/size . Since, you have the file size now, you can decide whether to enable Annotation Tools or not while invoking the PDF Embed API.
  2. Now, you can pass the same file blob from step 1 to the PDF Embed API using https://developer.adobe.com/document-services/docs/overview/pdf-embed-api/howtos/#file-promise
...

Likes

Translate

Translate
Community Beginner ,
Apr 01, 2022 Apr 01, 2022

Copy link to clipboard

Copied

Hi @vmit 
Thanks for using PDF Embed API.  Currently PDF Embed API doesn't provides any API to get the file size. 

 

However, for your use you can try out below suggestions:

  1. Download the file as blob and read the file size as shown here https://developer.mozilla.org/en-US/docs/Web/API/Blob/size . Since, you have the file size now, you can decide whether to enable Annotation Tools or not while invoking the PDF Embed API.
  2. Now, you can pass the same file blob from step 1 to the PDF Embed API using https://developer.adobe.com/document-services/docs/overview/pdf-embed-api/howtos/#file-promise 


Feel free to reach out incase of any queries / concerns.

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 ,
Apr 01, 2022 Apr 01, 2022

Copy link to clipboard

Copied

LATEST

Thank you. We will implement 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
Resources