473,570 Members | 2,882 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Printing a paper form (in BMP) from windows application

VMI
I have a BMP image (the form is also in PDF) that contains a scanned copy of
a paper form that we need to fill out. Is it possible to use this image in
my application so that the application can print out the form and the data
that the user entered? For example, the user loads the application and a
normal Windows Form asks for the user's name. When the user enters the name
and clicks on the "Print" button, I'd like to print the form in the jpg
image and include the person's name in that form (in the appropriate
position).
I wanted to use a Windows Form (whose background would be the image), add a
textbox, and then print the Windows Form (with the txtbox that includes the
user's name), but the Windows Form's size is limited to the screen
resolution.
Someone suggested using PrintDocument but I'm not sure if it'll be able to
accomplish this.
Any suggestions are appreciated.
Thanks.
BTW, the PDF that contains the form is editable through Acrobat Reader (I
can type into it and print). Maybe that'll help me.
Nov 16 '05 #1
5 3455
VMI,
You can use PrintDocument and just print the bitmap at the appropriate
location on the form. Make sure to adjust for the printer's dpi settings
though or you will get stretching/shrinking effects on the background. You
can use DpiX and DpiY properties of the Graphics from the PrintPageEventA rgs
argument to OnPrintPage to get the resolutions.

Ron Allen
"VMI" <vo******@yahoo .com> wrote in message
news:eA******** ******@TK2MSFTN GP15.phx.gbl...
I have a BMP image (the form is also in PDF) that contains a scanned copy
of
a paper form that we need to fill out. Is it possible to use this image in
my application so that the application can print out the form and the data
that the user entered? For example, the user loads the application and a
normal Windows Form asks for the user's name. When the user enters the
name
and clicks on the "Print" button, I'd like to print the form in the jpg
image and include the person's name in that form (in the appropriate
position).
I wanted to use a Windows Form (whose background would be the image), add
a
textbox, and then print the Windows Form (with the txtbox that includes
the
user's name), but the Windows Form's size is limited to the screen
resolution.
Someone suggested using PrintDocument but I'm not sure if it'll be able to
accomplish this.
Any suggestions are appreciated.
Thanks.
BTW, the PDF that contains the form is editable through Acrobat Reader (I
can type into it and print). Maybe that'll help me.

Nov 16 '05 #2
VMI
The bitmap I'll be printing is an 8.5"X11" form. I don't really need to
display it in the Win Form; I just need to print it with the user
information. So I'm not really sure what you mean by that. Do you know of
any examples on the Web?

Thanks.
"Ron Allen" <rallen@_nospam _src-us.com> wrote in message
news:Oi******** ******@TK2MSFTN GP10.phx.gbl...
VMI,
You can use PrintDocument and just print the bitmap at the appropriate
location on the form. Make sure to adjust for the printer's dpi settings
though or you will get stretching/shrinking effects on the background. You can use DpiX and DpiY properties of the Graphics from the PrintPageEventA rgs argument to OnPrintPage to get the resolutions.

Ron Allen
"VMI" <vo******@yahoo .com> wrote in message
news:eA******** ******@TK2MSFTN GP15.phx.gbl...
I have a BMP image (the form is also in PDF) that contains a scanned copy
of
a paper form that we need to fill out. Is it possible to use this image in my application so that the application can print out the form and the data that the user entered? For example, the user loads the application and a
normal Windows Form asks for the user's name. When the user enters the
name
and clicks on the "Print" button, I'd like to print the form in the jpg
image and include the person's name in that form (in the appropriate
position).
I wanted to use a Windows Form (whose background would be the image), add a
textbox, and then print the Windows Form (with the txtbox that includes
the
user's name), but the Windows Form's size is limited to the screen
resolution.
Someone suggested using PrintDocument but I'm not sure if it'll be able to accomplish this.
Any suggestions are appreciated.
Thanks.
BTW, the PDF that contains the form is editable through Acrobat Reader (I can type into it and print). Maybe that'll help me.


Nov 16 '05 #3
VMI,
Sorry I meant page where I said form. I don't know of any examples
offhand on the web but I haven't had any problems printing bitmaps on a page
using PrintDocument.
For example the following puts a logo on the page if the logo file
exists on the disk and then sets the x location to just past the right hand
side of the logo.
using System;
using System.Drawing;
using System.Drawing. Drawing2D;
using System.Drawing. Printing;
using System.Xml;
if (System.IO.File .Exists(logoNam e)) // either specified or stock.
{
Image img = Image.FromFile( logoName);
e.Graphics.Draw Image(img, new PointF(98.0f, 56.5f));
xloc = 1.0f + (img.Width/img.HorizontalR esolution) + 0.05f;
}
This puts it at the top left of the page for this form. In your case I
guess that you would just draw the whole thing at 0,0 but be aware that
things outside the printer's hard margins won't be shown.

Ron Allen

"VMI" <vo******@yahoo .com> wrote in message
news:u8******** ******@tk2msftn gp13.phx.gbl...
The bitmap I'll be printing is an 8.5"X11" form. I don't really need to
display it in the Win Form; I just need to print it with the user
information. So I'm not really sure what you mean by that. Do you know of
any examples on the Web?

Thanks.
"Ron Allen" <rallen@_nospam _src-us.com> wrote in message
news:Oi******** ******@TK2MSFTN GP10.phx.gbl...
VMI,
You can use PrintDocument and just print the bitmap at the
appropriate
location on the form. Make sure to adjust for the printer's dpi settings
though or you will get stretching/shrinking effects on the background.

You
can use DpiX and DpiY properties of the Graphics from the

PrintPageEventA rgs
argument to OnPrintPage to get the resolutions.

Ron Allen
"VMI" <vo******@yahoo .com> wrote in message
news:eA******** ******@TK2MSFTN GP15.phx.gbl...
>I have a BMP image (the form is also in PDF) that contains a scanned
>copy
>of
> a paper form that we need to fill out. Is it possible to use this image in > my application so that the application can print out the form and the data > that the user entered? For example, the user loads the application and
> a
> normal Windows Form asks for the user's name. When the user enters the
> name
> and clicks on the "Print" button, I'd like to print the form in the jpg
> image and include the person's name in that form (in the appropriate
> position).
> I wanted to use a Windows Form (whose background would be the image), add > a
> textbox, and then print the Windows Form (with the txtbox that includes
> the
> user's name), but the Windows Form's size is limited to the screen
> resolution.
> Someone suggested using PrintDocument but I'm not sure if it'll be able to > accomplish this.
> Any suggestions are appreciated.
> Thanks.
> BTW, the PDF that contains the form is editable through Acrobat Reader (I > can type into it and print). Maybe that'll help me.
>
>



Nov 16 '05 #4
VMI
Thanks. I works but I don't know how to insert the values into the image.
The values come from the application. Is that possible?
"Ron Allen" <rallen@_nospam _src-us.com> wrote in message
news:uz******** ******@TK2MSFTN GP10.phx.gbl...
VMI,
Sorry I meant page where I said form. I don't know of any examples
offhand on the web but I haven't had any problems printing bitmaps on a page using PrintDocument.
For example the following puts a logo on the page if the logo file
exists on the disk and then sets the x location to just past the right hand side of the logo.
using System;
using System.Drawing;
using System.Drawing. Drawing2D;
using System.Drawing. Printing;
using System.Xml;
if (System.IO.File .Exists(logoNam e)) // either specified or stock.
{
Image img = Image.FromFile( logoName);
e.Graphics.Draw Image(img, new PointF(98.0f, 56.5f));
xloc = 1.0f + (img.Width/img.HorizontalR esolution) + 0.05f;
}
This puts it at the top left of the page for this form. In your case I
guess that you would just draw the whole thing at 0,0 but be aware that
things outside the printer's hard margins won't be shown.

Ron Allen

"VMI" <vo******@yahoo .com> wrote in message
news:u8******** ******@tk2msftn gp13.phx.gbl...
The bitmap I'll be printing is an 8.5"X11" form. I don't really need to
display it in the Win Form; I just need to print it with the user
information. So I'm not really sure what you mean by that. Do you know of any examples on the Web?

Thanks.
"Ron Allen" <rallen@_nospam _src-us.com> wrote in message
news:Oi******** ******@TK2MSFTN GP10.phx.gbl...
VMI,
You can use PrintDocument and just print the bitmap at the
appropriate
location on the form. Make sure to adjust for the printer's dpi settings though or you will get stretching/shrinking effects on the background.

You
can use DpiX and DpiY properties of the Graphics from the

PrintPageEventA rgs
argument to OnPrintPage to get the resolutions.

Ron Allen
"VMI" <vo******@yahoo .com> wrote in message
news:eA******** ******@TK2MSFTN GP15.phx.gbl...
>I have a BMP image (the form is also in PDF) that contains a scanned
>copy
>of
> a paper form that we need to fill out. Is it possible to use this image
in
> my application so that the application can print out the form and the

data
> that the user entered? For example, the user loads the application
and > a
> normal Windows Form asks for the user's name. When the user enters the > name
> and clicks on the "Print" button, I'd like to print the form in the jpg > image and include the person's name in that form (in the appropriate
> position).
> I wanted to use a Windows Form (whose background would be the image),

add
> a
> textbox, and then print the Windows Form (with the txtbox that includes > the
> user's name), but the Windows Form's size is limited to the screen
> resolution.
> Someone suggested using PrintDocument but I'm not sure if it'll be

able to
> accomplish this.
> Any suggestions are appreciated.
> Thanks.
> BTW, the PDF that contains the form is editable through Acrobat
Reader (I
> can type into it and print). Maybe that'll help me.
>
>



Nov 16 '05 #5
VMI,
Just draw them at the appropriate location on the page. I use
XmlDocument items to pass my data around. Just put them into an appropriate
XML structure and when you print the page just grab them out of the
structure with SelectSingleNod e. Draw them at the appropriate location
using DrawString and the font desired.
You may want to get a copy of Programming Windows in C#/VB.NET by
Petzold as he discusses basic printing there. Or look at some of the
printing examples at www.gotdotnet.com or www.codeproject.com.

Ron Allen
"VMI" <vo******@yahoo .com> wrote in message
news:uJ******** ******@tk2msftn gp13.phx.gbl...
Thanks. I works but I don't know how to insert the values into the image.
The values come from the application. Is that possible?
"Ron Allen" <rallen@_nospam _src-us.com> wrote in message
news:uz******** ******@TK2MSFTN GP10.phx.gbl...
VMI,
Sorry I meant page where I said form. I don't know of any examples
offhand on the web but I haven't had any problems printing bitmaps on a

page
using PrintDocument.
For example the following puts a logo on the page if the logo file
exists on the disk and then sets the x location to just past the right

hand
side of the logo.
using System;
using System.Drawing;
using System.Drawing. Drawing2D;
using System.Drawing. Printing;
using System.Xml;
if (System.IO.File .Exists(logoNam e)) // either specified or stock.
{
Image img = Image.FromFile( logoName);
e.Graphics.Draw Image(img, new PointF(98.0f, 56.5f));
xloc = 1.0f + (img.Width/img.HorizontalR esolution) + 0.05f;
}
This puts it at the top left of the page for this form. In your case I
guess that you would just draw the whole thing at 0,0 but be aware that
things outside the printer's hard margins won't be shown.

Ron Allen

"VMI" <vo******@yahoo .com> wrote in message
news:u8******** ******@tk2msftn gp13.phx.gbl...
> The bitmap I'll be printing is an 8.5"X11" form. I don't really need
> to
> display it in the Win Form; I just need to print it with the user
> information. So I'm not really sure what you mean by that. Do you know of > any examples on the Web?
>
> Thanks.
>
>
> "Ron Allen" <rallen@_nospam _src-us.com> wrote in message
> news:Oi******** ******@TK2MSFTN GP10.phx.gbl...
>> VMI,
>> You can use PrintDocument and just print the bitmap at the
>> appropriate
>> location on the form. Make sure to adjust for the printer's dpi settings >> though or you will get stretching/shrinking effects on the background.
> You
>> can use DpiX and DpiY properties of the Graphics from the
> PrintPageEventA rgs
>> argument to OnPrintPage to get the resolutions.
>>
>> Ron Allen
>> "VMI" <vo******@yahoo .com> wrote in message
>> news:eA******** ******@TK2MSFTN GP15.phx.gbl...
>> >I have a BMP image (the form is also in PDF) that contains a scanned
>> >copy
>> >of
>> > a paper form that we need to fill out. Is it possible to use this image > in
>> > my application so that the application can print out the form and
>> > the
> data
>> > that the user entered? For example, the user loads the application and >> > a
>> > normal Windows Form asks for the user's name. When the user enters the >> > name
>> > and clicks on the "Print" button, I'd like to print the form in the jpg >> > image and include the person's name in that form (in the appropriate
>> > position).
>> > I wanted to use a Windows Form (whose background would be the
>> > image),
> add
>> > a
>> > textbox, and then print the Windows Form (with the txtbox that includes >> > the
>> > user's name), but the Windows Form's size is limited to the screen
>> > resolution.
>> > Someone suggested using PrintDocument but I'm not sure if it'll be able > to
>> > accomplish this.
>> > Any suggestions are appreciated.
>> > Thanks.
>> > BTW, the PDF that contains the form is editable through Acrobat Reader > (I
>> > can type into it and print). Maybe that'll help me.
>> >
>> >
>>
>>
>
>



Nov 16 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
346
by: Carlos Kirkconnell | last post by:
When printing, there is a definition for a Custom paper size, the custom paper size can be setted programatically and everything is supposed to work normally. But in windows 2000 and xp, the user must first define a paper form with the size of the format. My application NEEDS to dinamically define the size of paper to use. Using some unmanaged...
1
3808
by: lavu | last post by:
I currently have a C# windows Application . I would like this App to work through an command line interface also. I would like to specify command line params, which should start the app and process using the params. However as a starting step I am trying to print the command line args to the console ( form the windows application) and that...
7
2586
by: Daniel | last post by:
Hello! I am having a problem with a windows application that abnormally terminates itself. The application is a multi threaded .NET 1.1 application, and can briefly be described as follows: Call the thread running the GUI "A". When user clicks a button a new thread "B" is created and started. "B" does a lots of work, among others...
2
2628
by: Rodo | last post by:
Hi all, We have a "testing report" form at work that we fill with data (typing for now). The form has a table, other lines and a company logo. I can make a windows form that will get the data from the user (although eventually it will need to be read from a serial port) and generate a print preview of the form but I don't know how to...
3
1361
by: yogeshtiwarijbp | last post by:
Hi All I have a resume upload application which is a web application. I have to done load testing on that application. For that i have to create a windows application and create multiple instances of that form and use that application in the web application using query string or shell script. If some body has any idea abt that plz help. ...
0
1136
by: arora.dipti | last post by:
Hi, I am having a windows application in which i have one windows form which derives from one base form.the base form has some controls whose tabindex is set there in the form. In my derived form i have some new controls so i want to change the tabindex of the controls which have been derived from the base form alongwith the controls of my...
4
6865
by: Sport Girl | last post by:
Hi everybody, please can anybody give me a hand in this issue: I cannot find the way how to redirect to an another form in Windows Application. What should I write in the code??
0
1351
by: Drew Riegler | last post by:
I am building an app that requires printing of multiple paper forms for each record in a csv text file (could easily be MS Access or mySQL table rows). Each row in the csv file represents a patient being admitted for a surgical procedure. For each patient, I need to print 18 different paper forms which comprise that patient's "chart". Each paper...
0
7724
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7944
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8000
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6323
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5523
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5247
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3681
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2131
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
971
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.