[WinPrnDev] Re: Duplicate Print jobs

  • From: Christoph Lindemann <christoph@xxxxxxxxxxxx>
  • To: "winprndev@xxxxxxxxxxxxx" <winprndev@xxxxxxxxxxxxx>
  • Date: Tue, 1 Oct 2013 22:35:19 +0200

The print processor EMF/SPL functions can only be used in the context of a 
print processor.
You could of course implement a new print processor, and use that with the 
printer instead of winprint. But some drivers depend on features of their own 
custom print processors.

As Alex described, copy the SPL file and then parse it yourself.
Then replay the EMF page by page on a device context of the second printer.

You need to take into account any devmode changes and the EMF bounds to setup 
the DC for the target printer. Orientation could for example change during job.

Also make sure to install the embedded fonts and subset fonts. Do not print 
different jobs concurrently from different threads. Or else your fonts can get 
wrong, when different fonts with same name are loaded at the same time. The 
font table is process wide, and the last loaded font with a particular name 
will be used for all threads. So you need to serialize that (alternatively 
rewrite the fonts and font references in EMF with unique names. This is a lot 
of work)

/christoph

On 01/10/2013, at 21.11, Alex Egorov <alex@xxxxxxxxxxxxxx> wrote:

> No, in my software I wait using FindFirstPrinterChangeNotification, set print 
> job to pause, make copy of the print job to file, resume print job and parse 
> file. I don't know more useful method, no know - file system level filter 
> driver, but can't write drivers.
> 
> 
> On Tue, Oct 1, 2013 at 10:02 PM, Octavian Rinciog 
> <octavian.rinciog@xxxxxxxxx> wrote:
> Thanks, but I was asking if there is some API that does this, because
> as I understand, the info is already there. (Maybe some calls of
> PrintDocumentOnPrintProcessor).
> 
> 2013/10/1 Alex Egorov <alex@xxxxxxxxxxxxxx>:
> > http://www.undocprint.org/formats/winspool/emf
> >
> >
> > On Tue, Oct 1, 2013 at 8:10 PM, Octavian Rinciog
> > <octavian.rinciog@xxxxxxxxx> wrote:
> >>
> >> Thank you Alex for your advice.
> >> I'm wondering you  know how to extract the EMF records from the SPL
> >> file and save them in a file.
> >>
> >>
> >>
> >> 2013/10/1 Alex Egorov <alex@xxxxxxxxxxxxxx>:
> >> > With different drivers this is impossible,
> >> > If source printer have print jobs with NT EMF format than
> >> > this is possible but with some advanced work with print job content.
> >> > You should manually extract EMF content and send it to another printer,
> >> > but EMF content can be readed without any second printer.
> >> >
> >> >
> >> > On Tue, Oct 1, 2013 at 4:27 PM, Octavian Rinciog
> >> > <octavian.rinciog@xxxxxxxxx> wrote:
> >> >>
> >> >> 2013/10/1 Alex Egorov <alex@xxxxxxxxxxxxxx>:
> >> >> > How do you get print job handle?
> >> >>
> >> >> The source print job handle is obtained using the following calls:
> >> >>
> >> >>     _stprintf_s(jobStr, _T("%s,Job %i"), szPrinterName, iIndex);
> >> >>     if (!OpenPrinter(jobStr, &hPrinterJob, NULL))
> >> >>     {
> >> >>         return FALSE;
> >> >>     }
> >> >>
> >> >>
> >> >> > How big your bufsize? (Can't be more than 64k)
> >> >> My bufsize is 1024B. The spl file is copied very good (The two files
> >> >> has the same dimension and hash).
> >> >>
> >> >> Anyway, I'm not sure that copying the spl file is the proper way to
> >> >> implement my task, because in the general case the two printers have a
> >> >> different driver.
> >> >>
> >> >>
> >> >> --
> >> >> Octavian Rinciog
> >> >>
> >> >> ---
> >> >> Questions? First check the UndocPrint pages at
> >> >> http://www.undocprint.org/winspool
> >> >>
> >> >> To unsubscribe, visit the List Server page at
> >> >> //www.freelists.org/list/winprndev
> >> >
> >> >
> >> >
> >> >
> >> > --
> >> > Alex Egorov
> >> > http://usefulsoft.com
> >>
> >>
> >>
> >> --
> >> Octavian Rinciog
> >> ---
> >> Questions? First check the UndocPrint pages at
> >> http://www.undocprint.org/winspool
> >>
> >> To unsubscribe, visit the List Server page at
> >> //www.freelists.org/list/winprndev
> >
> >
> >
> >
> > --
> > Alex Egorov
> > http://usefulsoft.com
> 
> 
> 
> --
> Octavian Rinciog
> ---
> Questions? First check the UndocPrint pages at 
> http://www.undocprint.org/winspool
> 
> To unsubscribe, visit the List Server page at 
> //www.freelists.org/list/winprndev
> 
> 
> 
> -- 
> Alex Egorov
> http://usefulsoft.com

Other related posts: