473,729 Members | 2,328 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 3480
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 code, it is possible to programatically define a new paper form. Is there any way of...
1
3817
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 is not working. 1.Is it possible to print to the console in a windows application ? If so how...
7
2594
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 transmitts data via a USB-CAN-interface. At the end of "B" a paper label is printed using methods provided...
2
2632
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 display just the printed form (and data) and not the rest of the entry fields or the "print" and "exit"...
3
1368
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. yogesh
0
1140
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 derived form. i am trying to set the tabindex property in the derived form in the form_load...
4
6875
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
1366
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 form needs to be pre-populated with some data from the input file (e.g, name, age, etc.) before...
0
8921
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8763
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9202
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6722
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6022
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4528
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3238
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
2
2683
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2165
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.