Author Topic: Printing is garbled  (Read 2703 times)

Offline Steven Friedrich

  • Single posting newcomer
  • *
  • Posts: 7
Printing is garbled
« on: February 23, 2022, 01:09:32 am »
I am running:
Name             : Code::Blocks
Version          : 20.03-r11997
SDK Version      : 2.0.0
Scintilla Version: 3.7.5
Author           : The Code::Blocks Team
E-mail           : info@codeblocks.org
Website          : http://www.codeblocks.org

wxWidgets Library (wxGTK port)
Version 3.0.5 (Unicode: wchar_t, debug level: 1),
compiled at Feb 13 2022 17:28:47

Runtime version of toolkit used is 3.24.
Compile-time GTK+ version is 3.24.31.
on:  KDE Neon 5.24
My printer has been working on my Linux system forever.  I can print the C code from other editors.
I'm trying to print from Code::Blocks File menu item Print.
All the text is squashed to the left.

Is there a Code::Blocks bug database somewhere?

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1208
Re: Printing is garbled
« Reply #1 on: February 23, 2022, 09:08:22 am »
The bug tracker is here

Offline AndrewCot

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 678
Re: Printing is garbled
« Reply #2 on: February 23, 2022, 10:11:52 am »
Please check the nightly to see if it has been fixed since the 20.03 release as allot of changes have been done since the 20.03 release. Also there are some reports in 2017 for printing issue, which you may want to have a look at to see if they can possibly help, but they may not.

There is one ticket related to printing. It's url is:
https://sourceforge.net/p/codeblocks/tickets/48/
Also if you do create a ticket can you please include the following info as it will help C::B dev who looks at the ticket to setup the printing environment as close to your setup as possible o see if they can reproduce the problem:
  • Linux distro installed?
  • Distro version installed?
  • Kernel version installed?
  • How you have setup the printing sub syste?
  • Which printer driver you are using?
  • Anything else you think may be relevant for Linux and printing
I have not setup printing in Linux, so some of the point above may not be right.


Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3263
Re: Printing is garbled
« Reply #3 on: February 23, 2022, 03:53:46 pm »

During working on ticket 48 i found a  printing bug on GTK where some text gets mangled at a top corner.
I work on it, but until now i was not able to debug it to an extend where i know what is going on...

But i think the bug you have is some other kind....

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1208
Re: Printing is garbled
« Reply #4 on: February 23, 2022, 04:57:53 pm »
I have just tried printing on the CutePDF printer. Instead of asking for the output filename, C::B blocks forever showing a busy animation as mouse pointer.

Code
Name                    : Code::Blocks
Version                 : svn-r12723
SDK Version             : 2.16.0
Scintilla Version       : 3.7.5
OS                      : Windows 7 (build 7601, Service Pack 1), 64-bit edition

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1208
Re: Printing is garbled
« Reply #5 on: February 23, 2022, 07:19:15 pm »
The problem is in cbEditorPrintout::GetPageInfo(), virtual printers are returning a 0 page size in line 99, so m_printRect is invalid and the program enters this loop forever:
Code
        while (HasPage(*maxPage))
        {
            //Manager::Get()->GetLogManager()->DebugLog(_T("CountPages: PageCount %d , m_printed %d"), m_pPageSelStart->GetCount(), m_printed);
            m_printed = m_TextControl->FormatRange (0, m_printed, m_SelEnd,
                                             dc, dc, m_printRect, m_pageRect);
            m_pPageSelStart->Add(m_printed);
            *maxPage += 1;
        }

EDIT: today the CutePDF printer works, but MS XPS printer still fails. MSW10 built-in PDF printer also works OK.
« Last Edit: February 24, 2022, 12:42:20 pm by Miguel Gimenez »

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1208
Re: Printing is garbled
« Reply #6 on: February 24, 2022, 12:58:03 pm »
@Steven Friedrich:
  - Are you using HiDPI (more than 96 pixels per inch)?
  - Can you attach an scan or photo of the printed page?

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3263
Re: Printing is garbled
« Reply #7 on: February 24, 2022, 03:28:38 pm »
Is the problem with the page size present in  my patch? I think i have reworked this.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1208
Re: Printing is garbled
« Reply #8 on: February 24, 2022, 04:17:18 pm »
I have not tested your patch, the problem is with current trunk. I will take a look at your patch.

When using XPS printer, ppd->GetPaperId() (at cbeditorprintout.cpp:99) returns wxPAPER_NONE and the page size is (0, 0).

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1208
Re: Printing is garbled
« Reply #9 on: February 24, 2022, 07:38:37 pm »
Printing on Mint 18 is a mess, using default values with the built-in Print to File driver you get the attached PDF.

Offline AndrewCot

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 678
Re: Printing is garbled
« Reply #10 on: February 25, 2022, 03:58:21 am »
In suggest creating a ticket to track this bug(s).

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1208
Re: Printing is garbled
« Reply #11 on: February 25, 2022, 12:07:57 pm »
Ticket 1214