May 06, 2024, 09:42:49 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Update 02-01-2012 (Partial)

Started by LarryMc, February 01, 2012, 08:30:25 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

LarryMc

Made a major breakthrough(for me) tonight.
Previously I had finished all of the code for the GUI for previewing and selecting all the options in the preview dialog.

Had been struggling with getting the preview window contents to faithful reproduce on the printer itself. 
I've learned more than I ever wanted to know about the OS printdlg dialog, the PRINTDLG structure, the DEVMODE structure, and printer DEVICE CONTEXT and the associated window to printer scaling.

But finally preview window/print connection is WYSIWYG.

The final activities to be addressed are
1)printing multiple pages (both consectively and using multiple ranges.)
2) collating multiple copies of the above
3) printing first to last  or last to first with respect to #1 and #2.

I really don't think it is going to take me very long to get it coded.
Just will use a lot of paper and ink in testing(but I will set up test files that will have a lot of blank space in them to reduce ink useage.

I'll be glad to get back to what I call "regular" programming on the new IDE.

LarryMc
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Barney

February 02, 2012, 05:02:05 AM #1 Last Edit: February 02, 2012, 05:05:11 AM by Barney
In order to conserve the paper and printer usage, I'd suggest you use one of the programs that intercept the print request and allow you to do a lot without actually printing anything.

The one I am using is Fineprint.

I have been using it for years together with their other product pdfFactory(pro) and have been very pleased with their behaviour. There are also other programs with similar functionality now so search the web and save yourself a lot of unnecessary printing.

Barney

LarryMc

LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

billhsln

I always use Bullzip PDF Printer (saves from any program to PDF's, even allows you to append).  Very useful program, since I have people I need to send stuff to that do not have PC's they have Mac's.  Everyone can read PDF's.

Bill
When all else fails, get a bigger hammer.

LarryMc

As it turns out, the way I structered the module it was real esy to do my testing by printing page #s to a console window instead of actually printing pages(because the actual page printing works and is only 3 lines of code I need to bypass while testing.

So far this morning I've finished the structure for printing front to back, back to front, single copies, multiple copies, collating and non collating and verified all the possible combinations of them.


The next to last piece of code is to process the edit control that allows users to enter page numbers and or ranges of page numbers to print.
Like in a 20 page source file the user can enter something like this: 1-3,5,11,13-15,17-
which would print pages 1,2,3,5,11,13,14,15,17,18,19,20

The last piece will be a progress dialog with a cancel button.

LarryMc
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

billhsln

Would it be possible to use any of this in other ways?  Like to print a RichEdit screen with page breaks and formatting?

Bill
When all else fails, get a bigger hammer.

LarryMc

this version is not a standalone module.
it is integrated with the rest of the IDE.
it also uses specific features of the Scintilla control for formatting page output; such as the font and coloring along with figuring out how much text will fit in the box I give it.  Scintilla also takes care of the wordwrapping.

What I'm really doing for the zoom and printing is writing to a hidden window that is the size of a sheet of paper.
for the visual zoom window I just copying the hidden window to the zoom window using StretchBlt API.

For printing I'm taking a bitmap of the hidden window and scaling it to fit the printer.

To print a rich edit would require calculating the size of the window area that text is to fit in like I do.
Then you'd have to read each line of the rich edit and size the text to see if it would fit on the line.
If not then you'd have to break the line and print the left over on the nect line IF that didn't exceed the available space.
The writing would be to a Device Contect (either a window or the printer.)

And right this second I don't know exactly how you'd handle colors.
Page breaks (which I can't do with the way Scintilla works) with an edit control would simply be a matter of adding something like '<<PAGEBREAKwhere you want a new page and test for that string when you read each line from the edit control.


When I get through with the IDE I'll put it on my list to look into making the print preview into an addon of some sort.

Also, a lot depends on what your definition of "formating" includes.

LarryMc

BTW, downloaded Bullzip PDF Printer (since it was free) and my output using it as the selected printer gives me exactly what i expected.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library