Save source code with formatting (syntax highlight)
Asked Answered
G

6

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

Gregggreggory answered 11/10, 2011 at 6:58 Comment(2)
My Rejbrand Text Editor 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.Pygidium
You could use Notepad++ for example or any other text editor that can highlight code.Megaphone
G
15

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

Goodrow answered 11/10, 2011 at 7:12 Comment(1)
i'd move CnPack to the top position :)Supersede
M
5

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

Metallophone answered 11/10, 2011 at 10:22 Comment(0)
M
4

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

More answered 11/10, 2011 at 7:7 Comment(0)
S
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.

Sadoc answered 23/11, 2012 at 16:43 Comment(0)
I
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.

Interceptor answered 28/11, 2011 at 10:57 Comment(0)
I
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.

Interceptor answered 28/11, 2011 at 11:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.