Print several pages

Just starting out? Need help? Post your questions and find answers here.
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Print several pages

Post by Polo »

How do you achieve that? Just do StartPrinting for each pages? I never used the Printer lib before.
Also, is there some kind of print preview available (cross platform)? Just need to check before I start writing my own :)
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Print several pages

Post by IdeasVacuum »

Take a look at Printer_Lib: http://www.purebasicpower.de/?PrinterLib
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: Print several pages

Post by Polo »

Thanks but it doesn't look cross platform as the code is not provided ;)
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Print several pages

Post by IdeasVacuum »

...it's Windows only. Of course cross-platform should be do-able, the printers are the same but much depends on what API is provided on the other platforms. It might be worth having a 3-platform solution rather than a cross-platform.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Slyvnr
User
User
Posts: 58
Joined: Wed Jun 27, 2007 10:10 pm
Location: USA
Contact:

Re: Print several pages

Post by Slyvnr »

I use the Printer_Lib for an envelope printing program I wrote. It works well and has a print preview ability.

Printing in Purebasic (and for that matter, most languages) really sucks. Printing under DOS was so easy and straight forward (even graphics were easy) now almost all of your printing is going to have to go through APIs for whatever OS your running, otherwise you will need to write your own assembly Print library based for each processor you want to be able to use. Easier to just use the APIs for the OS.

Slyvnr
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: Print several pages

Post by Polo »

Slyvnr wrote:Printing in Purebasic (and for that matter, most languages) really sucks.
Why so? What does PB's lib lacks?
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Print several pages

Post by IdeasVacuum »

...just take a look at Printer_Lib and you will see the difference :)
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Slyvnr
User
User
Posts: 58
Joined: Wed Jun 27, 2007 10:10 pm
Location: USA
Contact:

Re: Print several pages

Post by Slyvnr »

Please don't take me the wrong way. PureBasic is great. Printing in PureBasic is possible, but it is one of the weaker aspects of using PureBasic. I spend more time on "printing"-layout problems and making "pretty" reports which sell software, then typically the software it self. ( CEOs, CFOs, Human Resource Managers, they all want nice pretty reports on paper either for compliance reasons or because so many of them are still tactile in nature).

The PurePDF lib and the Printer_Lib really do fill in a printing gap in PureBasic and are perfect for Windows only programs. But with PureBasic being touted and presented as a cross-platform language there really should be standardized Printer Library and Functions built-in for quick and easy printing layout. What is that PureBasic has...8 Printer based functions to Open it, start it, stop it, etc. And then everything for layout is the cumbersome 2d Drawing commands?

My background goes way back to Mainframe and DOS days and printing nice reports was usually really simple and very little hassle. Given, there typically was a "report writer" type function in most of the languages where you did the layout with variables and the system would either use that as a template or "generate code" for your printing routines.

PureBasic and most Windows based languages (VB, C++, etc) do not have any such function (although I think VB and Visual Foxpro did have something that made layouts easier, cant remember been toolong since I even tried em). Today's languages are compilers pure and simple and the creators thought process is that any "tools" that are needed should be made by the programmers. Yep, re-create the wheel everytime or make your own include libraries, so to speak. Not too many good RADs or 4G languages out there anymore. Yes, there is Crystal Reports, R&R ReportWriter and other third-party data-centric report writers now to fill the gap. But for the majority of what I do, these solutions are way too expensive for my end users.

Sure I should take it upon myself to write a "report writer" for PureBasic, but I am too busy doing other things that need to be done to make money now. Plus, I am not a "tool writer" so to speak. There are those in this community that are great at that and eventually, one of them may get around to doing it.

Slyvnr
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Print several pages

Post by IdeasVacuum »

Sure I should take it upon myself to write a "report writer" for PureBasic, but I am too busy doing other things that need to be done to make money now. Plus, I am not a "tool writer" so to speak. There are those in this community that are great at that and eventually, one of them may get around to doing it.
I think sRod may have achieved that for Windows with his Arctic Reports. However, his website is currently down: http://www.arctic-reports.com/

You are right about how useful the PurePdf lib is too, it is brilliant: http://www.purebasicpower.de/?PurePDF
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: Print several pages

Post by Polo »

Well, how do I print several pages with PB's internal function?
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Print several pages

Post by IdeasVacuum »

By using the NewPrinterPage() function. Code snippet in PB Help:

Code: Select all

If PrintRequester()
    If StartPrinting("Two sheets")
      If StartDrawing(PrinterOutput())
        DrawingMode(#PB_2DDrawing_Transparent)
        DrawText(10, 10, "First page !", RGB(0, 0, 0))
      
        ; ---> Tell the printer to start a new page <----
        NewPrinterPage()
        
        DrawText(10, 10, "Second page !", RGB(0, 0, 0))
      
        StopDrawing()
      EndIf
      
      StopPrinting()
    EndIf
  EndIf
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: Print several pages

Post by Polo »

Cheers mate, cant believe I overlooked that! :)
Post Reply