Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » RichText,QTF,RTF... » Report Perform() and printing
Re: Report Perform() and printing [message #55174 is a reply to message #55173] Thu, 15 October 2020 18:07 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14258
Registered: November 2005
Ultimate Member
I think I have found it. Looks like over those years, lpoptions output changed a bit while we were not watching.

Can you test this fix please?

Size PrinterJob::GetDefaultPageSize(String *name)
{
	Size sz(6000 * 210 / 254, 6000 * 297 / 254);

	Vector<String> dpp = Split(System("lpoptions -l"), '\n');

	for (int i = 0; i < dpp.GetCount(); i++){
		int pos = max(dpp[i].FindAfter("Page Size"), dpp[i].FindAfter("PageSize"));
		if (pos >= 0){
			pos = dpp[i].Find('*', pos);
			//return A4 if there is not default page size
			if (pos < 0) return sz;
			//skip '*'
			pos++;
			int len = dpp[i].Find(' ', pos);
			if (len < 0) len = dpp[i].GetLength();
			len -= pos;
			//page name
			String nm = dpp[i].Mid(pos, len);
			if(name)
				*name = nm;
			const PageSizeName *p = FindPageSize(nm);
			if(p) {
				sz = p->GetDots();
				return sz;
			}
		}
	}
	//return A4 if there is not default page size
	return sz;
}


(It is on the trunk / git too, but I think your U++ journey have not got you there yet Smile
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Documentation / more info
Next Topic: Speller routine
Goto Forum:
  


Current Time: Wed May 14 02:22:00 CEST 2025

Total time taken to generate the page: 0.03367 seconds