Need to convert .f90 file to pdf

  • Thread starter Thread starter Taylor_1989
  • Start date Start date
  • Tags Tags
    Convert File Pdf
Click For Summary
SUMMARY

This discussion focuses on converting .f90 and .txt files into a single PDF document. Key methods include using MacOS Preview for combining files, employing Jedit's print-to-PDF feature, and utilizing LaTeX for preserving syntax highlighting. Users on Ubuntu can leverage Vim to copy code with syntax highlighting into LibreOffice Writer, or alternatively, paste into a .doc file and save as PDF. The conversation highlights various tools and techniques that ensure the integrity of formatting during the conversion process.

PREREQUISITES
  • Familiarity with .f90 and .txt file formats
  • Basic understanding of LaTeX for document preparation
  • Experience with text editors like Vim and Jedit
  • Knowledge of PDF creation methods on MacOS and Ubuntu
NEXT STEPS
  • Learn how to use LaTeX for formatting and converting code files to PDF
  • Explore the print-to-PDF functionality in various text editors and IDEs
  • Investigate additional Fortran pretty printers that support PDF generation
  • Research advanced features of Vim for code manipulation and export
USEFUL FOR

Software developers, particularly those working with Fortran, and anyone needing to convert code files into well-formatted PDF documents while preserving syntax highlighting.

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   Reactions: 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   Reactions: aphirst

Similar threads

  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 2 ·
Replies
2
Views
3K
Replies
1
Views
2K
Replies
35
Views
6K
  • · Replies 41 ·
2
Replies
41
Views
5K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 29 ·
Replies
29
Views
3K
Replies
3
Views
3K
  • · Replies 34 ·
2
Replies
34
Views
4K
  • · Replies 7 ·
Replies
7
Views
2K