The majority of jurists are of the view that a disbeliever should be prevented from touching the Mus-haf and it is haram to enable him to do that. It is more appropriate that he be prevented from touching it than a Muslim, because there is the fear that he may treat it disrespectfully. Hence the Prophet (blessings and peace of Allah be upon him) did not allow Muslims to travel with the Quran to the land of the enemy, as al-Bukhari (2990) and Muslim (1869) narrated from `Abdullah ibn `Umar (may Allah be pleased with him) that the Messenger of Allah (blessings and peace of Allah be upon him) forbade travelling with the Quran to the land of the enemy.
An-Nawawi (may Allah have mercy on him) said in Al-Majmu` (2/85): Our companions said: The disbeliever is not to be prevented from listening to the Quran, but he is to be prevented from touching the Mus-haf. End quote.
Ar-Ramli (may Allah have mercy on him) said: The disbeliever should be prevented from putting his hands on the Mus-haf even for the purpose of binding the book, as Ibn `Abd as-Salam said, even if there is a hope that he may become Muslim.
End quote from Nihayat al-Muhtaj, 3/389.
Al-Baji said in Al-Muntaqa (3/165): If one of the disbelievers wants a Mus-haf to be sent to him so that he may study it, it should not be sent to him, because he is najis and junub (impure), and it is not permissible for him to touch the Mus-haf and it is not permissible for anyone to give it to him. This was stated by Ibn al-Majishon. End quote.
It says in Al-Mawsu`ah al-Fiqhiyyah: A disbeliever touching the Mus-haf and working in making copies of the Mus-haf and producing them: the disbeliever should not be allowed to touch the Mus-haf, just as the Muslim who is in a state of janabah is not allowed to touch it; in fact it is more appropriate to prevent the disbeliever from touching it, and he should be prevented from touching it in all cases, meaning whether he has done ghusl or not. In Al-Fatawa al-Hindiyyah it says that Abu Hanifah said: If he does ghusl, it is permissible for him to touch it. And it was narrated in Al-Bahr from Abu Hanifah and Abu Yusuf that he should not be allowed to touch it in all cases.
The disbelievers should not be allowed to work in producing Mus-hafs. Concerning that, al-Qalyubi said: The disbeliever should not be allowed to work in binding Mus-hafs or producing gilded calligraphy. But al-Bahuti said: It is permissible for the disbeliever to produce Mus-hafs without touching or holding them. (Mus-haf, para. 30).
It also says: The Malikis, Shafa`is and Hanbalis, and Abu Yusuf among the Hanafis, were of the view that it is not permissible for a disbeliever to touch the Mus-haf, because this is a kind of disrespecting the Mus-haf.
Muhammad ibn al-Hasan said: There is nothing wrong with a disbeliever touching the Mus-haf if he has done ghusl, because what makes it disallowed is being in a state of impurity, and that has been removed by doing ghusl. All that remains is the impurity of his belief, but that is in his heart and not in his hand. End quote.
Shaykh Ibn Baz (may Allah have mercy on him) was asked: What is the ruling on a Christian touching the Mus-haf, and on his touching a translation of the meanings of the Holy Quran?
He replied: This is a matter concerning which there is a difference of opinion among the scholars. The well-known view among the scholars is that Christians, Jews and other non-Muslims should be prevented [from touching the Mus-haf], because the Messenger (blessings and peace of Allah be upon him) forbade travelling with the Quran to the land of the enemy, lest it fall into their hands. This indicates that they should not be allowed to touch it; rather we may allow them to listen to it. Allah, may He be Exalted, says: {And if any one of the polytheists seeks your protection, then grant him protection so that he may hear the words of Allah [i.e., the Quran]} [at-Tawbah 9:6]. In other words, it should be recited to them so that they can hear it, but the Quran should not be handed over to them. Some of the scholars were of the view that it is permissible to do that if there is the hope that the non-Muslim may become Muslim. They quoted as evidence for that the fact that the Prophet (blessings and peace of Allah be upon him) wrote a letter to Heraclius, the Byzantine ruler, which contained the verse {Say, “O People of the Scripture, come to a word that is equitable between us and you …} [Al `Imran 3:64].
They said: This verse is a verse from the book of Allah, and he wrote it to Heraclius.
But the correct view is that this does not constitute proof; rather it indicates that it is permissible to write one or two verses of the book of Allah. As for handing over the Mus-haf [to a non-Muslim], there is no proven report to that effect from the Prophet (blessings and peace of Allah be upon him).
However, with regard to a book containing a translation of the meanings of the Quran, there is nothing wrong with a non-Muslim touching it, because the translation of the meanings is like a book of commentary and it is not a Quran. In other words, the translation is an explanation of the meanings of the Quran, so if a non-Muslim touches it, or one who is not in a state of purity touches it, that does not matter, because it does not come under the rulings on the Quran. The rulings on the Quran apply specifically to that which is written in Arabic only, and does not contain any commentary. However, if the Arabic text is accompanied by a translation, then it comes under the rulings on books of tafsir (commentary), and it is permissible for one who is in a state of impurity, a Muslim or a non-Muslim to hold it, because it is not a book of Quran; rather it is regarded as a book of commentary (tafsir).
End quote from Majmu` Fatawa ash-Shaykh Ibn Baz, 24/340.
However, we should point out here that mishandling of the Mus-haf on the part of a disbeliever – in a scenario such as that asked about – is not possible and is in fact very unlikely. Rather true mishandling – in our view – is printing a page of the Mus-haf for no purpose other than checking whether the machine is working properly. The scholars differed concerning the ruling regarding worn-out pages of the Mus-haf and whether they are to be burned, washed or shredded. Those who disallowed all of those options did so on the basis that handling it in such ways is disrespectful.
See: Al-Burhan fi `Ulum al-Quran by az-Zarkashi, 1/477.
So how can we print pages merely for the purpose of testing the machine, then dispose of them after that?
Based on that, if it is possible to check the printer and test it using something other than the Mus-haf, as you did, that is what must be done, and it is not permissible to print a page of the Mus-haf for that purpose, so long as it is possible to check the machine using something other than the Mus-haf. So if this non-Muslim checks the printing machine and tests it without touching the printed pages, there is nothing wrong with that either.
And Allah knows best.