2

I have a blank page in the middle of my document that I'm unsure how to remove.

Beginning

\documentclass{article}
\usepackage[a6paper, top=1cm, bottom=1cm, left=1pt, right=1cm]{geometry}
\renewcommand{\familydefault}{\sfdefault}
\usepackage[table]{xcolor}
\usepackage{tabularx}
\usepackage{graphicx}
 \DeclareGraphicsExtensions{.pdf,.jpeg,.png}

\newcommand{\tab}[1]{\hspace{.19\textwidth}\rlap{#1}}
\pagenumbering{gobble}

\begin{document}

{\bf \huge Pick List for Test Client}
\\

{\bf Prepared on Wed, 26 Mar 2014 15:13:33 -0400}
\\

\noindent\makebox[\linewidth]{\rule{2\paperwidth}{0.4pt}}
\\

{\large Total Orders: 6}
  \\ \\

  \def\arraystretch{1.3}%
  \begin{tabularx}{\textwidth}{l !{\color{white}\vrule}!{\color{white}\vrule} X}
    \rowcolor{black}
    {\bf \large} & {\bf \large} \\
  \rowcolor{black}
   \textcolor{white}{\bf \huge Product} & \textcolor{white}{\bf \huge Quantity} \\
    12345 - test SKU do not use & 33\\
    SKU4 - test SKU do not use & 12\\
    SKU3 - test SKU do not use & 14\\
    SKU1 - test SKU do not use & 23\\
    SKU5 - test SKU do not use & 6\\    
    SKU2 - test SKU do not use & 5\\
\end{tabularx}
\\ \\ \\ 

{\bf \large \hfill Picked By: \makebox[2.0in]{\hrulefill}} 
\\ \\

{\bf \large \hfill Checked By: \makebox[2.0in]{\hrulefill}}


\newgeometry{left=0cm,top=0.2cm}
\includegraphics[scale=.225]{fake-label-easypost.png}  
\restoregeometry

{\bf \huge PF Test}
\\ \\ \\

{\bf \large Packaging Slip}
\\

{\large Order \#: Test03.25.14-1}

{\large Order \#: Order Date: Mar 26th, 2014}
\\ \\ 

{\bf \large Ship To: }{\large Recipient Name}

\tab{\large 1234 Random Street}

\tab{\large City, ST, 12345-1234}

\tab{\large US}
\\ \\

  \def\arraystretch{1.3}%
  \begin{tabularx}{\textwidth}{l !{\color{white}\vrule}!{\color{white}\vrule} X !{\color{white}\vrule}!{\color{white}\vrule} l}
    \rowcolor{black}
    {\bf \large} & {\bf \large} & {\bf \large} \\
  \rowcolor{black}
   \textcolor{white}{\bf \large SKU} & \textcolor{white}{\bf \large Description} & \textcolor{white}{\bf \large Quantity} \\
    12345 & test SKU do not use & 5\\
\end{tabularx}


\end{document}

Problem area

\newgeometry{left=0cm,top=0.2cm}
\includegraphics[scale=.225]{fake-label-easypost.png}  
\restoregeometry

Source: https://gist.github.com/dasickis/aaa8937b38b349689814


Edit: I got a solution that works so I added code-review tag. I know this code is hackish (understatement) and I'm wondering how I can improve it.

  • Please make a small inline example, not an external link which may not work when people search the site in 10 years time. – David Carlisle Mar 27 '14 at 18:55
  • 2
    This most likely is a result of your image not fitting on the page. Even though you specify scale=.225 and you think this makes it fit nicely within the text block margins, it may actually not even though it fits within the page boundary. Perhaps use \newgeometry{margin=0pt,top=0.2cm} to make sure all but the top margin doesn't exist. Alternatively, use something like width=\linewidth (and add a preceding \noindent before your \includegraphis) to see whether that solves it. Just a guess... – Werner Mar 27 '14 at 19:09
  • You also want to remove all the \\ that are not inside tabular, certainly never have them at the end of a paragraph (white space problems are inevitable if you do that) – David Carlisle Mar 27 '14 at 19:30
  • You most likely do not want the \newgeometry command before the image either. Just scale the image so it fits on the page and include it, changing the page geometry should only be needed in exceptional cases. – David Carlisle Mar 27 '14 at 19:33
1

Thanks Werner, the following solved my problem:

\newgeometry{margin=0pt,top=0.2cm}

Original comment in case it gets buried:

This most likely is a result of your image not fitting on the page. Even though you specify scale=.225 and you think this makes it fit nicely within the text block margins, it may actually not even though it fits within the page boundary. Perhaps use \newgeometry{margin=0pt,top=0.2cm} to make sure all but the top margin doesn't exist. Alternatively, use something like width=\linewidth (and add a preceding \noindent before your \includegraphis) to see whether that solves it. Just a guess...

|improve this answer|||||
  • You may also find it useful to include the "page-like" image using pdfpages. – Werner Mar 27 '14 at 20:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.