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.

Is it possible to force auto-pst-pdf or pst-pdf to create PDF images and include them if I’m using xelatex?

Background

I have to typset a Book that needs OpenType fonts so I choose xelatex. The autor made her graphics with pstricks. Everything works fine and I can compile the file and get the PDF with the graphics all right. But the PDF must be converted with Acrobat Pro (color conversion to gray scale—I didn’t choose this workflow …) and I get an error when the PDF contains material creadet by PSTricks. My idea to solve this is to export all {pspictures} as a PDF image and include these images back to the main file. Thats exactly what auto-pst-pdf does when it is used with pdflatex but not together with xelatex :-(

I have only a german Acrobat but with this images you maybe see my what I mean:
adobe workflow

Example Code

The following code works fine with xelatex but I need the graphic to be exported and reimported as PDF image.

\documentclass{minimal}

\usepackage{auto-pst-pdf}
\usepackage{pstricks}

\begin{document}
\begin{pspicture}(6,6)
   \psline[linecolor=red](1,1)(5,1)(1,4)(1,1)
   \pscurve[linecolor=green,linewidth=2pt,%
     showpoints=true](5,5)(3,2)(4,4)(2,3)
   \pscircle[linecolor=blue,linestyle=dashed](3,2.5){1}
 \end{pspicture}
\end{document}

Edit
I asked the question at the german board typografie.info. Maybe there’s a PDF expert who knows how to fix the PDF …

share|improve this question
1  
You can use pstricks with XeLaTeX without packages like auto-pst-pdf. –  Marco Daniel Nov 7 '11 at 18:45
    
@MarcoDaniel: Yea I know, but Acrobat isn’t happy with that ;-) –  Tobi Nov 7 '11 at 19:45
    
@Tobi: Did you try post-processing your PDF with GhostScript (PDF-to-PDF)? This tends to make the files smaller (which is why people to do it), but also fixes a number of complaints in my experience. –  Joseph Wright Nov 8 '11 at 9:50
    
@JosephWright: No I didn’t. I have gs installed but can’t use it. Could you please tell me the command for this conversion? –  Tobi Nov 8 '11 at 17:05
1  
@Tobi Usually something like gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf works. –  Joseph Wright Nov 8 '11 at 17:23
show 1 more comment

3 Answers

up vote 2 down vote accepted
+100

" ... But the PDF must be converted with Acrobat Pro (color conversion to gray scale—I didn’t choose this workflow …) and I get an error when the PDF contains material created by PSTricks."

The following process using Acrobat Pro 9 (Mac version) converts the pdf file containing the image generated by your minimal code to a pdf file containing a grayscale image.

(1) Open the file with Acrobat Pro.

(2) Select Export > Postcript > Postcript

(3) Select "Settings"

(4) Select "Generic Gray Profile" for Color Profile.

(5) Save the file.

(6) Now open the .ps file (either in Acrobat Distiller or in Preview) and save it as a pdf.

The following is the output.

enter image description here

share|improve this answer
1  
Thank you very much! It worked fine :-) Unfortunately a few hours too late for the first bounty, but I started a second one ;-) –  Tobi Nov 18 '11 at 0:12
add comment

This is not the answer to your actual question, but rather an advice about your underlying problem.

  1. You may want all figures, including the ones created by pstrick, to use cmyk color model by specifying \usepackage[cmyk]{xcolor}. This might make Acrobat Pro happy (it might dislike the fact that different parts of PDF use different color models).

  2. You may want to create grayscale or monochrome PDF using \usepackage[gray]{xcolor} or \usepackage[monochrome]{xcolor}. In this case you might not need Acrobat Pro at all.

share|improve this answer
    
Thanks, but I tried this already and it doesn’t change anything … –  Tobi Nov 8 '11 at 16:55
    
You mean option 1 or option 2? I have a strong suspicion that if option 1 does not work, Acrobat would not like the files from auto-pst-pdf either, and you are left with option 2... –  Boris Nov 8 '11 at 17:16
    
I tried only option 1 because option 2 is no option (I can’T influence the work flow for this project). But why does Acrobat have a problem. If I use colors (with xcolor) and no PSTricks Acrobat is happy … –  Tobi Nov 8 '11 at 20:56
add comment

it works with lualatex:

\documentclass{article}
\usepackage{ifluatex}
\ifluatex
  \usepackage{pstricks}
\fi
\usepackage{auto-pst-pdf}

\begin{document}

\begin{pspicture}(5,5)
\psline[linecolor=red,linewidth=2pt]{*-*}(5,5)
\end{pspicture}

\end{document}

lualatex -shell-escape <file>

By the way: you can convert the file into gray scale also by ghostscript

gs -sOutputFile=<grayscale.pdf> -sDEVICE=pdfwrite -sColorConversionStrategy=Gray -dProcessColorModel=/DeviceGray -dCompatibilityLevel=1.4 -dNOPAUSE -dBATCH <color.pdf>
share|improve this answer
    
With lualatex I get the desired output with external PDF images but it doesn’t work too. There must be a problem with PSTricks … Can I convert the PDF to grayscale with gs and use the Gamma Grey 1.8 profile as Acrobat does? –  Tobi Nov 9 '11 at 11:34
    
There is no problem with PSTricks. It is acrobat! For gs see edit –  Herbert Nov 9 '11 at 11:45
    
In my eyes it’s PSTricks because Acrobat works fine with PDF without PSTricks graphics :-P –  Tobi Nov 9 '11 at 12:05
    
The gray conversion worked but I must check if the colors are matching the other parts, which come from MS Word (not my choice!), of the book … –  Tobi Nov 9 '11 at 12:11
add comment

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.