Printer Control
-
He is using XP SP1. That does not has the XPS driver and installing it requires probably a higher SP version. But using a PDF driver as already suggested by you should do the trick.
-
You are right. I missed that.
-
You are right. I missed that.
-
Well, I Got it to Produce the XPS File without Complaining. However, The XPS Reader complains it Cannot Read the XPS File. Both in Win7 and Win 10. The Text I propose to Print is as Follows:- It Renders in NotePad as:
Finding Old Orders in the Shop
Printed by on 01 09 16 - 23:40:14
Customer:-
TONY LOUGHLINIf The Item(s) are Found you should
Update the Computer Record, and
Destroy this Page!
Otherwise Inform Management of the
Discrepancies, by Returning this Page
Marked Up Accordingly!Order Nr 214058
Received on: 27/07/12 - 13:18:21
Not Confirmed Present since Completion
Qty Description Amount
1 lb Wash +Dry £11.00
========
Total For Order £11.00
Due for This Order £11.00Packaging:- -1Wb
========================================
Actually Found:-
Hangers Pastics Flatpacks WashBags
+---+ +---+ +---+ +---+
| | | | | | | |
| | | | | | | |
| | | | | | | |
+---+ +---+ +---+ +---+========================================
The XPS File I got was,in Binary. There is nothing wrong with the way I present My Data, Somehow the Printer will not Digest it. I Need to get to the bottom of this, and everybodies help is much appreciated. If Needed, will show the Code! Regards, :) :) :)
Bram van Kampen
-
Well, I Got it to Produce the XPS File without Complaining. However, The XPS Reader complains it Cannot Read the XPS File. Both in Win7 and Win 10. The Text I propose to Print is as Follows:- It Renders in NotePad as:
Finding Old Orders in the Shop
Printed by on 01 09 16 - 23:40:14
Customer:-
TONY LOUGHLINIf The Item(s) are Found you should
Update the Computer Record, and
Destroy this Page!
Otherwise Inform Management of the
Discrepancies, by Returning this Page
Marked Up Accordingly!Order Nr 214058
Received on: 27/07/12 - 13:18:21
Not Confirmed Present since Completion
Qty Description Amount
1 lb Wash +Dry £11.00
========
Total For Order £11.00
Due for This Order £11.00Packaging:- -1Wb
========================================
Actually Found:-
Hangers Pastics Flatpacks WashBags
+---+ +---+ +---+ +---+
| | | | | | | |
| | | | | | | |
| | | | | | | |
+---+ +---+ +---+ +---+========================================
The XPS File I got was,in Binary. There is nothing wrong with the way I present My Data, Somehow the Printer will not Digest it. I Need to get to the bottom of this, and everybodies help is much appreciated. If Needed, will show the Code! Regards, :) :) :)
Bram van Kampen
Bram van Kampen wrote:
The XPS File I got was,in Binary.
As you would expect, since it also includes formatting information about the content. I have used this to test printing in my applications, and never had a problem. I guess you need to look at your actual printing code.
-
Bram van Kampen wrote:
The XPS File I got was,in Binary.
As you would expect, since it also includes formatting information about the content. I have used this to test printing in my applications, and never had a problem. I guess you need to look at your actual printing code.
Well, The Binary I get refuses to open. Here is my Printing Code:-
///////////////////////////////////////////////////////////////////////////////////
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
// PRINTING!!
///////////////////////////////////////////////////////////////////////////////////// OnClick the Print Button
void CConfirmOrdersStep1Dlg::OnPrint()
{
if(CreateViewForPrinting()==false){
AfxMessageBox("No Orders have been Marked for Printing");
return;
}
CDC dc;
CPrintDialog printDlg(FALSE);if (printDlg.DoModal() == IDCANCEL) // Get printer settings from user return; dc.Attach(printDlg.GetPrinterDC()); // Get and attach a printer DC dc.m\_bPrinting = TRUE; CString strTitle="Old Orders"; // Get the application title //strTitle.LoadString(AFX\_IDS\_APP\_TITLE);
// strTitle.Format("Date:Confirming Old Orders By:- %s-%s", UserName,Date);
DOCINFO di; // Initialise print document details memset(&di, 0,sizeof (DOCINFO)); di.cbSize = sizeof (DOCINFO); di.lpszDocName = strTitle; BOOL bPrintingOK = dc.StartDoc(&di); // Begin a new print job // Get the printing extents and store in the m\_rectDraw field of a // CPrintInfo object CPrintInfo Info; Info.m\_rectDraw.SetRect(0,0, dc.GetDeviceCaps(HORZRES), dc.GetDeviceCaps(VERTRES)); OnBeginPrinting(&dc, &Info); // Call your "Init printing" function // Now, Print every Page! UINT page; for (page=Info.GetMinPage(); page <= Info.GetMaxPage() && bPrintingOK;page++){ dc.StartPage(); // begin new page Info.m\_nCurPage = page; PrintPage(&dc, &Info); // Call your "Print page" function bPrintingOK = (dc.EndPage() > 0); // end page } OnEndPrinting(&dc, &Info); // Call your "Clean up" function if (bPrintingOK) dc.EndDoc(); // end a print job else dc.AbortDoc(); // abort job. dc.DeleteDC(); // delete the printer DC
}
// As from Chris Mauder.
// Instead of Global I made it a member
//
// m_pView (Type COrderPageView) contains a list of PageFragments
// Th -
Well, The Binary I get refuses to open. Here is my Printing Code:-
///////////////////////////////////////////////////////////////////////////////////
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
// PRINTING!!
///////////////////////////////////////////////////////////////////////////////////// OnClick the Print Button
void CConfirmOrdersStep1Dlg::OnPrint()
{
if(CreateViewForPrinting()==false){
AfxMessageBox("No Orders have been Marked for Printing");
return;
}
CDC dc;
CPrintDialog printDlg(FALSE);if (printDlg.DoModal() == IDCANCEL) // Get printer settings from user return; dc.Attach(printDlg.GetPrinterDC()); // Get and attach a printer DC dc.m\_bPrinting = TRUE; CString strTitle="Old Orders"; // Get the application title //strTitle.LoadString(AFX\_IDS\_APP\_TITLE);
// strTitle.Format("Date:Confirming Old Orders By:- %s-%s", UserName,Date);
DOCINFO di; // Initialise print document details memset(&di, 0,sizeof (DOCINFO)); di.cbSize = sizeof (DOCINFO); di.lpszDocName = strTitle; BOOL bPrintingOK = dc.StartDoc(&di); // Begin a new print job // Get the printing extents and store in the m\_rectDraw field of a // CPrintInfo object CPrintInfo Info; Info.m\_rectDraw.SetRect(0,0, dc.GetDeviceCaps(HORZRES), dc.GetDeviceCaps(VERTRES)); OnBeginPrinting(&dc, &Info); // Call your "Init printing" function // Now, Print every Page! UINT page; for (page=Info.GetMinPage(); page <= Info.GetMaxPage() && bPrintingOK;page++){ dc.StartPage(); // begin new page Info.m\_nCurPage = page; PrintPage(&dc, &Info); // Call your "Print page" function bPrintingOK = (dc.EndPage() > 0); // end page } OnEndPrinting(&dc, &Info); // Call your "Clean up" function if (bPrintingOK) dc.EndDoc(); // end a print job else dc.AbortDoc(); // abort job. dc.DeleteDC(); // delete the printer DC
}
// As from Chris Mauder.
// Instead of Global I made it a member
//
// m_pView (Type COrderPageView) contains a list of PageFragments
// ThWell I just Notice, I forgot to Select the Font into the Printer Device Context. That would of course have an impact! Can anyone spot other errors? :)
Bram van Kampen
-
Well, The Binary I get refuses to open. Here is my Printing Code:-
///////////////////////////////////////////////////////////////////////////////////
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
// PRINTING!!
///////////////////////////////////////////////////////////////////////////////////// OnClick the Print Button
void CConfirmOrdersStep1Dlg::OnPrint()
{
if(CreateViewForPrinting()==false){
AfxMessageBox("No Orders have been Marked for Printing");
return;
}
CDC dc;
CPrintDialog printDlg(FALSE);if (printDlg.DoModal() == IDCANCEL) // Get printer settings from user return; dc.Attach(printDlg.GetPrinterDC()); // Get and attach a printer DC dc.m\_bPrinting = TRUE; CString strTitle="Old Orders"; // Get the application title //strTitle.LoadString(AFX\_IDS\_APP\_TITLE);
// strTitle.Format("Date:Confirming Old Orders By:- %s-%s", UserName,Date);
DOCINFO di; // Initialise print document details memset(&di, 0,sizeof (DOCINFO)); di.cbSize = sizeof (DOCINFO); di.lpszDocName = strTitle; BOOL bPrintingOK = dc.StartDoc(&di); // Begin a new print job // Get the printing extents and store in the m\_rectDraw field of a // CPrintInfo object CPrintInfo Info; Info.m\_rectDraw.SetRect(0,0, dc.GetDeviceCaps(HORZRES), dc.GetDeviceCaps(VERTRES)); OnBeginPrinting(&dc, &Info); // Call your "Init printing" function // Now, Print every Page! UINT page; for (page=Info.GetMinPage(); page <= Info.GetMaxPage() && bPrintingOK;page++){ dc.StartPage(); // begin new page Info.m\_nCurPage = page; PrintPage(&dc, &Info); // Call your "Print page" function bPrintingOK = (dc.EndPage() > 0); // end page } OnEndPrinting(&dc, &Info); // Call your "Clean up" function if (bPrintingOK) dc.EndDoc(); // end a print job else dc.AbortDoc(); // abort job. dc.DeleteDC(); // delete the printer DC
}
// As from Chris Mauder.
// Instead of Global I made it a member
//
// m_pView (Type COrderPageView) contains a list of PageFragments
// ThBram van Kampen wrote:
The Binary I get refuses to open.
Not sure what that means, or what is missing. If you do not select the font into the DC then it will just use a default, so you should still see some output. Given that this is Chris's original code, you may want to try talking to him.
-
Well, The Binary I get refuses to open. Here is my Printing Code:-
///////////////////////////////////////////////////////////////////////////////////
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
// PRINTING!!
///////////////////////////////////////////////////////////////////////////////////// OnClick the Print Button
void CConfirmOrdersStep1Dlg::OnPrint()
{
if(CreateViewForPrinting()==false){
AfxMessageBox("No Orders have been Marked for Printing");
return;
}
CDC dc;
CPrintDialog printDlg(FALSE);if (printDlg.DoModal() == IDCANCEL) // Get printer settings from user return; dc.Attach(printDlg.GetPrinterDC()); // Get and attach a printer DC dc.m\_bPrinting = TRUE; CString strTitle="Old Orders"; // Get the application title //strTitle.LoadString(AFX\_IDS\_APP\_TITLE);
// strTitle.Format("Date:Confirming Old Orders By:- %s-%s", UserName,Date);
DOCINFO di; // Initialise print document details memset(&di, 0,sizeof (DOCINFO)); di.cbSize = sizeof (DOCINFO); di.lpszDocName = strTitle; BOOL bPrintingOK = dc.StartDoc(&di); // Begin a new print job // Get the printing extents and store in the m\_rectDraw field of a // CPrintInfo object CPrintInfo Info; Info.m\_rectDraw.SetRect(0,0, dc.GetDeviceCaps(HORZRES), dc.GetDeviceCaps(VERTRES)); OnBeginPrinting(&dc, &Info); // Call your "Init printing" function // Now, Print every Page! UINT page; for (page=Info.GetMinPage(); page <= Info.GetMaxPage() && bPrintingOK;page++){ dc.StartPage(); // begin new page Info.m\_nCurPage = page; PrintPage(&dc, &Info); // Call your "Print page" function bPrintingOK = (dc.EndPage() > 0); // end page } OnEndPrinting(&dc, &Info); // Call your "Clean up" function if (bPrintingOK) dc.EndDoc(); // end a print job else dc.AbortDoc(); // abort job. dc.DeleteDC(); // delete the printer DC
}
// As from Chris Mauder.
// Instead of Global I made it a member
//
// m_pView (Type COrderPageView) contains a list of PageFragments
// Th -
Bram van Kampen wrote:
The Binary I get refuses to open.
Not sure what that means, or what is missing. If you do not select the font into the DC then it will just use a default, so you should still see some output. Given that this is Chris's original code, you may want to try talking to him.
Wel, I get a Binary File not recognised by the XPS Reader. I can open it as Binary in a HexVieuwer, and get nothing recognisable.
Bram van Kampen
-
Wel, I get a Binary File not recognised by the XPS Reader. I can open it as Binary in a HexVieuwer, and get nothing recognisable.
Bram van Kampen
When I look at an XPS print file it looks something like:
PK µC'I Metadata/Job_PT.xmlíW]s¢H}ߪý)Þ' &Ùh%NÝ4ZÁØ }Cè`|
´¢óë÷¶ã̬‰™™§éòš{Îážþ¸póqGgK–6ÿþë&+žƒœ'bÈý9gKŠöÞ*3!²†ªþŒÅ^qs?O‹ôIœûi¬–< Ò²P«šVSµk5“H¾=Øbžr/fešÏ•íªà{Ú²,ÏËÚyš‡’£¢>š÷öõ'…🽠‚·QÊA²ÏÀ¤Ð°žÈ•ŠŸÿJdÎÖ˜FP¨{è*which is fine, and the XPS reader opens it OK. As to why you cannot read yours is a total mystery. If you are using all the standard APIs (or their MFC equivalents) to create your print files, then they should at least be readable. Try changing the extension from
.xps
to.zip
and have a look at the content then. -
When I look at an XPS print file it looks something like:
PK µC'I Metadata/Job_PT.xmlíW]s¢H}ߪý)Þ' &Ùh%NÝ4ZÁØ }Cè`|
´¢óë÷¶ã̬‰™™§éòš{Îážþ¸póqGgK–6ÿþë&+žƒœ'bÈý9gKŠöÞ*3!²†ªþŒÅ^qs?O‹ôIœûi¬–< Ò²P«šVSµk5“H¾=Øbžr/fešÏ•íªà{Ú²,ÏËÚyš‡’£¢>š÷öõ'…🽠‚·QÊA²ÏÀ¤Ð°žÈ•ŠŸÿJdÎÖ˜FP¨{è*which is fine, and the XPS reader opens it OK. As to why you cannot read yours is a total mystery. If you are using all the standard APIs (or their MFC equivalents) to create your print files, then they should at least be readable. Try changing the extension from
.xps
to.zip
and have a look at the content then.Hi, Richard, Well, if it opens in your machine , there is evidently something wrong with my reader, and nothing wrong with the code I wrote to generate same. I'm away on a break for a few days. I had my 62nd Birthday 3 weeks ago, but, were unable to escape. We are trying enjoy life in semi retirement, with a small important money spinning business running in the background, powered by my software. I appreciate your comment, and will try changing the XPS ext to ZIP when I'm back. I Think that you know that I write software for Laundrettes and Dry-Cleaners, specifically for our own chain. There are No Trade or Other secrets buried in the Text Example I Sent. It is a Fictitious Customer with a Fictitious ancient Order. (The Bane of a laundrette is people not coming back to pay and collect, It Clogs up the shop, the work is done, but, the Till does not ring. ) The Program I am writing now, is a concerted attempt to attack this, by contacting customers. The First step there is, to ensure that ancient Orders that appear on the database, are still present in the shop. Whereas we Trust our staff, an order could have been given out, without the order being rang in, the staff pocketing the sale, and the Item remaining on the Database. At any rate, we do not want to contact customers over long forgotten items, when we no longer poses them, for whatever reason. It also gives staff an other activity at quiet Times. Instead of drinking cups of tea, they have a Screen of alternative, and More Productive activity. Making Phone Calls, and finding People's goods. If people's goods can not be found, then there is no point in ringing the customer. Let sleeping dogs lie, and Management writes the item off. We tried it manually, and got things like "Oh I forgot about that, I will collect it next Saturday" Saturday came and went, we all forgot, order still here. This new program will pursue only say 10 old orders at the time, but these orders will be pursued vigorously. Items Promised to be Collected By a date, will disappear of the ToDo List, but, will re-appear there after that date, if at that stage not collected and paid. The Interface is being designed so that Junior Staff can handle it, kicking major decisions back upstairs. The Document I tried to print was a form, for staff to go around the shop, and find the goods. The First Step. When you Opened the XPS File, could you read the Text as Follows:-
Finding Old Orders in the Shop
Printed by on 01 09 16 -
-
Hi, Richard, Well, if it opens in your machine , there is evidently something wrong with my reader, and nothing wrong with the code I wrote to generate same. I'm away on a break for a few days. I had my 62nd Birthday 3 weeks ago, but, were unable to escape. We are trying enjoy life in semi retirement, with a small important money spinning business running in the background, powered by my software. I appreciate your comment, and will try changing the XPS ext to ZIP when I'm back. I Think that you know that I write software for Laundrettes and Dry-Cleaners, specifically for our own chain. There are No Trade or Other secrets buried in the Text Example I Sent. It is a Fictitious Customer with a Fictitious ancient Order. (The Bane of a laundrette is people not coming back to pay and collect, It Clogs up the shop, the work is done, but, the Till does not ring. ) The Program I am writing now, is a concerted attempt to attack this, by contacting customers. The First step there is, to ensure that ancient Orders that appear on the database, are still present in the shop. Whereas we Trust our staff, an order could have been given out, without the order being rang in, the staff pocketing the sale, and the Item remaining on the Database. At any rate, we do not want to contact customers over long forgotten items, when we no longer poses them, for whatever reason. It also gives staff an other activity at quiet Times. Instead of drinking cups of tea, they have a Screen of alternative, and More Productive activity. Making Phone Calls, and finding People's goods. If people's goods can not be found, then there is no point in ringing the customer. Let sleeping dogs lie, and Management writes the item off. We tried it manually, and got things like "Oh I forgot about that, I will collect it next Saturday" Saturday came and went, we all forgot, order still here. This new program will pursue only say 10 old orders at the time, but these orders will be pursued vigorously. Items Promised to be Collected By a date, will disappear of the ToDo List, but, will re-appear there after that date, if at that stage not collected and paid. The Interface is being designed so that Junior Staff can handle it, kicking major decisions back upstairs. The Document I tried to print was a form, for staff to go around the shop, and find the goods. The First Step. When you Opened the XPS File, could you read the Text as Follows:-
Finding Old Orders in the Shop
Printed by on 01 09 16 -
Hi Bram, well I'm a few years older than you, so in theory I should have more knowledge locked in my brain. But you know what they say about theory and practice. When I said I could open the XPS file, I meant one that I generated here. If you can send me the one you generate I could have a look at it for you. Send me a private email and I can give you an address, or put it up on one of the public staging sites.