Page LayoutPDF Page Size fits Text

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
MrH86A
Posts: 9
Joined: Tue Nov 08, 2011 4:36 pm

PDF Page Size fits Text

Post by MrH86A »

Hi,

How can I fix the page size of the PDF to fit the text, i.e no margins at all? I am wondering if there is a command or a page options that does it automatically.

Ultimately I want to create only a line of text or symbols and use the pdfs as vector images, so I don't want any white margines/space surrounding the text.

Thank you!
Last edited by MrH86A on Tue Nov 08, 2011 5:59 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

PDF Page Size fits Text

Post by localghost »

User either the preview package or the standalone class (which in turn uses the mentioned package).


Best regards and welcome to the board
Thorsten
MrH86A
Posts: 9
Joined: Tue Nov 08, 2011 4:36 pm

PDF Page Size fits Text

Post by MrH86A »

Thank you for your very fast reply! I still couldn't figure it out. The preview package seems to do nothing. If we consider a simple example:

Code: Select all

\documentclass{article}

\usepackage[<active>]{preview}

\begin{document}
test
\end{document}
Can you please tell me how to modify this code to produce a pdf with no white space or magines surrounding the work "test"?

Thanks in advance!
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

PDF Page Size fits Text

Post by localghost »

For a standard class you have to specify the content for the preview.

Code: Select all

\documentclass{article}
\usepackage[active,tightpage]{preview}

\begin{document}
  \begin{preview}
    Test 
  \end{preview}
\end{document}
For details refer to the preview manual.

The standalone class makes this easier.

Code: Select all

\documentclass{standalone}

\begin{document}
  Test 
\end{document}
MrH86A
Posts: 9
Joined: Tue Nov 08, 2011 4:36 pm

Re: PDF Page Size fits Text

Post by MrH86A »

Thank you Sir! This is exactly what I was looking for.

I spent the entire day looking for an easy solution to crop the pdf with at third party software with no luck. you have saved me time and money :D . Thank you!
Post Reply