9

I need to submit my code to a competition in a .pdf file. It would be nice and much easier to read if the syntax was highlighted as in the actual studio. I don't really feel like highlighting it by myself, line after line, so is there a way to export Delphi source code in .rtf?

Thanks

Martin Melka
  • 7,177
  • 16
  • 79
  • 138
  • 3
    My [Rejbrand Text Editor](http://english.rejbrand.se/rteditor) can create an HTML document with highlighted Delphi code. Of course, in any program that can print highlighted code, you can always use a virtual printer capable of creating a PDF. – Andreas Rejbrand Oct 11 '11 at 07:02
  • 2
    You could use Notepad++ for example or any other text editor that can highlight code. – David Heffernan Oct 11 '11 at 07:28

6 Answers6

15

Two free IDE enhancements have the functionality that you are looking for (I think):

Nicholas Ring
  • 1,016
  • 7
  • 14
5

There's also John Kaster's YAPP (yet another pretty-printer), as web service or standalone executable.

Ondrej Kelle
  • 36,941
  • 2
  • 65
  • 128
4

GExperts contain the Source Export expert. It is integrated into the Delphi IDE: Screenshot

Uli Gerhardt
  • 13,748
  • 1
  • 45
  • 83
1

GVim has an "export to HTML" function - can't do line numbers and background colors, though, so dark themes should be avoided as they will not look as you expect. You can then open the file in your web browser and from there print it to PDF.

bluish
  • 26,356
  • 27
  • 122
  • 180
Thriveth
  • 377
  • 1
  • 6
  • 18
0

CnWizards may broke non-Latin characters.

At least in XE2 sources with russian characters were broken, when exporting to RTF. They were also broken in default HTML/UTF8 export.

And since i used some characters (Greek letters) beyond English+Russian, they were borken even with non-default HTML/windows-1251 export

Also CnWizards can not export DFM which are also part of the project.

External tools like SynEdit, SynPlus or YAPP are nice, but cannot convert all the project at once, cannot reuse IDE customized colouring, and potentially would lack behind most recent syntax changes in most recent Delphi releases.

Arioch 'The
  • 15,799
  • 35
  • 62
0

One possible way to save DFM is printing from IDE into freeware PDF printer or into Microsoft XPS printer, available in Windows 7.

The latter creates page too large that cannot be fit into printed page. This where STDU Viewer comes to help - it allows File | Advanced Printing | Fit into printer's margins mode to print them on any computer the file copied too.

Arioch 'The
  • 15,799
  • 35
  • 62