7

Do you know a possibility how to export a PDF, that has just blank space where the graphics should be? (And the other way round)

Why do I need this? I have a black and white laser printer and an inkjet printer.

I would love to use the black and white laser printer for the text, take the printed paper and put it in the inkjet printer to get perfect colorful pictures in my printings.

Or is there a other possibility?

  • 1
    Your inkjet won't like it. (They almost all say not to put printed paper back through.) – cfr Apr 16 '15 at 1:40
  • LaTeX has the \phantom{text} command which leaves 'text' blank and only reserves the space. Maybe you could utilize this to create the graphics-only version. – Uwe Ziegenhagen Apr 16 '15 at 4:02
  • For omitting the figures, you might want to look at Placeholder for figure/includegraphics. Perhaps you could try modifying the example in the answer with picins package. – Fato39 Apr 16 '15 at 7:34
  • I could also use the inkjet first and then the laser :). – TimK Apr 16 '15 at 9:31
  • Welcome to TeX.SX! Usually, we don't put a greeting or a “thank you” in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Accepting and upvoting answers is the preferred way here to say “thank you” to users who helped you. – Martin Schröder Apr 21 '15 at 17:55
5

So you want to

"...know a possibility how to export a PDF, that has just blank space where the graphics should be? (And the other way round)"

Well, I don't know how to reach that point directly. But I know a detour with three backdoors which get you were you want:

  1. First, the detour: Export to PDF just as normal. The result will be no blank space where the graphics should be. No, there will be a graphics where the graphics should be. And text plus vectors where text plus vectors should be...

  2. Second, the first backdoor: Make sure you have a Ghostscript version v9.16 or newer installed. Then run:

    gs -o onlytext.pdf -sDEVICE=pdfwrite -dFILTERIMAGE -dFILTERVECTOR input.pdf
    

    The -dFILTERIMAGEparameter will remove all raster images from your PDF. The -dFILTERVECTOR param will remove all vector drawings or other line art from your PDF. What remains are all the textual components on all pages.

  3. Third, the second backdoor: Use the same Ghostscript and run:

    gs -o onlyimage.pdf -sDEVICE=pdfwrite -dFILTERTEXT -dFILTERVECTOR input.pdf
    

    The -dFILTERTEXTparameter will remove all text parts from your PDF. The -dFILTERVECTOR param you're already familiar with.... What remains are the raster image components on all pages.

  4. Fourth, the third backdoor: Again, run Ghostscript:

    gs -o onlyvector.pdf -sDEVICE=pdfwrite -dFILTERTEXT -dFILTERIMAGE input.pdf
    

    You guess what this does? What remains are only the vector components on all pages.

Of course, you could also use only one of the params to remove one of the element types from the PDF and retain the other two.


Example output

Here is an example document which I use to demo the options. Admittedly, the document wasn't created with LaTeX, so bear with me...

Screenshot of original PDF page containing "image", "vector" and "text" elements.
Screenshot of original PDF page containing "image", "vector" and "text" elements.

Running the following 6 commands will create all 6 possible variations of remaining contents:

 gs -o noIMG.pdf   -sDEVICE=pdfwrite -dFILTERIMAGE                input.pdf
 gs -o noTXT.pdf   -sDEVICE=pdfwrite -dFILTERTEXT                 input.pdf
 gs -o noVCTR.pdf  -sDEVICE=pdfwrite -dFILTERVECTOR               input.pdf

 gs -o onlyTXT.pdf -sDEVICE=pdfwrite -dFILTERVECTOR -dFILTERIMAGE input.pdf 
 gs -o onlyIMG.pdf -sDEVICE=pdfwrite -dFILTERVECTOR -dFILTERTEXT  input.pdf
 gs -o onlyVCT.pdf -sDEVICE=pdfwrite -dFILTERIMAGE  -dFILTERTEXT  input.pdf

The following image illustrates the results:


Top row, from left: all "text" removed; all "images" removed; all "vectors" removed. Bottom row, from left: only "text" kept; only "images" kept; only "vectors" kept.
Top row, from left: all "text" removed; all "images" removed; all "vectors" removed. Bottom row, from left: only "text" kept; only "images" kept; only "vectors" kept.


  • Thank you very much for your detailed answer and for showing a backdoor approach! It is a interesting way and I tend to accept your answer (as it does not seem to me that there will be any better options soon). Except the only "problem" I see are the areas with mixed content (the plot). The labels are "over" the text. I would print laser first and the second "print" would be inkjet. Inkjet has problem sticking on laser toner, the other way round is better, but not ideal. So there's probably no way of removing the labels from the graph without changing their type, or is there? – TimK Jan 2 at 16:45
  • 1
    @TimK: whether there are areas where any two of the three base components (text, pixelgraphics and vectors) are mixed and overlayed onto each other is totally dependent on the software which generated the PDF file and on the author who designed the original document. My demo example at the time was made with a random file (actually, one made for another demo purpose) I had just handy. But it shows what could occur in real life. And no, you'll very likely not see any better options coming up soon. – Kurt Pfeifle Jan 2 at 17:48

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.