convert doc.pdf -density 400 -quality 100%% -background white "doc.pdf" "d.jpg"
First thing is your second "doc.pdf" near the end is meaningless. You can only have one output image or one input image unless you are combining images or use -write to get another output.
Second, your -background is probably also meaningless. The default is white, but it is a setting and you have no command to use the setting. You could add -flatten. This will only be important if your pdf has transparency.
Third, you need to move the -density before the input image doc.pdf as it is vector format for text and has no density. So you have to set the density while (before) reading the input pdf and not afterwards. So your command should be
convert -density 400 doc.pdf -quality 100%% -background white -flatten "d.jpg"
or if no transparency just
convert -density 400 doc.pdf -quality 100%% "d.jpg"
Try that and let us know if that works. Otherwise, perhaps you could provide an example pdf for us to test.
Also what version of IM and platform are you using. It appears from your syntax that you are on Windows.