Print to a file

My program has some methods that print to a printer OK. But I need to put 
labels on
those files afterwards so it would be better to print them to a file first.

The program calls GetPrinterDC() before starting the printing.

Is there some update that will permit the user to print to a file?

Thanks,
E-Jo 


0
ejoline (61)
5/26/2005 12:08:38 AM
vc.mfc 33608 articles. 0 followers. Follow

6 Replies
348 Views

Similar Articles

[PageSpeed] 19

Hello E-Jo,
Glad to see you. 
Generally speaking, if you want to save and add the information in current 
dc to a file, you can create a dc from a bmp and blt all informaiton from 
the src dc to the bmp.  
I notice you would like to put labels on a file after it is printed. I am 
afraid I can't understand what you are trying to do there. Could you let me 
know what "thoes files" are? Is it a .doc file or something else? Why can't 
you add the labels before the print?  

Thanks,
Rhett Gong [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp
&SD=msdn 

This posting is provided "AS IS" with no warranties and confers no rights.

0
v-raygon (10)
5/26/2005 2:52:11 AM
Yes, hello again Rhett,
Not sure how one creates a dc from a bmp. Can you elaborate?

These are diagrams drawn by my app. I may want to use them
 later in a report but at the time they are drawn I don't really
know the figure number, exact title etc.

Also, it would be nice to have the diagrams as computer files
as opposed to hard copy if I want to email them to someone.
Thanks,
E-Jo

"Rhett Gong [MSFT]" <v-raygon@online.microsoft.com> wrote in message 
news:l2uc13ZYFHA.3928@TK2MSFTNGXA01.phx.gbl...
> Hello E-Jo,
> Glad to see you.
> Generally speaking, if you want to save and add the information in current
> dc to a file, you can create a dc from a bmp and blt all informaiton from
> the src dc to the bmp.
> I notice you would like to put labels on a file after it is printed. I am
> afraid I can't understand what you are trying to do there. Could you let 
> me
> know what "thoes files" are? Is it a .doc file or something else? Why 
> can't
> you add the labels before the print?
>
> Thanks,
> Rhett Gong [MSFT]
> Microsoft Online Partner Support
> Get Secure! - www.microsoft.com/security
> http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp
> &SD=msdn
>
> This posting is provided "AS IS" with no warranties and confers no rights.
> 


0
ejoline (61)
5/26/2005 12:38:20 PM
>Not sure how one creates a dc from a bmp. Can you elaborate?
we can use GDI+ Graphics::FromImage Method.  In code, we can create an 
Image object first and later save the image to a file after the drawing is 
completed.
Since it is your application who draws the dc, you can also save the dc to 
a stream of a stg object as you like by using following function:  
Status Image::Save(          IStream *stream,
    const CLSID *clsidEncoder,
    const EncoderParameters *encoderParams
);
More details on GDI+ Image Class can be found at:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdicpp/GDIP
lus/GDIPlusReference/Classes/Image.asp  


Thanks,
Rhett Gong [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp
&SD=msdn 

This posting is provided "AS IS" with no warranties and confers no rights.

0
v-raygon (10)
5/27/2005 7:00:24 AM
Thanks, Gary, for putting me on to GDI+.
I'll have to admit that I hadn't heard about it before.
But after doing some research, starting with the MS site that you mentioned,
it does sound good but it looks like a lot of work getting up-to-speed on 
GDI+
and rewriting my app to use it. Is there a way that I can shortcut the 
process
and write to a BMP without doing all the conversion?

Thanks,
E-Jo

"Rhett Gong [MSFT]" <v-raygon@online.microsoft.com> wrote in message 
news:U14lHnoYFHA.3928@TK2MSFTNGXA01.phx.gbl...
> >Not sure how one creates a dc from a bmp. Can you elaborate?
> we can use GDI+ Graphics::FromImage Method.  In code, we can create an
> Image object first and later save the image to a file after the drawing is
> completed.
> Since it is your application who draws the dc, you can also save the dc to
> a stream of a stg object as you like by using following function:
> Status Image::Save(          IStream *stream,
>    const CLSID *clsidEncoder,
>    const EncoderParameters *encoderParams
> );
> More details on GDI+ Image Class can be found at:
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdicpp/GDIP
> lus/GDIPlusReference/Classes/Image.asp
>
>
> Thanks,
> Rhett Gong [MSFT]
> Microsoft Online Partner Support
> Get Secure! - www.microsoft.com/security
> http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp
> &SD=msdn
>
> This posting is provided "AS IS" with no warranties and confers no rights.
> 


0
ejoline (61)
5/28/2005 12:07:51 AM
Well, I did find a way to print to a .mdi file without using GDI+. But, I 
guess
..mdi files are not readily compatible with Word, so I'd need to maintain 
them
as separate pages, but I could label and print them, etc.

Thanks,
E-Jo

"Everett Joline" <ejoline@optonline.net> wrote in message 
news:uHkYMlxYFHA.3712@TK2MSFTNGP09.phx.gbl...
> Thanks, Gary, for putting me on to GDI+.
> I'll have to admit that I hadn't heard about it before.
> But after doing some research, starting with the MS site that you 
> mentioned,
> it does sound good but it looks like a lot of work getting up-to-speed on 
> GDI+
> and rewriting my app to use it. Is there a way that I can shortcut the 
> process
> and write to a BMP without doing all the conversion?
>
> Thanks,
> E-Jo
>
> "Rhett Gong [MSFT]" <v-raygon@online.microsoft.com> wrote in message 
> news:U14lHnoYFHA.3928@TK2MSFTNGXA01.phx.gbl...
>> >Not sure how one creates a dc from a bmp. Can you elaborate?
>> we can use GDI+ Graphics::FromImage Method.  In code, we can create an
>> Image object first and later save the image to a file after the drawing 
>> is
>> completed.
>> Since it is your application who draws the dc, you can also save the dc 
>> to
>> a stream of a stg object as you like by using following function:
>> Status Image::Save(          IStream *stream,
>>    const CLSID *clsidEncoder,
>>    const EncoderParameters *encoderParams
>> );
>> More details on GDI+ Image Class can be found at:
>> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdicpp/GDIP
>> lus/GDIPlusReference/Classes/Image.asp
>>
>>
>> Thanks,
>> Rhett Gong [MSFT]
>> Microsoft Online Partner Support
>> Get Secure! - www.microsoft.com/security
>> http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp
>> &SD=msdn
>>
>> This posting is provided "AS IS" with no warranties and confers no 
>> rights.
>>
>
> 


0
ejoline (61)
5/28/2005 8:42:04 PM
Here is a simple code sample to illustrate how to use GDI+. 
//-----------------------------------------------
#include <windows.h>
#include <gdiplus.h>
#include <stdio.h>
using namespace Gdiplus;

INT main()
{
   GdiplusStartupInput gdiplusStartupInput;
   ULONG_PTR gdiplusToken;
   GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);

   Image* image = new Image(L"dcSave001.bmp");
   Graphics *gfx = new Graphics(image);
   
// then you can choose either of following way to draw
// 1.draw on gfx directly
// 2.call Graphics::GetHDC to get the dc and draw on the hdc then.
// i think you are more familiar with drawing on HDC.

   delete image;
   GdiplusShutdown(gdiplusToken);
   return 0;
} 
//-------------------------------------------------------
Please let me know if you need further assist on this problem. 

Thanks and regards,
Rhett Gong [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp
&SD=msdn 

This posting is provided "AS IS" with no warranties and confers no rights.

0
v-raygon (10)
5/30/2005 7:09:25 AM
Reply:

Similar Artilces:

Importing into Excel from a Text file
We have a text database of about 7,000 rings. It is in a fixed format. Unfortunately some where we have about 4 or five rings whose format is screwed up. We figured by importing to Excel, we should be able to find where the records are to fix them. But, we just can't get the following format to import into excel. If anyone can help us, we sure would appreciate it! Thank you Greg Gates www.ringdesigner.com Each record begins with Begin Product Each record endswith EndProduct a semicolin seperates each record Also there are para symbols at the end of every line Herer are a...

hyperlink to existing excel file
When I create a hyperlink to an existing excel file and then click on it, explorer opens to the folder that the file is in instead of the excel file opening. Just to test I pointed it to a word document and the doc file opened fine. How do I get a hyperlink to open the excel file? Thanks. Are you sure it isn't to the folder instead. Only way I can reproduce that is if I select the folder instead of the file when I create the hyperlink. As expected if I use a hyperlink to a particular file it will open.. -- Regards, Peo Sjoblom "purplehaz" <software@for.me> wrote i...

Save for Web (.htm) file
I have two similarly structured XLS file. One file "A" is much longer...perhaps 2000 rows long...when saved as a htm file it is around 500KB. I take another XLS spreadsheet that looks like the same structure...rows and colums...only about 560 rows...when I save this as webpage .htm it ends up being 11.2MB. What the heck happened? How do I get it down in size. There is no apparent reason why a smaller file ends up being 11 time larger that the smaller file when saved! Thanks, --confused ...

Report will not print
RMS2.0 SP2 When I print any report, 90% of the time, it will only print the report header and NO other information. When I print to a PDF file it will ALWAYS print the entire report properly. I spoke to MS tech support and they said to change the store logo to the BMP which I did, still no good. Any suggestions? I am using a USB Canon printer, the reports have been printing correctly in the past. I already uninstalled and reinstalled the printer drivers. I am completely lost. Haik, Can you print any other reports? Maybe something is wrong with the report formatting, so the field does...

point exchange to a different priv1.edb file
I have a snapshot of my priv1.edb file on a different drive. I know that exchange 2003 lets us me the priv1.edb file to a different location if the file isn't already there. Is there a way to have exchange point to a different priv1.edb and use it? On Thu, 5 Oct 2006 21:31:01 -0700, Han <Han@discussions.microsoft.com> wrote: > >I have a snapshot of my priv1.edb file on a different drive. I know that >exchange 2003 lets us me the priv1.edb file to a different location if the >file isn't already there. > >Is there a way to have exchange point to a differ...

Preventing Column Cell Values from Printing
I have a summary worksheet with several columns of information. There is one particular column (E25:F39) where I don't always want to print the values. Is there some simple way to toggle this column's values on and off just before hitting the print command? I was thinking of using an adjacent tick box outside the print area, which when ticked would print the column values, and vice-versa. I'm looking for a formula that would examine the tick box, and if the tick (letter 'a' in Marlett font) is not present (i.e. cell value = ""), then the values in column (E25:...

Hyperlink Error
I have a hyperlink set-up for a netwrok file. It works fine, but when the file is copied the hyperlin chages to the folder that the file has been copied to. original link - L:\folder\folder\file Changes to - C:\file How can I get it to keep the original link? Justin ...

getting a single line from a file
I was wondering if someone could tell me how to read a single line from a text file. I tried using getline, but my MFC program does not recognize the getline function. Nor does it recognize <string> or <string.h> or using namespace std. So is there another function that I can use in MFC? Roger Take a look at the CStdioFile MFC class. -- Cheers Check Abdoul [VC++ MVP] ----------------------------------- "R.H." <roger.huggins@intermec.com> wrote in message news:e98o6IMmDHA.1764@tk2msftngp13.phx.gbl... > I was wondering if someone could tell me ho...

Help! page range prob in print
Hi I worked on print.Everythings working perfectly except one problem.ie. When i set the PageRange option to 'ALL' option and press print button..instead of displaying only the pages which has information ..its displaying that all pages from 1 to 65535 r going to be printed. How do i remove this problem? thanks, vani I thing you may failed to set the maximum number of pages to print. Check CPrintInfo::SetMaxPage(nMaxPage); method regds Jibesh -- ------------------------------------------------------------------------- FIGHT BACK AGAINST SPAM! Download Spam Inspecto...

problems printing from MS Office Picture Manager
Operating System is Vista. When running MS Office Picture Manager (Office 2007) drop down option pulls up other printers (which work and MS XPS doc writer or install new printer. Install printer works up to and including print test page which prints normally. Like I said it pulls up the other printers and works with everything but MS office picture manager. Is there a way to associate the printer with MSOPM Have you tried right-clicking on any picture and then selecting "open with" method? This would allow you to associate all pictures to open in MSOPM when you cli...

Printing 2 worksheets to a 2 sided document
Is there any way to print - front to back - 2 seperate worksheets? Turn the paper over and print the second worksheet???? Maybe you can create a worksheet with a picture of both ranges on it: Insert a new worksheet Edit|copy the first range shift-Edit|Paste Picture Link (on that new worksheet) Back for the second range and shift-edit|Paste picture link (right near your first pasted picture link). (insert a nice page break, too) And by pasting a link, you can change the original range and your picture will update right away. (Keep that worksheet as long as you want and print from there???)...

overwritten file
I have a client that overwrote an excel sheet. He did not have autorecovery on. Is there any way to recover this document? Sorry, no. -- John johnf202 at hotmail dot com "mark" <mark@mwts.cc> wrote in message news:4c7501c356ae$89ae8500$a001280a@phx.gbl... > I have a client that overwrote an excel sheet. He did not > have autorecovery on. Is there any way to recover this > document? Backup file is pretty much his only option if one exists. Has he perhaps sent the file anywhere else that he can get a copy back from, or if so he could possibly still have a ...

File Size #4
Using Windows XP and Office 2007 Is there a reason that Publisher files keep growing in size? We have a weekly bulletin with some static information and some information that changes from week to week. On Monday, we open last week's publication, delete the no-longer-relavent text boxes and pictures, and add new text boxes and pictures for the current week. That has been our standard practice. I just noticed that the file size is increasing exponentially which leads me to believe that even though I delete things, there is still some sort of "ghost" material left in the...

Preventing Excel files from being moved or deleted
What permissions setting is used to prevent users from moving or deleting an Excel file on a network? This is more of an network operating system setting question. I would think putting the file on a share that the users only had readonly access would be enough. But this would mean that the users could still copy (not move) the file. And they wouldn't be able to update the workbook. bg500 wrote: > > What permissions setting is used to prevent users from moving or deleting an > Excel file on a network? -- Dave Peterson All explained in Start>Help and Support "p...

Print preview background missing
I have View:Picture:Detailed Display selected. I have File:Print:Advanced Print Settings:Graphics and Fonts:Print full-resolution linked graphics selected. However, I only see my text, and no backgrounds or images in the Print Preview. What am I missing? Thanks! No doubt you are missing an updated video/graphics driver. See the third FAQ here. http://ed.mvps.org/Static.aspx?=Publisher/FAQs -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "7imothy" <7imothy@discussions.microsoft.com> wrote in message news:AC8ADC93-F...

Windows Easy Transfer won't load files?
I ran Windows Easy Transfer on my laptop with Windows 7 RC1 to save and move my profile data because Win 7 RC is shutting down. I am trying to install the Windows Easy Tranfer data to Windows Vista Business. Each time I try it won't read the file but keep asking for the drive with the data to be loaded. I tried a test by moving the the data (.MIG) files out of the folder I saved them to and put them in the root of the drive but that didn't help. I tried a test of copying the files to the root of C: and now it actually sees the file for the short test at home I trying in t...

image prints 'double' in normal and best mode
I have an image - a portait-style, rectangular 'directions' map to help customers find my location which I created in publisher with lines and text, etc, then grouped and saved as a jpg - that I am now trying to use (inserted>from file) in a quarter-page card layout to be printed and cut for inclusion with mailers. If I print in 'fast draft' mode, this map look fine. However, if I try to print in normal or best mode, the image is messed up - the top half of the rectangle is doubled; the bottom half is not printed. Example: the 'this is north' indicator, whic...

publisher 97 won't import a file graph of acceptable quality.
To MSFT: Let me try this again. I have Pub 97 that I must use for writing a manual. I try to import a black and white graphic-a chart, in jpeg or gif or whatever,but the graphic is of such poor quality that it can not be used. This only happens in my Publisher program. I have tried to change the adapter accerleration reading, but it does not help. Does anyone else have this problem with the older version of Pub 97? Do you have this problem with later versions of Publisher? Any ideas are appeciated. Check your graphics filters. Might have some corruption going on. They are in a folder sim...

List of File Extensions
Is there a list somewhere that contains the file extensions used in Office 2003 applications? I need to backup files before re-installing my OS. These include files that store settings, customizations, macros, Outlook address books, etc. ...

Making Design Gallery Objects available to other files in publishe
Hello, I created some custom objects and saved them to the Design Gallery, and they did appear under My Objects. However, I saved the file and opened up a new one and to my shock My Objects was empty. I opened the earlier file where I created and saved the objects and they were still there. Does this mean that the Design Gallery if file-specific and not saved in a Publisher Application file for use in other .pub files? Perhaps that is the default setting that can be changed later. Please help me on this matter. Thank you in advance for your support. Alcide <Alcide@discussions.micr...

merged document printing
How do I print multiple copies of a merged document in Publisher? Seems to only allow one copy of the document. No option is available as it is when printing a regular document. If anyone has an answer please email me at: linked4life@hotmail.com Thank you http://office.microsoft.com/en-us/assistance/CH062524751033.aspx -- Mary Sauer MS MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "linked4life" <linked4life@discussions.microsoft.com> wrote in message news:1FC3E45B-B7F2-4F8D-AD4D-02154C8C399B@microsoft.com... > How do I print mult...

Printing landscape Excel97
I'm looking at the following problem: Excel97 on a NT4 Workstation > worksheet is setup to print landscape but the printer (HP Business Inkjet 2250) gives portrait. When the users with this problem uses another PC the problem is not occuring. So I think it is a local machine- thing. Is there somebody who can give me a hint, registry- setting,...? "Rob Rijs" <robrijs@hotmail.com> wrote... >I'm looking at the following problem: Excel97 on a NT4 >Workstation > worksheet is setup to print landscape but >the printer (HP Business Inkjet 2250) gives portrait...

Automatic open locked excel file through access control
We know,Excel has prompt password to open it files. Is it possible to create a code that can supplies the excel prompt password?.So that when we open the excel file through our access control in a form, the excel files can be opened automatically.But when the excel files opened from its default icon,it will prompt a password first. On Jul 10, 8:43 pm, "shiro" <s...@play.com> wrote: > We know,Excel has prompt password > to open it files. > Is it possible to create a code that can > supplies the excel prompt password?.So that when we > open the excel file throu...

Selected pages to print from MS Outlook
Is there a way to select the the page to print from MS outlook. I could only print all pages from my mail rather than selected pages Please help ...

I can not remove the read only from a file on a cd why
Can someone help me. When I store a file on a cd and then retrieve it, I can not edit it, it comes back as read only. When I go to the file and try to change the attribue within the properties and remove the read only access it is denied. If I save on the hard drive I can make what ever changes I want. Your help will be greatly appreciated. Jeff Smith (212) 929-8024 Jeff, as far as I'm aware, it is still not possible to save a file directly to a CD, as it needs to be "burnt" via burning software . This includes any changes to the file if you have opened it directly from...