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

145
Views
How to toggle borders and controls of Fabric.js objects during image save?

I would like to create a fabric.js canvas, move some content around and then save the canvas as image. It has been done before (Fabric.js demo Objects Bounding Rectangles, save), but how do I update borders and controls to hidden during saving of the image?

I tried this, but it's not removing the border. And how do I re-instate it after save?

canvas.forEachObject(function (obj) {
    obj.hasBorders = false;
    obj.hasControls = false;
});
canvas.discardActiveObject();
canvas.renderAll();
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I found out that the border is manually created by the demo, so I just had to remove that part:

canvas.on('after:render', function () {
    canvas.contextContainer.strokeStyle = '#555';

    canvas.forEachObject(function (obj) {
        var bound = obj.getBoundingRect();

        canvas.contextContainer.strokeRect(
            bound.left + 0.5,
            bound.top + 0.5,
            bound.width,
            bound.height
        );
    })
});
about 4 years ago · Juan Pablo Isaza Report
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!