Republican presidential hopeful Carly Fiorina has been an outspoken opponent of Iran on the campaign trail, but during her time as CEO of Hewlett-Packard, it appears as if she was singing an entirely different tune.

Fiorina often calls for keeping the crippling economic sanctions on Tehran and routinely criticizes President Obama's Iran deal, however, under her leadership at Hewlett-Packard from 1999 to 2005, the company sold hundreds of millions of dollars of printers and other computer products to Iran through a foreign subsidiary, despite U.S. export sanctions prohibiting such deals, according to a Bloomberg report.

She was able to thwart the sanctions by using intermediary companies in Europe and the Middle East, allowing H.P. to dominate the market in Iran, so much so that by 2007, H.P. printers were a best selling item with 41 percent of the market share, according to the Boston Globe.

A 1997 agreement with the Indian-owned and Dubai-based Redington Gulf was key to H.P.'s success in Iran, the Globe first reported.

Fiorina was leading this effort in Iran despite two executive orders issued in 1995 by former President Bill Clinton which banned all U.S. companies from exporting to Iran. "If H.P. executives knew about what the Dubai-based distributer was doing, they would have been breaking U.S. law," writes Bloomberg's Josh Rogin.

When the U.S. Securities and Exchange Commission began an investigation into H.P.'s activities in Iran, the company admitted it had sold $120 million dollars worth of products to Redington Gulf, but said they did not violate the sanctions law because H.P.'s products were distributed in Iran by a foreign subsidiary based in the Netherlands. H.P. cut ties with Redington Gulf soon after.

During Fiorina's 2010 run for the California Senate, her campaign said she had no knowledge of H.P.'s business in Iran. "It is illegal for American companies to do business in Iran," spokeswoman Beth Miller said at the time, reported ABC. "To her knowledge, during her tenure, H.P. never did business in Iran and fully complied with all U.S. sanctions and laws."

However, in 1999, H.P.'s general manager for the Middle East said that "Iran is a big market for the Hewlett-Packard printers" and in 2003, Fiorina even praised high H.P. sales in the region, according to San Jose Mercury News. H.P. also named their Redington Gulf distributor as "Wholesaler of the Year" in 2003. Redington even sent out a press release that year saying, "The seeds of the Redington-Hewlett-Packard relationship were sowed six years ago for one market - Iran," notes Bloomberg.

In the later stages of her 2010 Senate campaign, Fiorina partially acknowledged H.P.'s dealings inside of Iran, claiming the company was "distributing printer ink," which, according to her, was permitted under export law.

Senate lobbying records show that every year from 1999 to 2004, H.P. had lobbyists pressing lawmakers to pursue "unilateral sanctions reform legislation," according to Bloomberg.