Results 1 to 3 of 3

Thread: How to convert a source code text file to jpg with syntax highlight using bash?

Hybrid View

  1. #1
    Join Date
    Jan 2012
    Beans
    33

    How to convert a source code text file to jpg with syntax highlight using bash?

    I need to create images of the first page of some source code text files, like asp or php or js files for example.
    I usually go on through this doing something as

    Code:
    enscript --no-header --pages=1 "${input_file}" -o - | ps2pdf - "${temp_pdf_file}"
    convert -quality 100 -density 150x150 -append "${temp_pdf_file}"[0] "${output_file}"
    trash "${temp_pdf_file}"
    This works nice for my needs, but it obviously outputs an image "as is" with no "eye-candy" features. I was wondering if there's a way to add syntax highlighting too. This might come handy to speed up the creation of presentations of developed works for example

  2. #2
    Join Date
    Nov 2010
    Location
    India
    Beans
    4,827
    Distro
    Ubuntu Development Release

    Re: How to convert a source code text file to jpg with syntax highlight using bash?

    Raja

    రాజ శేఖర్ రెడ్డి

  3. #3
    Join Date
    Jan 2012
    Beans
    33

    Re: How to convert a source code text file to jpg with syntax highlight using bash?

    Hello, thank you very much for your tip.
    It's a very interesting link.

    In the meanwhile I solved my problem using Pygments,
    as suggested
    here.

    However your link is full of information about this issue.
    Very appreciated, thanks again.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •