Treppenmeister
asked on
Delphi problems to abort a printjob
With several printers I have problems to abort a print job and start another one.
(my main problem printer is a Konica Minolta Bizhub C364e, driver version 5.1.3)
The job will be aborted but the next one won't be printed.
The first job will be aborted (with abort). But the remaining jobs not - they also won't be printed. They appear in the list of printing jobs but seem to have all a size of 0.
How can I avoid something like that?
I am afraid that this is a driver problem - but there are no newer printer drivers available.
It is a network printer. If I print into a file then job1 and job2 are 0 byte and job 3 1.6 MB. So printing into a file seems to work (same printer)
WIndows 7, 64 bit
Edit:
This seems to be only a problem when I use the printer spooler (which is default setting in windows). If I print directly to the printer all works fine.
Is there a way to find out that something isn't working well (within of the application which is printing)?
(my main problem printer is a Konica Minolta Bizhub C364e, driver version 5.1.3)
The job will be aborted but the next one won't be printed.
printer.title := 'job 1';
printer.begindoc;
printer.abort;
printer.title := 'job 2';
printer.begindoc;
printer.abort;
printer.title := 'job 3';
printer.begindoc;
... print some data ...
printer.enddoc
The first job will be aborted (with abort). But the remaining jobs not - they also won't be printed. They appear in the list of printing jobs but seem to have all a size of 0.
How can I avoid something like that?
I am afraid that this is a driver problem - but there are no newer printer drivers available.
It is a network printer. If I print into a file then job1 and job2 are 0 byte and job 3 1.6 MB. So printing into a file seems to work (same printer)
WIndows 7, 64 bit
Edit:
This seems to be only a problem when I use the printer spooler (which is default setting in windows). If I print directly to the printer all works fine.
Is there a way to find out that something isn't working well (within of the application which is printing)?
ASKER
I need the handle of the printer to calculate the output. I have a mix of text and technical drawings. The text is reducing the available rect for the drawing and I have to know at which scale I can print on a given paper size.
DrawText wants the handle. And I can access printer.handle only after I start begindoc, After calculating I abort. I don't print anything at that time.
Or do you have a better idea how to use DrawText?
In the meanwhile I found out that I have only problems with the Konica Minolta PCL6 driver. The postscript driver behaves well.
DrawText wants the handle. And I can access printer.handle only after I start begindoc, After calculating I abort. I don't print anything at that time.
Or do you have a better idea how to use DrawText?
In the meanwhile I found out that I have only problems with the Konica Minolta PCL6 driver. The postscript driver behaves well.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks, I will try to use the tMetaFile for calculation.
I always thought that the canvas was limited. Similar to the size of the paper of the printer which I cannot set to values above 2^15 (1/10 mm). So a print job larger than 3.27 m I cannot generate (set).
So I never tried it since the outputs can be larger that 3.27 m
So for calculation I have to set only width, height and the dpi for width and height. Or do I miss something?
I always thought that the canvas was limited. Similar to the size of the paper of the printer which I cannot set to values above 2^15 (1/10 mm). So a print job larger than 3.27 m I cannot generate (set).
So I never tried it since the outputs can be larger that 3.27 m
So for calculation I have to set only width, height and the dpi for width and height. Or do I miss something?
for drawing on tmetafile canvas width/height is the only thing you need. Dpi is for resizing metafile (act as image) to printer canvas.
Some more links to study...
http://www.delphiforfun.or g/programs /delphi_te chniques/P rintPrevie w.htm
http://docwiki.embarcadero .com/CodeE xamples/Be rlin/en/TM etafileCre ate_(Delph i)
https://www.experts-exchan ge.com/que stions/205 75400/Prev iewing-pri nting-and- scaling-me tafiles.ht ml
Some more links to study...
http://www.delphiforfun.or
http://docwiki.embarcadero
https://www.experts-exchan
ASKER
It seems to work. But I have to set the dpi before assigning the font. Otherwise font size does not fit.
So dpi is important
Are there any windows printer with different dpi in x and y?
I know that there can be differences when I have to print directly on old dot matrix printer (via Esc sequences). But doing so I ignore windows printer driver.
So dpi is important
MyMetaFilecanvas.Font.PixelsPerInch := GetDeviceCaps( Printer.Handle , LogPixelsX );
MyMetaFilecanvas.Font.Assign( MyFont );
Are there any windows printer with different dpi in x and y?
I know that there can be differences when I have to print directly on old dot matrix printer (via Esc sequences). But doing so I ignore windows printer driver.
ASKER
Using the tMetaFile solved my original problem.
I think that dpi for x and y is a same ...
ASKER
Implementing everything in my code worked well. By doing so I realised that I used tMetafile already for my preview window. But not for the pre-calculation of the scale. So everything is fine now.
And thanks again!
And thanks again!
Regular way is to do begindoc + enddoc.
Open in new window
you call abort only on error. if you don't want to print - do not send to print ....