The strongest possible way to encrypt data is to start with a threat model. What sort of adversary are you trying to protect your data from? What are they willing to do to get it? All reasonable approaches to cryptography start with one. If you start with one, you stand a chance of finding "the strongest" for your particular situation.
If you want the strongest, I’d suggest a one-time pad to encrypt the file.
If you want realistic, I suggest you rather expand on what your threat model is and take advice as to the actual level of encryption that you need is.
I know nothing about cryptography. How do we encrypt a file in strongest (emphasis added) possible way such that we can access them some years later. I prefer that it should be fairly resistant from brute force and other possible ways attacks. I need some direction only.
Use AES-256 in GCM mode.
This isn't a problem with an obvious solution. You need to plan in advance how you are going to handle and safely store your key material as well as your encrypted material. The strength and type of encryption is also part of that plan. If you lose your key, you can't decrypt your data. If someone grabs a copy of your key, they can decrypt the data. If you ...
Not sure if this is how it is done, but it is one way to do it.
Key A is derived from the first password, and key B is derived from the second password. A random key X is encrypted twice, once with key A and once with key B. Both are stored. The PDF is encrypted with key X.
When the user enters a password, it derives a key from it and tries to decrypt both ...