Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to parse invalid object while using drawRectangle #1572

Open
2 tasks done
bykof opened this issue Dec 14, 2023 · 0 comments
Open
2 tasks done

Trying to parse invalid object while using drawRectangle #1572

bykof opened this issue Dec 14, 2023 · 0 comments

Comments

@bykof
Copy link

bykof commented Dec 14, 2023

What were you trying to do?

I tried to add a rectangle to a page

How did you attempt to do it?

page.drawRectangle({
    x: xBox,
    y: yBox,
    width: boxWidth,
    height: boxHeight,
    opacity: marker_opacity,
    color: color,
  });

What actually happened?

   WARN  Trying to parse invalid object: {\"line\":78,\"column\":6,\"offset\":1749}).  
   WARN  Invalid object ref: 8 0 R.  
   WARN  pdf_tool/node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/cjs/core/structures/PDFPageLeaf.js:75.  
   WARN  Contents.push(contentStreamRef);.  
   WARN  ^.  
   WARN  TypeError: Contents.push is not a function.  
   WARN  at PDFPageLeaf.addContentStream (pdf_tool/node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/cjs/core/structures/PDFPageLeaf.js:75:18).  
   WARN  at PDFPage.getContentStream (pdf_tool/node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/cjs/api/PDFPage.js:1365:19).  
   WARN  at PDFPage.drawRectangle (pdf_tool/node_modules/.pnpm/pdf-lib@1.17.1/node_modules/pdf-lib/cjs/api/PDFPage.js:1204:34).  
   WARN  at drawPosition (pdf_tool/index.js:96:8).   

What did you expect to happen?

That the tool is able to add a rectangle

How can we reproduce the issue?

Unfortunately I am not allowed to share the PDF with you.

Version

1.17.1

What environment are you running pdf-lib in?

Node

Checklist

  • My report includes a Short, Self Contained, Correct (Compilable) Example.
  • I have attached all PDFs, images, and other files needed to run my SSCCE.

Additional Notes

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant