You need a music scanning program like SmartScore or PhotoScore. They are commercial programs without source code available. Audiveris is the one open-source music scanner that I know about. All of these export MusicXML files.
If your PDF file was created by a sheet music program, and has vector graphics instead of images, then you can use PDFtoMusic Pro. This is also a commercial program without source code available.
You can find links to all these programs on our
MusicXML software page.