Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: Stuart R on September 08, 2013, 01:46:17 pm

Title: Printing code from c::b produces a weird misaligned mess
Post by: Stuart R on September 08, 2013, 01:46:17 pm
I seem to be getting some strange results when I try to print from c::b. Different parts of the text seem to be misaligned in different ways depending on how c::b is classifying it (punctuation, keywords etc). However, this doesn't seem to be a common problem so I suspect my own system.  Sadly, I don't understand enough about c::b and printing to know where to start. I'm using c::b 12.11 on Ubuntu 13.04 - I attach an image of the output.  Any help would be appreciated.
Thanks
Stu R

[attachment deleted by admin]
Title: Re: Printing code from c::b produces a weird misaligned mess
Post by: Alpha on September 08, 2013, 05:15:41 pm
I am not exactly sure what your problem is, but you could try changing fonts (Settings->Editor).  If this issue only shows up when you print directly from Code::Blocks, you could try exporting as a PDF, and printing that.
Title: Re: Printing code from c::b produces a weird misaligned mess
Post by: Stuart R on September 08, 2013, 07:35:58 pm
Thanks Alpha, changing the font didn't change anything (other than the font of course!).  The output remains just like the jpg in the attached file. I can print directly and easily from gedit etc but would have found it easier to print from within c::b. I'm not sure whether it's related, but how do I export to PDF - I would have expected an Export under File but don't have that option.

Title: Re: Printing code from c::b produces a weird misaligned mess
Post by: oBFusCATed on September 08, 2013, 10:03:03 pm
Select a pdf printer, you should have it by default.

Does printing from Scite works correctly?
Title: Re: Printing code from c::b produces a weird misaligned mess
Post by: Stuart R on September 08, 2013, 10:18:50 pm
Now that seems to be helping. I installed Scite, loaded the same file and tried to print and got:

>a2ps "Game.cpp"
sh: 1: a2ps: not found
>Exit code: 127

Also - I don't seem to have a pdf printer (sceenshot attached).

While this obviously suggests that I need a2ps, do you know whether this indicates that a wider set of utilities is missing? Apologies if this is straying from c::b.
Title: Re: Printing code from c::b produces a weird misaligned mess
Post by: Alpha on September 08, 2013, 10:55:25 pm
I'm not sure whether it's related, but how do I export to PDF - I would have expected an Export under File but don't have that option.
Although not related to your original problem, the Source Exporter plugin (http://wiki.codeblocks.org/index.php?title=Source_Exporter_plugin) (from the contrib plugins package) provides that menu entry.
Title: Re: Printing code from c::b produces a weird misaligned mess
Post by: oBFusCATed on September 08, 2013, 11:57:53 pm
Another option is installing pdf printer: http://jonmifsud.com/blog/print-to-pdf-with-ubuntu-linux/
Title: Re: Printing code from c::b produces a weird misaligned mess
Post by: Stuart R on September 09, 2013, 12:07:43 am
Thanks oBFusCATed and Alpha.  I've installed the codeblocks-contrib package which allows me to export the code in pdf (with no mangling). I also installed a2ps - Scite now works. I also installed the pdf printer from the link which will come in handy in the future but the output is just as mangled as before. I now have a reasonable work-around at least.
Title: Re: Printing code from c::b produces a weird misaligned mess
Post by: oBFusCATed on September 09, 2013, 12:14:51 am
Another test you can do is to compile wxGTK-2.8 manually, go to the stc sample and try to print with it.