The development of digital technology poses challenges to data security, especially in frequently used PDF files. Cryptography can be used for data security. The conventional RSA algorithm with a static public key is vulnerable to attacks. This study integrates Diffie-Hellman to generate a shared key as a public exponent (e) in RSA, making key generation more dynamic and secure. The method includes system analysis, a combined implementation of Diffie-Hellman and RSA, and testing on PDF files. Data is converted to decimal numeric format before encryption and decryption. The encryption is stored in (*.txt), decryption returns the file to the original PDF. The results show that the use of a shared key improves security even though the encrypted file size increases by about 4-5 times from the original file. This system is expected to be a better solution for PDF security and modern cryptography.