Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Need to convert .f90 file to pdf

  1. Jan 27, 2017 #1
    Hi guys, I am currently having a problem in converting, my .f90 and .txt and output files into a single pdf. Dose anyone have any ideas?
     
  2. jcsd
  3. Jan 27, 2017 #2

    jedishrfu

    Staff: Mentor

    What OS? What have you tried?

    One trick is to print them and use a scanner to PDF. On MacOS you can use Preview to combine them or reorder pages as needed.

    There may also be fortran pretty printers that generate PDF.

    If you use Jedit you can use it to print your file and in the print dialog select to PDF.
     
  4. Jan 27, 2017 #3

    anorlunda

    User Avatar
    Science Advisor
    Gold Member

    Import, or paste, them all into your word processor, then save the file as PDF.
     
  5. Jan 27, 2017 #4

    jedishrfu

    Staff: Mentor

    You might lose the color hilighting in that case.

    I've opened my files in vim and then copied and pasted into MS Word on MacOS and it preserved the colors. However, if I used an application like Netbeans it didn't.
     
  6. Jan 27, 2017 #5
    I am currently using ubuntu, I did think of pasting the code into lI really and doing the pdf. Is there any useful app for ubuntu that can do it or shall I just copy in to libre?
     
  7. Jan 27, 2017 #6

    jedishrfu

    Staff: Mentor

    try the vim approach. You'll have to copy your program in screen blocks though, I think to libre editor.
     
  8. Jan 27, 2017 #7

    Mark44

    Staff: Mentor

    This seems pretty simple to me. The .f90 and .txt files are text files. Presumably your output files are text as well. If the output appears on the console, you can redirect the output to a text file.

    Copy and paste all files to a .doc file (in Word or equivalent) and save as .pdf. Done.
     
  9. Mar 8, 2017 #8

    aphirst

    User Avatar
    Gold Member

    Hi @Taylor_1989

    There are a few options which should let you preserve the syntax highlighting without having to resort to screenshots. For example, this stackexchange entry demonstrates how to use LaTeX for this. Mentioned in the discussion are another program ostensibly useful just for Fortran, along with the fact that there are several LaTeX packages with the same or similar goals.

    Another thing you could do is use the Print to PDF functionality of a text editor or IDE which also happens to support preserving the syntax highlighting in the printed output. This is less flexible than the LaTeX approach (i.e. does not lend itself well to future inclusion in other documents), but might be useful for your purposes.
     
  10. Mar 8, 2017 #9

    jedishrfu

    Staff: Mentor

    I didn't say screen shots, I mentioned screen blocks when using vim ie mark and copy the first X lines and then paste into your document then scroll down and repeat until you've got what you wanted.

    Vim is one of the few editors that will include the syntax highlighting in its paste to a word processor. It works well on MacOS and on Linux.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Need to convert .f90 file to pdf
  1. HDF files for f90/95 (Replies: 1)

  2. PDF files (Replies: 3)

Loading...