Need to convert .f90 file to pdf

  • Thread starter Thread starter Taylor_1989
  • Start date Start date
  • Tags Tags
    Convert File Pdf
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
8 replies · 5K views
Taylor_1989
Messages
400
Reaction score
14
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?
 
Physics news on Phys.org
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.
 
anorlunda said:
Import, or paste, them all into your word processor, then save the file as PDF.
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.
 
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 into libre?
 
Taylor_1989 said:
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?
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.
 
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.
 
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.
 
  • Like
Likes   Reactions: aphirst