Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

What is --hires for?

To obtain a better result when cropping a pdf image produced by PSTricks, I use --hires option as follows

latex filename.tex
dvips filename.dvi
ps2pdf -sOutputFile=filename-temp.pdf filename.ps
pdfcrop --hires filename-temp.pdf filename.pdf

According to pdfcrop --help shown in the following screenshot, the --hires make pdfcrop use high resolution bounding box (instead of the usual bounding box) to crop a pdf input.

enter image description here

Scenario & Problem

I am writing a book that use PDF, PNG, JPEG images and PSTricks codes. Actually xelatex can help me to compile the input file. Unfortunately, xelatex runs very very very slowly. The very bad performance makes me reluctant to use xelatex.

The next candidates are pdflatex (and context but I am not familiar with it). Behind the scene, pdflatex with auto-pst-pdf package compiles each PSTrick code, converts it to PDF, crops the surrounding white space of the PDF image, and finally includes all the resulting PDF images to produce a complete document. In this process, there is a temporary PDF file that contains a bunch of the cropped PDF images in the working directory. Unfortunately, the bounding box is not so accurate. If we see each cropped image carefully, we will notice that the left, right, top, and bottom margins are not exactly the same. Therefore, I need to pass --hires to pdfcrop, but I don't know how to do this.

The following code snippet might be needed for a test.

Don't forget to use -shell-escape or --enable-write18 when invoking pdflatex.

\documentclass{article}
\usepackage[english]{babel}
\usepackage{pstricks}
\usepackage{auto-pst-pdf}% I need pass --hires, but how ?
\usepackage{blindtext}
\begin{document}

\blindtext
\begin{figure}[hbtp]
\centering
\begin{pspicture}(4,3)
\pscircle[fillstyle=solid,fillcolor=red,opacity=0.2](2,3){2}
\end{pspicture}
\caption{\label{fig:circle}This is a circle.}
\end{figure}
\blindtext

\end{document}

Question

Is it possible to force auto-pst-pdf to use --hires option when it internally invokes pdfcrop?

share|improve this question

1 Answer 1

up vote 3 down vote accepted
\usepackage[...,
  pspdf={-dAutoRotatePages=/None}},
  pdfcrop={--hires}]{auto-pst-pdf}
share|improve this answer
    
@xport: that's a typo, I meant ps2pdf. pspdf is an own script. –  Herbert Jun 13 '11 at 11:55
1  
@xport: ah, sure. Totally forget, that the keywords can't contain a digit in their names. –  Herbert Jun 13 '11 at 12:17
    
-dAutoRotatePages=/None is mandatory? If I ignore it, what is the problem? –  xport Jul 2 '11 at 23:54
1  
When using ghostscript it can be sometimes too clever and rotates an images itself where it shouldn't be rotated –  Herbert Jul 3 '11 at 7:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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