17

My professor wants to get the code of my Library Management project not only as .java files but also as a one PDF file. Is there any way to do that in Intellij? I have a lot of classes, and I would like to avoid having to click and print every one of them separately.

Is there any workaround? I am using Mac OS. If I select the folder where the code is, the print button shows greyed out.

2 Answers 2

16
  1. Select the directory that contains all of your source code. If your code is scattered around different directories you will have to either print it in batches or drop all the files you want to print into one temporary folder and select it.
  2. Click File -> Print.
  3. In the menu that pops up select All files in directory option. This help page explains all the options in this menu. Click Print.
  4. To save all the code as PDF instead of your physical printer select a virtual PDF printer. Windows 10 has "Microsoft Print to PDF" installed by default. If you don't have one, you can pick one for your OS on this Wikipedia page
4
  • I am using Mac OS. If I select the folder where the code is, the print button shows greyed out. I can click on it.
    – DavidVV
    Commented Aug 31, 2016 at 19:14
  • @DavidVV Do you have a printer? Maybe it's greyed out because there are no printers on your system. If that's the case installing a PDF printer for Mac like this one will help.
    – 0x60
    Commented Aug 31, 2016 at 19:20
  • @DavidVV what if you simply select the Print option for a single file and then then chose All files in directory... & Include subdirectories?
    – Morfic
    Commented Aug 31, 2016 at 19:50
  • 2
    On Mac as of IntelliJ IDEA CE 2020.1.1, "Open in Preview" doesn't work but "Save as PDF" does.
    – solidsnack
    Commented May 27, 2020 at 21:01
2

Set up a fictional printer on your mac.

  1. Go to printers and scanners in system preferences.

  2. Add a new printer.

  3. Click the globe(network) icon.

  4. Address: 0.0.0.0

    Protocol: Airprint

    Use: Select Software -> Epson 24-pin series, or whatever you feel like choosing

  5. Add. Continue to add although warnings are displayed.

Now, you can "save to pdf" from IntelliJ Idea—no more weird errors.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.