Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

112
Views
Fabric JS exclude every objects and portions of objects outside of the canvas when running toDataURL

On my canvas I have an object that is partly outside of the canvas, and I think it looks great, but as soon as I run toDataURL() on the canvas in order to export it as a PNG it includes the entire object in the resulting image. I am wondering if there is a way to "cut off" all objects that are outside or partly outside of the canvas.

This is what I see on the canvas, I have taken the moon and put it on the upper left corner, only 1/4 of the original object is visible.

enter image description here

And this is what I get out when I run toDataURL(), the whole moon object is visible here (ignore the wooden frame)

enter image description here

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!