# What's the syntax for right justifying a caption only on an inserted pdf?

I'm new to Latex and although I've got the hang of basic justification, I don't have enough knowledge to work out the syntax for this specific problem.
I have inserted a pdf page and as a figure, it is quite large but ends before the page number which is how I want it. Unfortunately the caption appears in the bottom of the figure, but there is some whitespace to the right which the caption could fit into nicely, how can I right justify the caption please? I'd like the rest to remain untouched.

\usepackage{pdfpages,caption}

\begin{document}
...
\includepdf[pages={3},scale=.91,pagecommand={\null\vfill\captionof{figure}{blub}}]{WiringSchedule.pdf}


EDIT: Steffen's answer worked to move the caption but made the page number disappear. Dummy code to recreate shown here as requested:

\UseRawInputEncoding
\documentclass[10pt]{article}
\usepackage{graphicx}
\usepackage[margin=1.4in]{geometry}
\usepackage{pdfpages,caption}
\usepackage{mwe}

\graphicspath{ {./images/} }
\begin{document}

\blindtext

\pagebreak

\includepdf[scale=1,pagecommand={\null\vfill\captionof{figure}{blub}}]{example-image-a4} %shows page number

\includepdf[scale=1,picturecommand={\put(380,150){\parbox{4cm}{\captionof{figure}{Wiring Schedule}}}}]{example-image-a4} %doesn't show page number

\blindtext
\end{document}

• Why don't you use the simple \includegraphics? – user187802 May 6 '19 at 11:59
• I want to include the third page of a multi-page pdf document and I believed pdfpages was the best way to do it. – William May 6 '19 at 12:00
• No, it isn't in this case: \includegraphics[page=...,...]{pdf-document} – user187802 May 6 '19 at 12:01

With the following code the caption can be positioned everywhere on the page.

• change 500 to move it left or right
• change 300 to move it up or down
• change 4cm to set the width of the caption

\documentclass{article}

\usepackage{pdfpages,caption}

\begin{document}

\includepdf[pages={3},scale=.91,picturecommand={\put(500,300){\parbox{4cm}{\captionof{figure}{blub}}}},pagecommand={}]{WiringSchedule.pdf}

\end{document}

• Excellent, this is exactly what I need to control the position. But. This has made the page number diappear, any idea as to why it would do this? It had disappeared before, but appeared again once I scaled the page down... – William May 6 '19 at 11:22
• @William Can you make a short compilable document that reproduces the problem? If you need some dummy pdf to include, have a look into the mwe package – user188289 May 6 '19 at 11:25
• Done. I noticed a difference: picturecommand vs pagecommad? Thanks for your time... – William May 6 '19 at 11:49
• @William Thanks for the code. To get the page number back add ,pagecommand={} – user188289 May 6 '19 at 11:50
• Bang on, many thanks! – William May 6 '19 at 11:59
\documentclass{article}
\usepackage{hvfloat}
\begin{document}
\hvFloat[capPos=right,capVPos=bottom,objectFrame]{figure}%
{\includegraphics[page=4,width=0.7\linewidth]{/tmp/userguide.pdf}}%
{blub, this is the caption}{fig-1}

See \ref{fig-1}

\end{document}