The possibility of postprocessing mentioned in the latexmk documentation is only for dvi and postscript files. (See the description of the
-pF options, and of the configuration variables
$ps_filter.) I need to correct the documentation on this point. I could improve latexmk to also do this for pdf files.
But there is a simpler and more general method. Just define the
$pdflatex command to include the invocation of qpdf. For example, you could put the following in one of latexmk's initialization files:
$pdflatex = 'pdflatex %O %S && qpdf -linearize %D tmp.pdf && mv tmp.pdf %D';
(This is in a form suitable for Unix-like operating systems, it will need to be changed for MS-Windows, probably.) When latexmk uses this, it executes the pdflatex command; if successful it invokes qpdf, putting the result in a temporary file; if that is successful the temporary file is moved to replace the originally generated pdf file.
I don't have qpdf installed on my computer, so I am working from its documentation to write a suitable invocation of it.
If you want a command line option to control the use of qpdf, put the above line in its own file, e.g., useqpdf. Then you can invoke latexmk to read this file when needed:
latexmk -r useqpdf foo.tex