A standard way to manually add a digital signature to a pdf file?
According to your comments to other answers, you actually want to
sign a pdf file with [your] certificate, then have this signature saved and appended to the pdf [you]'ve just signed.
(BTW, you sign with the private key associated with the public key in your certificate, not with the certificate itself, but that's a detail.)
I assume you want to "append" the signature to the PDF in a way that a standard conform PDF viewer (e.g. Adobe Reader) will recognize, display, and validate as an integrated PDF signature.
In that case you already started wrong by signing the original PDF as is and expecting to now have to merely somehow append that signature to the file. Instead you have to build a new revision of the PDF document which includes a PDF AcroForm signature field whose value is a signature dictionary whose /Contents entry contains the signature of the whole new revision with the exception of the /Contents entry contents.
If multiple signatures are to be integrated into a PDF, this is done by means of incremental PDF updates (explicitly not by adding multiple SignerInfo structures to a single integrated CMS signature container!):
This is explained quite graphically and in more detail in the Adobe document Digital Signatures in a PDF. It furthermore is specified in the PDF specification ISO 32000-1:2008 made available here by Adobe in section 12.8 Digital Signatures.
Be aware, though! The specification says:
A byte range digest shall be computed over a range of bytes in the file, that shall be indicated by the ByteRange entry in the signature dictionary. This range should be the entire file, including the signature dictionary but excluding the signature value itself (the Contents entry). Other ranges may be used but since they do not check for all changes to the document, their use is not recommended.
This seems to allow that you first create a signature for the original PDF and then append a new revision holding that signature indicating that range of signed bytes only contains that original revision, not the extended revision without only the signature.
In reality, though, PDF viewers (especially Adobe Reader) will only accept signatures which follow the recommendation that the signed range should be the entire file, including the signature dictionary but excluding the signature value itself.
Newer specifications, e.g. the ETSI PAdES specification ETSI TS 102 778 (cf. section 5.1 item b in part 2 and section 4.2 item c in part 3) even make this recommendation officially a requirements, and so will ISO 32000-2.
Depending on your programming context, there are many PDF libraries supporting the creation of integrated PDF signatures and also many products using these libraries. Some of them are even available for free subject e.g. to the AGPL.