Need to convert .f90 file to pdf

In summary: It works less well on Windows. On Windows you might have to look for a different editor to get the colors.In summary, the conversation discusses various methods for converting .f90 and .txt files, along with output files, into a single PDF while preserving syntax highlighting. Suggestions include using a scanner, using Preview or other software on MacOS, using a Fortran-specific program or LaTeX, or using a text editor that supports preserving syntax highlighting when printing to PDF.
  • #1
Taylor_1989
402
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
  • #2
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.
 
  • #3
Import, or paste, them all into your word processor, then save the file as PDF.
 
  • Like
Likes jedishrfu
  • #4
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.
 
  • #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 into libre?
 
  • #6
try the vim approach. You'll have to copy your program in screen blocks though, I think to libre editor.
 
  • #7
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.
 
  • #8
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.
 
  • #9
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

1. How can I convert a .f90 file to a pdf?

There are several ways to convert a .f90 file to a pdf. One option is to use a text editor or coding software that has a built-in feature to save files as pdf. Another option is to use a file conversion website or software to convert the .f90 file to a pdf. Lastly, you can also print the .f90 file as a pdf using a virtual printer.

2. What is the benefit of converting a .f90 file to a pdf?

Converting a .f90 file to a pdf allows for easy sharing and viewing of the file on different devices. It also helps to preserve the formatting and layout of the file, making it easier to read and understand.

3. Are there any specific programs or software needed to convert a .f90 file to a pdf?

No, there are various programs and software available that can help convert a .f90 file to a pdf. Some examples include Microsoft Word, Adobe Acrobat, and online file conversion tools.

4. Can I convert multiple .f90 files to a single pdf?

Yes, you can convert multiple .f90 files to a single pdf by using a file merging tool or by selecting and printing multiple files as a pdf. This can be useful when compiling a collection of related code files or when submitting a project or report.

5. Is it possible to convert a .f90 file to a pdf without altering the code?

Yes, converting a .f90 file to a pdf should not alter the code in any way. However, it is always recommended to double-check the converted pdf to ensure the code is still accurate and readable.

Similar threads

  • Programming and Computer Science
Replies
2
Views
379
Replies
1
Views
1K
  • Programming and Computer Science
Replies
21
Views
539
  • Programming and Computer Science
2
Replies
41
Views
3K
  • Programming and Computer Science
Replies
3
Views
392
  • Programming and Computer Science
Replies
29
Views
2K
  • Programming and Computer Science
Replies
1
Views
542
  • Programming and Computer Science
Replies
12
Views
7K
  • Programming and Computer Science
Replies
7
Views
2K
  • Programming and Computer Science
Replies
2
Views
635
Back
Top