473,289 Members | 1,961 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,289 software developers and data experts.

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 3425
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 PrintPageEventArgs
argument to OnPrintPage to get the resolutions.

Ron Allen
"VMI" <vo******@yahoo.com> wrote in message
news:eA**************@TK2MSFTNGP15.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**************@TK2MSFTNGP10.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 PrintPageEventArgs argument to OnPrintPage to get the resolutions.

Ron Allen
"VMI" <vo******@yahoo.com> wrote in message
news:eA**************@TK2MSFTNGP15.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(logoName)) // either specified or stock.
{
Image img = Image.FromFile(logoName);
e.Graphics.DrawImage(img, new PointF(98.0f, 56.5f));
xloc = 1.0f + (img.Width/img.HorizontalResolution) + 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**************@tk2msftngp13.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**************@TK2MSFTNGP10.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

PrintPageEventArgs
argument to OnPrintPage to get the resolutions.

Ron Allen
"VMI" <vo******@yahoo.com> wrote in message
news:eA**************@TK2MSFTNGP15.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**************@TK2MSFTNGP10.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(logoName)) // either specified or stock.
{
Image img = Image.FromFile(logoName);
e.Graphics.DrawImage(img, new PointF(98.0f, 56.5f));
xloc = 1.0f + (img.Width/img.HorizontalResolution) + 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**************@tk2msftngp13.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**************@TK2MSFTNGP10.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

PrintPageEventArgs
argument to OnPrintPage to get the resolutions.

Ron Allen
"VMI" <vo******@yahoo.com> wrote in message
news:eA**************@TK2MSFTNGP15.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 SelectSingleNode. 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**************@tk2msftngp13.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**************@TK2MSFTNGP10.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(logoName)) // either specified or stock.
{
Image img = Image.FromFile(logoName);
e.Graphics.DrawImage(img, new PointF(98.0f, 56.5f));
xloc = 1.0f + (img.Width/img.HorizontalResolution) + 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**************@tk2msftngp13.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**************@TK2MSFTNGP10.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
> PrintPageEventArgs
>> argument to OnPrintPage to get the resolutions.
>>
>> Ron Allen
>> "VMI" <vo******@yahoo.com> wrote in message
>> news:eA**************@TK2MSFTNGP15.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
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...
1
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...
7
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: ...
2
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...
3
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...
0
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...
4
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
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...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...

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.