How to generate an invoice from data

P

Peter Young

I need to be able to generate an invoice from an ASP page. Currently, the
invoice is drawn in a web page and my client prints the page from their
browser. This doesn't work too well in terms of graphics resolution and also
requires endless positioning tweaking on my part.

Is there a way to use Word or Excel on the client, and send the invoice data
down so that some sort of invoice template could be used? This needs to work
on a Mac and ideally on a PC as well. The client machines have Office
installed. I'm thinking this would be the best way to eliminate the
positioning and resolution problems.

Thanks in advance,
Pete
 
D

Dan Brussee

I need to be able to generate an invoice from an ASP page. Currently, the
invoice is drawn in a web page and my client prints the page from their
browser. This doesn't work too well in terms of graphics resolution and also
requires endless positioning tweaking on my part.

Is there a way to use Word or Excel on the client, and send the invoice data
down so that some sort of invoice template could be used? This needs to work
on a Mac and ideally on a PC as well. The client machines have Office
installed. I'm thinking this would be the best way to eliminate the
positioning and resolution problems.

What you are asking is possible, but has it's problems.

Of course the end user would need the program used to open the file in.

You state you do not want to use HTML (generated via ASP) to display the
invoice. I would suggest rethinking that. Graphics resulution should be
no problem at all. Just about any resolution available in Word or Excel
should work fine in HTML layout. Positioning and tweaking seems strange
as well. Usually either Word or Excel use some sort of table (Excel
basically being a big table anyway) which can be replicated in an HTML
table easily.

Can you provide an example of what you are trying to produce as an
invoice? Maybe my idea of an invoice is different from yours :)

Dan
 
P

Peter Young

Hi Dan,

Thanks for the reply.
You state you do not want to use HTML (generated via ASP) to display the
invoice. I would suggest rethinking that. Graphics resulution should be
no problem at all. Just about any resolution available in Word or Excel
should work fine in HTML layout.

The problem I'm having with resolution is the client wishes to have a
corporate logo at the top of the invoice. Screen resolution is 72 dpi, but
to get a good printout of their logo, the image needs to be roughly 300 dpi.
What I see happen then is that the image is huge. I presume because the rest
of the page is 72 dpi. If I set the image resolution at 72 dpi, it prints at
the correct size, but looks pretty bad due to the low resolution.

The current workaround is for them to print the logos from a graphics
program first, then put the paper back in and print the invoices without
images.
Positioning and tweaking seems strange
as well.

The problem is that different browsers print the page differently. I
initially made it to look good in IE on Windows, but when it was printed
from IE on Mac, it wasn't centered. Tweaking the positioning got it to work
on the Mac. But now, due to a bug in IE on the Mac (it keeps dumping it's
cookies and the user's session gets lost) this client is using the new
Safari browser, which is printing it in a whole different way, and part of
the invoice is cropped. Not only that, but another client will also be
needing to print these, but from IE in Windows. I suppose I could detect the
browser and render it differently per browser. That still doesn't fix the
image resolution problem though.
Can you provide an example of what you are trying to produce as an
invoice? Maybe my idea of an invoice is different from yours :)

Unfortunately, the invoice is part of a private site and I can't post a URL
to it. If need be, I can put something static together, though without the
client's actual setup, it's tough to demonstrate exactly what I'm seeing.
It's just a basic invoice, with a logo at the top. It looks decent, I'm just
tired of having to adjust the HTML due to browser variances in printing, and
the client is tired of the extra print operation with the logo.

I'll turn the table on you a bit. Do you know of an example of this type of
operation that prints the same from all browsers and on all platforms?

Otherwise, I would really like to get away from browser-dependent printing.
It seems to me that there should be a way to send down the data, perhaps in
XML format or perhaps in a doc or xls format, and then let Word or Excel
handle it in a rich-client setting. (All users of this system have Office.)
Or if there's a piece of software like Crystal Reports that can handle this,
I'm all ears. I'm not at all familiar with the options here, or if there
even are any.

Thanks again for the help,
Pete
 
A

Alan

You can create the basic design in Word (or whatever) with little
placeholders embedded wherever you want your dynamic content to appear. Save
as a RTF and whack it on the server. Then, in your ASP, use a FSO to read in
the template and replace the placeholders with your actual content. The RTF
spec isn't simple (search microsoft.com if you're really keen) so I normally
just reverse-engineer the bits I have to after opening the template file in
InterDev, notepad, etc.

If you're careful you can concatenate multiple documents (from multiple
iterations using the same template) into one, create and then insert little
RTF tables on the fly, etc.

For data best presented in a spreadsheet I normally just Response.Write it
out as tab separated values.

Alan
 
C

Chris Barber

Interesting fix for the logo issue:

Have the graphic at 300dpi and in the page set the width and height of
the image to be "20%" [roughly 72/300]

eg.

<img src="300dpiimage.jpg" width="20%" height="20%"/>

That should give you the correct 'size' on the screen and also a 300dpi
print image when printed from IE (at least I think it did when I was messing
with print layouts for online maps).

Chris.

Hi Dan,

Thanks for the reply.
You state you do not want to use HTML (generated via ASP) to display the
invoice. I would suggest rethinking that. Graphics resulution should be
no problem at all. Just about any resolution available in Word or Excel
should work fine in HTML layout.

The problem I'm having with resolution is the client wishes to have a
corporate logo at the top of the invoice. Screen resolution is 72 dpi, but
to get a good printout of their logo, the image needs to be roughly 300 dpi.
What I see happen then is that the image is huge. I presume because the rest
of the page is 72 dpi. If I set the image resolution at 72 dpi, it prints at
the correct size, but looks pretty bad due to the low resolution.

The current workaround is for them to print the logos from a graphics
program first, then put the paper back in and print the invoices without
images.
Positioning and tweaking seems strange
as well.

The problem is that different browsers print the page differently. I
initially made it to look good in IE on Windows, but when it was printed
from IE on Mac, it wasn't centered. Tweaking the positioning got it to work
on the Mac. But now, due to a bug in IE on the Mac (it keeps dumping it's
cookies and the user's session gets lost) this client is using the new
Safari browser, which is printing it in a whole different way, and part of
the invoice is cropped. Not only that, but another client will also be
needing to print these, but from IE in Windows. I suppose I could detect the
browser and render it differently per browser. That still doesn't fix the
image resolution problem though.
Can you provide an example of what you are trying to produce as an
invoice? Maybe my idea of an invoice is different from yours :)

Unfortunately, the invoice is part of a private site and I can't post a URL
to it. If need be, I can put something static together, though without the
client's actual setup, it's tough to demonstrate exactly what I'm seeing.
It's just a basic invoice, with a logo at the top. It looks decent, I'm just
tired of having to adjust the HTML due to browser variances in printing, and
the client is tired of the extra print operation with the logo.

I'll turn the table on you a bit. Do you know of an example of this type of
operation that prints the same from all browsers and on all platforms?

Otherwise, I would really like to get away from browser-dependent printing.
It seems to me that there should be a way to send down the data, perhaps in
XML format or perhaps in a doc or xls format, and then let Word or Excel
handle it in a rich-client setting. (All users of this system have Office.)
Or if there's a piece of software like Crystal Reports that can handle this,
I'm all ears. I'm not at all familiar with the options here, or if there
even are any.

Thanks again for the help,
Pete
 
D

Don Verhagen

In Peter Young <[email protected]> typed:
: I need to be able to generate an invoice from an ASP page. Currently,
: the invoice is drawn in a web page and my client prints the page from
: their browser. This doesn't work too well in terms of graphics
: resolution and also requires endless positioning tweaking on my part.

Yes, because the *browser* is printing a web page, not a form.

: Is there a way to use Word or Excel on the client, and send the
: invoice data down so that some sort of invoice template could be
: used? This needs to work on a Mac and ideally on a PC as well. The
: client machines have Office installed. I'm thinking this would be the
: best way to eliminate the positioning and resolution problems.

I would suggest PDF format over Word/Excel. Unless the data needs to be
edited for some reason. The one reason I am suggesting PDF is because of
it's availiability on PC/Mac.

I guess my other question is how many invoices are to be view/printed this
way? If it's many (your call as to what qualifies as many), spend the money
for some PDF tools.

My 2 cents,
Donald Verhagen
 
A

Alan

Pagination can be a problem when using HTML to generate reports. With RTF,
because it's ASCII-based you have pretty good control over the behaviour and
content of the document, you can edit the content after it's been rendered
(pro and con), and it's a free solution. It also works well with my user
base of PCs/Macs, different browsers, etc.

I would also be interested in a PDF solution though. Are any of the
components free and able to create multi-page documents from database data?

Alan
 
P

Peter Young

Thank you all for the feedback. I'm going to investigate the PDF components
out there. That would seem to provide the most flexibility.

Anyone have a recommended component?

Thx,
Pete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top