Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I want to include the display of my terminal in a beamer presentation. Simply taking a screenshot, however, produces a fairly low-resolution png that looks poor in the presentation. I would like it if I could somehow create a PDF of the terminal display, so the image looks crisp and clean in the presentation. As a note, I'm viewing a file in VIM, which applies very nice syntax highlighting that I'd like to preserve. This is why I don't just copy and paste the text to a word processor and save as PDF. Is there any way to achieve what I want?

share|improve this question
    
Triple your terminal font size, take your screenshot and then revert to normal. Done. –  jasonwryan Oct 18 '12 at 16:52
    
I would be tempted to re-pose this question stating that you need to be able to copy rich-text information from your terminal for pasting into a presentation, rather than as a screen grab at all since you want to scale the fonts after the fact. –  mikebabcock Oct 18 '12 at 20:45

4 Answers 4

up vote 2 down vote accepted

I would try writing the syntax-highlighted code as an HTML file, using the Vim Syntax->Convert to HTML menu option. Then open the HTML in a browser and print to a PDF file. You can of course edit the HTML if you want to show just a section of the code, or use pdfcrop to isolate the region of interest.

share|improve this answer
    
Yes, this works out perfectly and achieves exactly what I wanted to achieve. Thanks for your help. To add to this, the background color of my terminal wasn't correct in the html file, so I used 'Gcolor2' to pick the color '#320E28' and then changed the 'bgcolor' attribute in the html file. It looks great now. –  rks171 Oct 18 '12 at 17:22
    
Another option is to use :hardcopy > file.ps to export highlighted code to PostScript and then ps2pdf file.ps to get PDF file. It's possible to select exported region, e.g. :1,10hardcopy > file.ps . –  Andrey Nov 15 at 6:50

Whatever you're using to take the screenshot is betraying you. Use a different software package for it (I prefer scrot on Linux), or use the OS-builtin screenshot keys.

share|improve this answer
    
I use Ubuntu. I was using the built-in screen shot utility (hit PrtScreen key). I tried 'scrot' and it does allow more options; however, if I write to PNG with quality of 100, the picture will still only have, at most, the resolution of my monitor. Please, correct me if I'm wrong. –  rks171 Oct 18 '12 at 15:15
    
aecolley: png images are raster graphics, which means they have a fixed resolution (as rks171 says, at most the screen resolution). If you blow that up by a factor of 10 on a screen it may look grainy. PDF files are scaled vector graphics (SVG), which means they their pixel x pixel size increases when scaled. –  goldilocks Oct 18 '12 at 15:21
    
PDFs aren't SVGs. SVG is strict XML; PDF is not. SVG's can be embedded in a PDF though, but so can pngs, jpegs, and even some video formats... –  Alex Leach Oct 18 '12 at 16:47
    
@rks171 You are correct. From your question, I thought you were getting much less than normal screen resolution. –  aecolley Oct 19 '12 at 13:57

I've done this exact same thing in the past. Fortunately, the resolution of my monitor is higher than that of the projector I was using (1920x1200 vs ~1200x800), so a screen shot of Konsole worked well for me..

If the resolution of the projector is higher than your monitor though, you could increase the font size of vim / the terminal, before taking the screen shot. Then you won't have too few pixels, but too many. Scaling down is easier than scaling up.

You also didn't mention what Desktop Environment you are using, but in KDE, when I press Print Screen, I have an option of saving an image of the active application window (see screen print of the screen print window, below). I was hoping that even if an application window goes off the edges of the display, the whole application window could be saved, but that doesn't seem to be the case. (Btw, in Windows - I know, wrong website - you can press Alt+Print Screen to take a screen shot of the application window, if say, you're using vim over PuTTy).

Screenshot of oversized application window

share|improve this answer

You don't want a screenshot, you want a text grab. Highlight the text in the window and paste it into your presentation using a fixed-width terminal font and it will scale perfectly for you. If you have strange ascii art characters in the original software display, you'll want to perfectly match fonts so the codes work out.

Untested: this may work for you: https://www.dokuwiki.org/plugin:xtermrtf

share|improve this answer
2  
Yes, but how do I preserve the syntax highlighting? I have done something similar to this in the past, but then I had to manually go in and change the font colors using commands in Latex. –  rks171 Oct 18 '12 at 15:50
    
What you want is a terminal program that will relay colour and other secondary details when copying and pasting, much like proper copy & paste of HTML. Unfortunately I'm not aware of any terminal that exposes rich detail like colour when copying. A quick test of xterm, gnome-terminal and Eterm failed. –  mikebabcock Oct 18 '12 at 20:41
    
Updated my answer with a possible solution link. –  mikebabcock Oct 18 '12 at 20: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.