Need to convert .f90 file to pdf

  • Thread starter Thread starter Taylor_1989
  • Start date Start date
  • Tags Tags
    Convert File Pdf
AI Thread Summary
The discussion centers around converting .f90 and .txt files, along with output files, into a single PDF. Users suggest various methods, including using MacOS Preview to combine files, printing to PDF from text editors like Jedit, and copying content into word processors such as MS Word or LibreOffice. For those using Ubuntu, options include pasting code into LibreOffice or using Vim, which can preserve syntax highlighting during the copy-paste process. LaTeX is also mentioned as a viable solution for maintaining formatting and syntax highlighting, alongside specific Fortran tools. Overall, the conversation emphasizes the importance of preserving formatting while consolidating files into a PDF format.
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?
 
Technology 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.
 
Import, or paste, them all into your word processor, then save the file as PDF.
 
  • Like
Likes jedishrfu
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?
 
try the vim approach. You'll have to copy your program in screen blocks though, I think to libre editor.
 
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 aphirst
Back
Top