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

    <schemaVersion>X0202</schemaVersion>

    <documentType>4</documentType>

    <periodOfReport>2004-12-31</periodOfReport>

    <notSubjectToSection16>0</notSubjectToSection16>

    <issuer>
        <issuerCik>0000102212</issuerCik>
        <issuerName>UNIVEST CORP OF PENNSYLVANIA</issuerName>
        <issuerTradingSymbol>UVSP</issuerTradingSymbol>
    </issuer>

    <reportingOwner>
        <reportingOwnerId>
            <rptOwnerCik>0001201786</rptOwnerCik>
            <rptOwnerName>BIELER WALLACE H</rptOwnerName>
        </reportingOwnerId>
        <reportingOwnerAddress>
            <rptOwnerStreet1>478 COWPATH ROAD</rptOwnerStreet1>
            <rptOwnerStreet2></rptOwnerStreet2>
            <rptOwnerCity>TELFORD</rptOwnerCity>
            <rptOwnerState>PA</rptOwnerState>
            <rptOwnerZipCode>18964</rptOwnerZipCode>
            <rptOwnerStateDescription></rptOwnerStateDescription>
        </reportingOwnerAddress>
        <reportingOwnerRelationship>
            <isDirector>0</isDirector>
            <isOfficer>1</isOfficer>
            <isTenPercentOwner>0</isTenPercentOwner>
            <isOther>0</isOther>
            <officerTitle>Senior Executive VP &amp; CFO</officerTitle>
        </reportingOwnerRelationship>
    </reportingOwner>

    <nonDerivativeTable>
        <nonDerivativeHolding>
            <securityTitle>
                <value>COMMON</value>
            </securityTitle>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>23372.7841</value>
                    <footnoteId id="F1"/>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </nonDerivativeHolding>
    </nonDerivativeTable>

    <derivativeTable>
        <derivativeTransaction>
            <securityTitle>
                <value>STOCK OPTIONS</value>
            </securityTitle>
            <conversionOrExercisePrice>
                <value>45.83</value>
            </conversionOrExercisePrice>
            <transactionDate>
                <value>2004-12-31</value>
            </transactionDate>
            <transactionCoding>
                <transactionFormType>4</transactionFormType>
                <transactionCode>A</transactionCode>
                <equitySwapInvolved>0</equitySwapInvolved>
            </transactionCoding>
            <transactionTimeliness>
                <value></value>
            </transactionTimeliness>
            <transactionAmounts>
                <transactionShares>
                    <value>5300</value>
                </transactionShares>
                <transactionPricePerShare>
                    <value>45.83</value>
                </transactionPricePerShare>
                <transactionAcquiredDisposedCode>
                    <value>A</value>
                </transactionAcquiredDisposedCode>
            </transactionAmounts>
            <exerciseDate>
                <value>2006-12-31</value>
            </exerciseDate>
            <expirationDate>
                <value>2014-12-31</value>
            </expirationDate>
            <underlyingSecurity>
                <underlyingSecurityTitle>
                    <value>COMMON</value>
                </underlyingSecurityTitle>
                <underlyingSecurityShares>
                    <value>5300</value>
                </underlyingSecurityShares>
            </underlyingSecurity>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>5300</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </derivativeTransaction>
    </derivativeTable>

    <footnotes>
        <footnote id="F1">DOES INCLUDE 18,153.9380 SHARES ACQUIRED ON OR AFTER AUGUST 15, 1996 THROUGH THE DIVIDEND REINVESTMENT AND EMPLOYEE STOCK PURCHASE PLANS.</footnote>
    </footnotes>

    <ownerSignature>
        <signatureName>Wallace H. Bieler</signatureName>
        <signatureDate>2005-01-04</signatureDate>
    </ownerSignature>
</ownershipDocument>
[{"type": "4", "sequence": "1", "filename": "primary_doc.xml", "description": "PRIMARY DOCUMENT", "secsgml_size_bytes": 4503}]
X0202
4
2004-12-31
0
0000102212
UNIVEST CORP OF PENNSYLVANIA
UVSP
0001201786
BIELER WALLACE H
478 COWPATH ROAD
TELFORD
PA
18964
0
1
0
0
Senior Executive VP & CFO
COMMON
23372.7841
D
STOCK OPTIONS
45.83
2004-12-31
4
A
0
5300
45.83
A
2006-12-31
2014-12-31
COMMON
5300
5300
D
DOES INCLUDE 18,153.9380 SHARES ACQUIRED ON OR AFTER AUGUST 15, 1996 THROUGH THE DIVIDEND REINVESTMENT AND EMPLOYEE STOCK PURCHASE PLANS.
Wallace H. Bieler
2005-01-04