Doctors set up a "mini operating theatre" at a factory in Sydney's west yesterday to amputate the legs of a worker who became trapped in an industrial paper compactor.

The 37-year-old man was in a critical condition at Westmead Hospital this morning after both his legs were amputated on the factory floor of a waste recycling centre at the Grand Avenue, Camellia about midday yesterday.

The man, a contractor, became trapped in the large hydraulic compactor below the waist about midday. As he lost large amounts of blood, fire crews tried dismantling the compactor to free the man.

But he was not freed until late in the afternoon, when an operation to amputate his legs was completed.

WorkCover NSW said it was investigating what led to the incident and could not release details.