Author Topic: Printing code from c::b produces a weird misaligned mess  (Read 11538 times)

Offline Stuart R

  • Single posting newcomer
  • *
  • Posts: 5
Printing code from c::b produces a weird misaligned mess
« 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]

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Printing code from c::b produces a weird misaligned mess
« Reply #1 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.

Offline Stuart R

  • Single posting newcomer
  • *
  • Posts: 5
Re: Printing code from c::b produces a weird misaligned mess
« Reply #2 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.


Online oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12126
    • Travis build status
Re: Printing code from c::b produces a weird misaligned mess
« Reply #3 on: September 08, 2013, 10:03:03 pm »
Select a pdf printer, you should have it by default.

Does printing from Scite works correctly?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Stuart R

  • Single posting newcomer
  • *
  • Posts: 5
Re: Printing code from c::b produces a weird misaligned mess
« Reply #4 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.

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Printing code from c::b produces a weird misaligned mess
« Reply #5 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 (from the contrib plugins package) provides that menu entry.

Online oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12126
    • Travis build status
Re: Printing code from c::b produces a weird misaligned mess
« Reply #6 on: September 08, 2013, 11:57:53 pm »
Another option is installing pdf printer: http://jonmifsud.com/blog/print-to-pdf-with-ubuntu-linux/
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Stuart R

  • Single posting newcomer
  • *
  • Posts: 5
Re: Printing code from c::b produces a weird misaligned mess
« Reply #7 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.

Online oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12126
    • Travis build status
Re: Printing code from c::b produces a weird misaligned mess
« Reply #8 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.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]