News for hackers. Stuff that matters.
Re:Show HN: Generate high-res images of code samples with Ch... by minighost on Monday September 11, 2017 @06:41PM (#15223110)
Vim can do this

1. Open your script/code in vim editor

2. Enable syntax & set the required color scheme

:syntax on :colorscheme darkblue

3. Print the file in PS file format

:hardcopy >/tmp/filename.ps

4. Convert the PS file to PDF format

$ ps2pdf /tmp/filename.ps

5. Now you can open filename.pdf

Re:Show HN: Generate high-res images of code samples with Ch... by sabarasaba on Tuesday September 12, 2017 @03:01AM (#15225351)
You can also do :TOhtml, then open the html file with your browser and print to pdf. A bit simpler imo.
Re:Show HN: Generate high-res images of code samples with Ch... by sus_007 on Tuesday September 12, 2017 @02:17AM (#15225171)
Or convert the ".ps" file into ".jpeg" instead ?

4. Using ghostscript: gs -sDEVICE=jpeg -dJPEGQ=100 -dNOPAUSE -dBATCH -dSAFER -r300 -sOutputFile=filename.jpg filename.ps

Re:Show HN: Generate high-res images of code samples with Ch... by adamors on Monday September 11, 2017 @09:05PM (#15223953)
On a Mac you can use pstopdf (or just open the PS file in Preview).