How do you get print job handle? How big your bufsize? (Can't be more than 64k) On Tue, Oct 1, 2013 at 3:26 PM, Octavian Rinciog <octavian.rinciog@xxxxxxxxx > wrote: > Thank you Alex for your quick answer. > > Indeed, my source print job is paused, because this is how I can > intercept and copy the spl file. > > Actually convert to pdf is not a such big job. It can be done very > easy with redmon+ghostscript. > > This is way I want to duplicate the print jobs (one copy should be > transmitted to the real printer and the other copy should be > transmitted to the virtual printer which converts to pdf and sends the > document to some server). > > > > > 2013/10/1 Alex Egorov <alex@xxxxxxxxxxxxxx>: > > First of all - your source print job should be paused, > > Try your code on the printer with the pause state. > > Possible situation - that source print jobs already > > was sent to printer from queue and you try it to read. > > > > Converting to pdf this is additional big job > > > > > > On Tue, Oct 1, 2013 at 2:28 PM, Octavian Rinciog > > <octavian.rinciog@xxxxxxxxx> wrote: > >> > >> I'm trying to duplicate print jobs (it means when someone prints a > >> document, this document is printed automatically also on another > >> printer). The purpose is that I want to transform all printed > >> documents into pdf and send them to a server. > >> > >> I was able to retrieve all print jobs using > >> `FindFirstPrinterChangeNotification` and I was able to retrieve job > >> content using `ReadPrinter`. > >> > >> The job is in EMF form. > >> > >> But when I want to write this job to another printer, using > >> `WritePrinter`, the job seems to get to the printer, in the status > >> window of the new printer is written `Printed`, but it doesn't happen > >> anything. The job doesn't arrive to the printer. > >> > >> The code that duplicates the job is: > >> > >> > >> do{ > >> if (!ReadPrinter(hPrinterJob, lpBytes, BUFSIZE, &dwBytesRead)) > >> { > >> return FALSE; > >> } > >> > >> else > >> { > >> if (!WritePrinter(hPrinterNew, lpBytes, dwBytesRead, > >> &dwBytesWritten)) > >> { > >> return FALSE; > >> } > >> } > >> }while(dwBytesRead!=0); > >> > >> Does anyone know what it's wrong and how to fix? > >> > >> An example of software that does something like this is: [link][1] > >> > >> > >> Thank you > >> > >> P.S I know this is not a printer driver problem, but maybe you have an > >> idea how to fix this. > >> > >> [1]: http://www.colorpilot.com/emfprinterpilot.html > >> > >> -- > >> 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