# Error while calling instance.printInBackground

**URL:** <https://pdfjs.community/t/error-while-calling-instance-printinbackground/930>\
**Category:** Bug Reports\
**Tags:** pdfjs-express\
**Created:** [August 5, 2021, 1:29pm UTC](https://pdfjs.community/t/error-while-calling-instance-printinbackground/930 "2021-08-05T13:29:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![chinarentianqi](https://avatars.discourse-cdn.com/v4/letter/c/c89c15/32.png) [@chinarentianqi](https://pdfjs.community/u/chinarentianqi)\
**Post date:** [August 5, 2021, 1:29pm UTC](https://pdfjs.community/t/error-while-calling-instance-printinbackground/930/1 "2021-08-05T13:29:02Z")

</div>

Hi,

Code is simple:  
instance.printInBackground({  
includeComments: false,  
includeAnnotations: true,  
pagesToPrint: list,  
});

Error Message:  
_Uncaught RangeError: offset is out of bounds_  
_at Uint8ClampedArray.set ()_  
_at r$jscomp$0 (PDFJSDocumentType.js:2210)_

There are [page number] times error Messgae shown in the console.

The resolution of the pdf file is high.(100% scale result in just a small area of the page).  
Other pdf files can’t reproduce this.

Thanks for any messages,  
Ken

---

<div class="post-metadata">

**Author:** ![Logan](https://yyz1.discourse-cdn.com/flex031/user_avatar/pdfjs.community/logan/32/13_2.png) [@Logan](https://pdfjs.community/u/Logan)\
**Post date:** [August 6, 2021, 8:00pm UTC](https://pdfjs.community/t/error-while-calling-instance-printinbackground/930/2 "2021-08-06T20:00:20Z")

</div>

Hey there,

Are you able to share the document with me for testing?

Thanks,  
Logan

---

<div class="post-metadata">

**Author:** ![chinarentianqi](https://avatars.discourse-cdn.com/v4/letter/c/c89c15/32.png) [@chinarentianqi](https://pdfjs.community/u/chinarentianqi)\
**Post date:** [August 8, 2021, 7:48am UTC](https://pdfjs.community/t/error-while-calling-instance-printinbackground/930/3 "2021-08-08T07:48:51Z")

</div>

Hi,

The document includes some private information. So I will try to reproduce with some other documents and share with you.

FYI, no errors show in console only when print quality is 1.

Thanks for replying,  
Ken

---

<div class="post-metadata">

**Author:** ![chinarentianqi](https://avatars.discourse-cdn.com/v4/letter/c/c89c15/32.png) [@chinarentianqi](https://pdfjs.community/u/chinarentianqi)\
**Post date:** [August 10, 2021, 1:46am UTC](https://pdfjs.community/t/error-while-calling-instance-printinbackground/930/5 "2021-08-10T01:46:47Z")

</div>

Hi Logan,

I have attached a file having this issue. Please help find out the solution 🙂

Thanks,  
Ken

[H0d525e77765b425fa09827a3d5d32fc8M.pdf](https://pdfjs.community/uploads/short-url/35jxEuz0cGwIO40ZFmqwdXeXjAP.pdf) (93.5 KB)

---

<div class="post-metadata">

**Author:** ![Logan](https://yyz1.discourse-cdn.com/flex031/user_avatar/pdfjs.community/logan/32/13_2.png) [@Logan](https://pdfjs.community/u/Logan)\
**Post date:** [August 10, 2021, 2:58pm UTC](https://pdfjs.community/t/error-while-calling-instance-printinbackground/930/6 "2021-08-10T14:58:05Z")

</div>

Hey there,

Thanks for the document, I can reproduce the issue when setting the print quality to 3.

I will investigate and get back to you when we have a solution. We will have to push a new release to fix this one.

For now, I recommend not setting the print quality so high.

Thanks!  
Logan
