Choosing a printer and init printing...
-
Hello, I need to choose a printer and init printing a document(saved on my disk), whithout a print dialog. How can I do this? []'s
Hope I understood your question
LPPRINTER_INFO_2 m_pPrinters; LPDEVMODE m_lpdevmode; ... ... HDC hdc=CreateDC(m_pPrinters->pDriverName, (LPCTSTR)m_lpdevmode->dmDeviceName,m_pPrinters->pPortName,m_lpdevmode);
_**
**_
whitesky
-
Hope I understood your question
LPPRINTER_INFO_2 m_pPrinters; LPDEVMODE m_lpdevmode; ... ... HDC hdc=CreateDC(m_pPrinters->pDriverName, (LPCTSTR)m_lpdevmode->dmDeviceName,m_pPrinters->pPortName,m_lpdevmode);
_**
**_
whitesky
-
Thanks for your help. I have a printer device and a file name on hard disc. How can start a print job passing these parameters (printer and file name)? []'s
sorry i dont understand,you have a printer ok and you have a file in your disc now you want to print this file,yes?_**
**_
whitesky
-
sorry i dont understand,you have a printer ok and you have a file in your disc now you want to print this file,yes?_**
**_
whitesky
-
when you have a hdc from printer(CreateDC)then you can read from your file in the loop and use
StartPage
andStartDoc
useTextOut
orDrawText
for write to printer and the endEndPage
andEndDoc
(you need to check if your file is > from a page) I hope its helpful for you_**
**_
whitesky
-
when you have a hdc from printer(CreateDC)then you can read from your file in the loop and use
StartPage
andStartDoc
useTextOut
orDrawText
for write to printer and the endEndPage
andEndDoc
(you need to check if your file is > from a page) I hope its helpful for you_**
**_
whitesky
-
But my file can be any format, not only text file. I need to print a image too. Any other idea? []'s
if you need to print a image you can draw image to dc from printer you can open your file(Image) and use from handle printer for print it.(if you have a hdc you ability to print image or text its not only for printer i think that windows programming is work with handles) I hope its helpful to you
_**
**_
whitesky
-
if you need to print a image you can draw image to dc from printer you can open your file(Image) and use from handle printer for print it.(if you have a hdc you ability to print image or text its not only for printer i think that windows programming is work with handles) I hope its helpful to you
_**
**_
whitesky
But this file can be a .DOC file, with image included and formatted texts (bold, italic,...), then I need to build a app that the user select any file and OK. The app should send the file to a postscript printer for convert to .PS format. Can I do this, only with my app?
-
if you need to print a image you can draw image to dc from printer you can open your file(Image) and use from handle printer for print it.(if you have a hdc you ability to print image or text its not only for printer i think that windows programming is work with handles) I hope its helpful to you
_**
**_
whitesky
-
It's not possible. An app cannot print a document from disc directly to printer. I should do this with the app that can read the document. :-( Thanks for your atention. []'s
When you have each file (psd,3d,pdf,txt,...)first you need to read file for example a jpg file you can use from a class CImage or GDI+ or you can read directly after read you want to print (for example you need to print a psd file(photoshop) you cant use from a function for read you and print you need to a structure for read this file and convert it to a for example hbtimap(you can see a example from read psd files in codeproject) and then you can print this file.now you want to print doc file its like this you need to read this file and convert a foramt for print A app cannot to print a file from disc directly its right you need to read to file and above
_**
**_
WhiteSky
-
When you have each file (psd,3d,pdf,txt,...)first you need to read file for example a jpg file you can use from a class CImage or GDI+ or you can read directly after read you want to print (for example you need to print a psd file(photoshop) you cant use from a function for read you and print you need to a structure for read this file and convert it to a for example hbtimap(you can see a example from read psd files in codeproject) and then you can print this file.now you want to print doc file its like this you need to read this file and convert a foramt for print A app cannot to print a file from disc directly its right you need to read to file and above
_**
**_
WhiteSky
-
I suggest if you search in internet you can find activexes for your purpose
_**
**_
WhiteSky
-
I suggest if you search in internet you can find activexes for your purpose
_**
**_
WhiteSky