Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to make an e-mailed html page print landscape 1

Status
Not open for further replies.

vb6novice

Programmer
Sep 23, 2002
288
US
In both MS Access and MS Excel I have automated sending an e-mail to recipients which contains a .htm file. When users open the file to print it, I want it to print in landscape with specific margins without the user having to set those properties.

Can such a thing be done?
 
Not that I'm actually TRYING to spam or anything, but. . . CSS3 needs to work better!!!! *sighs* Okay, I'm fine now.

In CSS3, there are proposed properties known as "block-progression" and "writing-mode". Both are supposed to allow the author to create vertical text. Look at for details and a couple of examples (don't skip over the big colored box). . .

Why is this relevant? If you specify a style sheet for printing, you can use these to rotate text in the style sheet so users will see rotated text. Also, if I understand correctly, using the @page rule will allow you to control when the text is rotated and when it isn't. This means that if a user's printer is set to landscape orientation, the text would not be rotated. If it is set to portrait orientation, the text would be rotated.

However, at the moment, this is not possible to completely do this. The most you can do is rotate images using the 'image-orientation' property. Firefox supports @page, by the way (though I'm not sure how much is implemented properly/at all). :)
 
According to W3c ( CSS3 is only at Working Draft stage, so any current implementations are probably a bit premature. I wouldn't expect to have any real working browsers supporting any of CSS3 until at least next year.

At present W3C are working on CSS 2.1, and not expecting to conclude their recommendations on that until next year

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Essex Steam UK for steam enthusiasts
 

And since he's hoping this will work on email clients (not browsers)... I think there will be more chance of raising the Titanic than getting control over print orientation via CSS in various (unknown) email browsers.

[smile]
Jeff

 
See:

This works for me with both Firefox & IE. It would be great to know what other browsers it works on.

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml"[/URL] xml:lang="en" lang="en">
<head><title>Landscape</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<style type="text/css" media="print">
@page {size:landscape}
html div.landscape {writing-mode:tb-rl; height:90%; margin:10%}
</style></head>
<body><div class="landscape">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
commodo consequat. Duis aute irure dolor in reprehenderit in voluptate
velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
occaecat cupidatat non proident, sunt in culpa qui officia deserunt
mollit anim id est laborum.
</div></body></html>

Clive
 
Clive,

That's worth a star.

Your code works as adverstised if I paste it into a .htm file, and open and print from within IE.

It also works as e-mail content in Outlook IF MS Word is NOT selected as the e-mail editor.

If MS Word IS selected as the e-mail editor, it prints portrait.

Is there a workaround for that?
 
OOPS! I never mentioned that there is no website involved with this operation.

There is an Access program running at Central Operations that starts the whole thing. It is a Warehouse Cycle Counting program that determines which items that company warehouses in other parts of the country will inventory each day (about 3% of all items). Personnel at the warehouse need a sheet which identifies the item ID's and their location(s) to take with them out into the warehouse. Currently, Access is picking the items for count each day for each warehouse and printing the sheets which are then faxed to the appropriate warehouse manager. The warehouse counter does the counting and writes the results on the fax sheet, and faxes it back to the Central Operations.

I was trying to find a way that the sheets could be e-mailed directly to the person who does the counting, without the need for that person to have Office Applications on the computer (warehouse PC's have Outlook Express but not the REAL Office Apps). But those PC's all can display and print HTML since all of our centrally controlled order fulfillment operations that those PC's run are web based).

The sheet has about 6 columns across that have to be big enough to see and big enough to write in, hence the desire for landscape.

(Yes, I know that it doesn't make sense that national operations are running from a centrally located data center and the cycle count program is on a PC at Central Ops. Clients don't want to pay for EVERYTHING.)

Any additional knowledge you wish to impart is appreciated.

BK
 
Clive,

Using your HTML does print landscape as an attachment, however, only if there is just text. When I try to include tables and rows and cells, it prints portrait and it moves all the table cells to the right hand side of the page.

What are your thoughts on that?

 
Thanks Clive.

The flipv link led me to some examples of writing mode which combines vertical and horiozontal text and it seems to work when I put it inside of some tables. I'll try that angle foe a while.

I was concerned about the flipv because of the references to DXImageTransform, which I don't know a thing about.

Thanks for the continued help.

BK
 
Follow Up:

Use of "<DIV STYLE='writing-mode:tb-rl'>My Text</DIV>" for the vertical text worked well. It was a little complicated to get the whole form built that way because you have to re-orient your mind 90 degrees clockwise (e.g. top is now right and left is now top), plus the whole thing has to be built from what will be the bottom of the form to its top, so items that are sorted need to be added in descending order.

Thanks to all contributors for the ideas.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top