Depth of focus is quite straight forward really if a little perverse. The camera lens has a adjustable hole in it called the aperture. It changes the amount of light that reaches the sensor. Physics also shows that any lens can only focus between two distances, the near focus point and the far focus point. Outside of that the image is a little blurred. The distance between these focus points is the depth of field. The smaller the hole ( aperture) the wider apart are those two distances. So if you focus on say the middle of the pen, you really need both ends of the pen between the two distances. Now if the pen is sideways on that's easy, but the picture does not look so good. If the pen is at a slight angle to the camera then the nib and the finial end are going to be different distances from the camera. To get both ends in focus you need to make the aperture smaller and this has the effect of widening the two distance between the two points of focus. Now the perverse bit. The size of the aperture is measured in f numbers. f2.8, f3.5 etc. Contrary to what one might expect, f3.5 is a bigger hole than f8. I know it sounds daft but that's physics for you. To get a bigger depth of field you need a smaller hole so set the camera at f8, f11 or something like that.
Right at the start I said that the size of the aperture controlled the amount of light reaching the sensor, so with a smaller aperture you need to increase the shutter speed to compensate for the reduced amount of light. So not say 1/60 second but maybe 1/20 or even longer. To do this you need the camera on a tripod or something otherwise camera shake will blur the whole picture.
Set the camera on aperture priority if you can and the camera meter will sort the shutter speed to match the aperture you set. Increasing the iso speed of the sensor can also help. It doesn't change the depth of field but in allows a faster shutter speed which reduces the chance of camera shake if you have to hold the camera.
Hope this helps.
Allen