<?xml version="1.0"?>
<ownershipDocument>

    <schemaVersion>X0206</schemaVersion>

    <documentType>3</documentType>

    <periodOfReport>2024-10-31</periodOfReport>

    <noSecuritiesOwned>1</noSecuritiesOwned>

    <issuer>
        <issuerCik>0001176199</issuerCik>
        <issuerName>JOHN HANCOCK PREFERRED INCOME FUND</issuerName>
        <issuerTradingSymbol>HPI</issuerTradingSymbol>
    </issuer>

    <reportingOwner>
        <reportingOwnerId>
            <rptOwnerCik>0002041656</rptOwnerCik>
            <rptOwnerName>Nataupsky Jeff</rptOwnerName>
        </reportingOwnerId>
        <reportingOwnerAddress>
            <rptOwnerStreet1>C/O JOHN HANCOCK</rptOwnerStreet1>
            <rptOwnerStreet2>200 BERKELEY STREET</rptOwnerStreet2>
            <rptOwnerCity>BOSTON</rptOwnerCity>
            <rptOwnerState>MA</rptOwnerState>
            <rptOwnerZipCode>02116</rptOwnerZipCode>
            <rptOwnerStateDescription></rptOwnerStateDescription>
        </reportingOwnerAddress>
        <reportingOwnerRelationship>
            <isDirector>0</isDirector>
            <isOfficer>1</isOfficer>
            <isTenPercentOwner>0</isTenPercentOwner>
            <isOther>0</isOther>
            <officerTitle>CFO &amp; Treasurer of the Adviser</officerTitle>
        </reportingOwnerRelationship>
    </reportingOwner>

    <ownerSignature>
        <signatureName>Thomas W. Dee, by Power of Attorney</signatureName>
        <signatureDate>2024-11-06</signatureDate>
    </ownerSignature>
</ownershipDocument>
