In 1705 the king of Mataram ceded sovereignty over the Preanger territories, Semarang and Cheribon to the Company. In Semarang the Company encouraged the cultivation of indigo, which was used as a dyestuff. The local ruler declared his willingness to invest in indigo production, and soon delivered the first shipments. Growers continued to produce indigo, even when the price fell drastically as a result of oversupply.

In 1708 the headquarters of the VOC on the north-eastern coast of Java was relocated to Semarang from Japara. In 1748 the 'opperhoofd' or supervisor in Semarang was named governor of the north-east coast of Java.

The city was divided into four parts: the Javanese settlement with the big mosque, markets and the house of the regent on the west bank of Kali Semarang, the Malay settlement on the east bank, the Chinese settlement opposite the Javanese settlement on the east bank and the Dutch settlement with the fort north of the Chinese settlement.