PSTricks - Graphics for T<span class="e">e</span>X and L<span class="a">a</span>T<span class="e">e</span>X


Welcome to the PSTricks web site

PDF
TUG logo

Main page

Index
Bug list
Documentation
Doc errors
Examples
2D Gallery
3D Gallery
Packages
References
CTAN
Search CTAN:
Germany
USA

Statistics

 


Extended translation of the the 5th edition

 


the 7th edition, total of 960 colored pages

 


2nd edition, 212 pages, includes 32 color pages

 


 


 


 


 


 

 

 


 


2 a5 on one a4 page |  a4 to a5 conversion from PostScript to PDF |  Automatic export |  avi Videos as included files | 
Bibliography hrefs |  Bookmark | 
Color table |  Color and pagebreak |  Cropping whitespace | 
documentation |  draftcopy watermark | 
Image as a hyperref |  Extracting Images from a PDF file | 
Fonts |  Forms in a pdf Document | 
Graphics Quality | 
hyperref-package | 
Index hrefs |  Insert pdf pages of another document | 
MiKTeX | 
Papersize and pdflatex |  pdftricks |  PDF->ASCII |  pdflatex and Papersize |  pdftk (program) |  PSTricks image as a hyperref | 
Two a5 on one a4 page | 
Watermark |  Whitespace | 


Links to docs (related to PDF)

Cropping whitespace of a pdf page

Inserting a single or several pdf pages into another document is possible with the well known \inlcudegraphics macro. To cut the whitespace around the text one can use the program pdfcrop, available on CTAN. It is important that the cropped pdf document has a \pagestyle{empty}, otherwise the pagenumber is still there.

With the following script one can export all pages of a pdf file into single cropped pdf files.
#!/bin/bash
# Michael Niedermair 2005
name=${1%.pdf}
echo ${name}
pdftk ${name}.pdf burst
for file in pg_[0-9][0-9][0-9][0-9].pdf
do
    nr=${file:3:4}
    nrs=${nr:1:3}
    pdfcrop.pl --clip ${file} ${name}_${nrs}.pdf
    rm -f ${file}
done
rm -f ${name}.pdf
rm -f doc_data.txt

Another possibility is to use the package pdfpages, which allows to insert pdf pages of another document. For more informations read the package documentation or go here.

pdfbookmark

To get a bookmark you can use
\pdfbookmark[0]{My Chapter}{myAnchorName}
0: Level (0=chapter, 1=section, 2=subsection, ...)
"My Chapter": Text
"myAnchorName": anything which hyperref can use for the anchor name.


watermark

To get a watermark for PDF document you cannot use packages which have a solution with PostScript commands (like the draftcopy package). Use the pdfdraftcopy or the following code in your preamble.
\documentclass{article}
\usepackage{eso-pic}
\usepackage{graphicx}
\usepackage{color}
\usepackage{type1cm}
\makeatletter
  \AddToShipoutPicture{%
    \setlength{\@tempdimb}{.5\paperwidth}%
    \setlength{\@tempdimc}{.5\paperheight}%
    \setlength{\unitlength}{1pt}%
    \put(\strip@pt\@tempdimb,\strip@pt\@tempdimc){%
      \makebox(0,0){\rotatebox{45}{\textcolor[gray]{0.75}{\fontsize{5cm}{5cm}\selectfont{Draft}}}}
    }
}
\makeatother
\begin{document}
Text
\end{document}


Video
\documentclass{article}
\newsavebox{\MyBox}
\newcommand{\StartApp}[2]{%
\savebox{\MyBox}{#1}%
\hskip0pt
\pdfannot width \wd\MyBox height \ht\MyBox depth \dp\MyBox{
/Subtype /Link
/A <<
  /S /Launch
  /F (#2)

>> %/Border [16 16 0]

}#1}

\begin{document}
Hey, \StartApp{Klick mich!}{movie.mpeg}
\end{document}
Also have a look at easymovie.sty.


References
By default pdflatex converts references (figure/table/equation-numbers) to links, which includes only the number and not the forgoing word like figure/table/Equation. To get this in the link too, write
\hyperref[bar]{figure (\ref*{bar})}
where bar is a label in any figure environment.

hyperref0.gif


a4 to a5 conversion from PostScript to PDF
To get a a5-format pdf-output with ps2pdf from a a4 PostScript doc run
psresize -Pa4 -pa5 file_in.ps | ps2pdf -sPAPERSIZE=a5 - file_out.pdf


Graphics Quality
To get better Graphics conversion from eps to pdf you can try some of the following options:

For ps2pdf:
-dAutoFilterColorImages=false
-dAutoFilterGrayImages=false
-dEncodeColorImages=false
-dEncodeGrayImages=false
-dEncodeMonoImages=false
For epstopdf:
-dAutoFilterColorImages=false
-dAutoFilterGrayImages=false
-sColorImageFilter=FlateEncode
-sGrayImageFilter=FlateEncode
-dPDFSETTINGS=/prepress
-dUseFlateCompression=true


Font Substitution
To get a better output for pdf files substitute the fonts with
\usepackage{lmodern}
or, if you do not have the lm fonts installed:
\usepackage{mathptmx}% instead of package times
\usepackage[scaled=0.9]{helvet} % or [scaled=0.92], if you like
\usepackage[scaled=0.92]{beramono}% do _not_ use courier


Forms in a PDF Document
Download the TeX-demofile from CTAN and run it with
pdflatex testform.tex
than you'll see in the output testfile.pdf what forms are possible for pdf.


Convert Files to pdf
If you have a lot of files to convert from any type to pdf use the following bash command, which makes life easier, because it converts all files with extension "eps":
for FILE in *.eps ; do epstopdf $FILE ; done
You need the program eostopdf, which should be part of your local TeX Installation.


Insert whole a4 pages or two a5 on one a4 page
in latex preamble
\usepackage{pdfpages}
package maybe part of your local tex-installation or available at CTAN. In the text write for example:
\includepdf[pages={1-10}, nup=2, scale=1.414]{a5doc.pdf}
if you want to insert the pages 1-10 of the pdf-document a5doc.pdf in your actual document.

For a single pdf page you can also use:
\includegraphics[page={5}, scale=1.414]{a5doc.pdf}
it knows the optional argument page.


PDF->ASCII
with
pdfimages -f 1 file.pdf DirForTheImages
extract all images in the pdf-file. with option -j you can save them as jpegs, otherwise by default ppm or pbm - format (a good choice).

With
pdftotext file.pdf file.txt
convert all to text.

when the pdf-file has some scanned-text, which is saved as image, you can convert these from pbm to tiff and than running an OCR-program.

In case you're wondering where to get pdfimages and pdftotext, they're part of xpdf.
pdftk, a pdf toolkit.

Examples

Merge Two or More PDFs into a New Document

pdftk 1.pdf 2.pdf 3.pdf cat output 123.pdf

or (Using Handles):

pdftk A=1.pdf B=2.pdf cat A B output 12.pdf

or (Using Wildcards):

pdftk *.pdf cat output combined.pdf

Split Select Pages from Multiple PDFs into a New Document

pdftk A=one.pdf B=two.pdf cat A1-7 B1-5 A8 output combined.pdf

Rotate the First Page of a PDF to 90 Degrees Clockwise

pdftk in.pdf cat 1E 2-end output out.pdf

Rotate an Entire PDF Document's Pages to 180 Degrees

pdftk in.pdf cat 1-endS output out.pdf

Encrypt a PDF using 128-Bit Strength (the Default) and Withhold All Permissions (the Default)

pdftk mydoc.pdf output mydoc.128.pdf owner_pw foopass

Same as Above, Except a Password is Required to Open the PDF

pdftk mydoc.pdf output mydoc.128.pdf owner_pw foo user_pw baz

Same as Above, Except Printing is Allowed (after the PDF is Open)

pdftk mydoc.pdf output mydoc.128.pdf owner_pw foo user_pw baz allow printing

Decrypt a PDF

pdftk secured.pdf input_pw foopass output unsecured.pdf

Join Two Files, One of Which is Encrypted (the Output is Not Encrypted)

pdftk A=secured.pdf mydoc.pdf input_pw A=foopass cat output combined.pdf

Uncompress PDF Page Streams for Editing the PDF Code in a Text Editor

pdftk mydoc.pdf output mydoc.clear.pdf uncompress

Repair a PDF's Corrupted XREF Table and Stream Lengths (If Possible)

pdftk broken.pdf output fixed.pdf

Burst a Single PDF Document into Single Pages and Report its Data to doc_data.txt

pdftk mydoc.pdf burst

Report on PDF Document Metadata, Bookmarks and Page Labels

pdftk mydoc.pdf dump_data output report.txt

local time: Sat Dec 21 17:55:25 CET 2024 ; file is: 810.062488425926 days old
contact webmaster _at_ perce.de