Removing artifact from PDF figure in LaTeX, compiled with pdflatex [duplicate]

I am working on a document in LaTeX, and when inserting pdf figures I get a weird black line down the right side. This is not present in the original pdfs (I've checked). I thought it might be some scaling issue, since several of my figures are large and I have to scale them smaller than actual size in LaTeX, but it also appears in this figure, which is actual size.
My code for the figure is:

\begin{figure}[t]
\includegraphics[height = 9.6cm]{"testschema"}
\caption{Database Schema for test case, simulating results from a test suite}
\label{fig:schematest}
\end{figure}


And the output after compiling with pdflatex is:

migrated from stackoverflow.comFeb 14 '14 at 8:05

This question came from our site for professional and enthusiast programmers.

• Welcome to TeX.sx! Your post was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. – Werner Feb 14 '14 at 14:42

This stems from an overfull \hbox as the image is too wide to fit within the margins. If you include the image inside a frame

% In the document preamble to show the text block visually
\usepackage{showframe}% http://ctan.org/pkg/showframe

\begin{figure}[ht]
\setlength{\fboxsep}{-\fboxrule}
\fbox{\includegraphics[height = 9.6cm]{testschema}}
...
\end{figure}


you'll see it's wider than the text block. This may be due to padding/white space surrounding the actual image (the bounding box is not tight enough). The rule drawn in the margin is usually not visible with only a "Warning: Overfull \hbox found..." in the .log. You can remove this rule by setting the width of \overfullrule to 0pt:

\setlength{\overfullrule}{0pt}


Other alternatives:

• run the PDF image through the pdfcrop Perl script to see if it can remove the excess white space;
• scale the image using width (to, say, \linewidth) rather than height;
• use the bb=<bbllx> <bblly> <bburx> <bbury> key-value (since you're using graphicx) to set the lower-left x,y and upper right x,y bounding box coordinates to trim the image yourself.