Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7776717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:57:09+00:00 2026-06-01T17:57:09+00:00

I am using a javascript code to print an image with some text as

  • 0

I am using a javascript code to print an image with some text as well. I have used a div area in my html page named ‘divPrintArea’. The content of that div will be printed through calling the javascript function.

Images are coming fine while printing from all the browsers except Chrome(i.e. latest versions of ie, firefox, opera, safari). But in case of Chrome it is missing sometimes.

My second issue is I couldn’t set the default page layout to ‘Landscape’. Do you have any clue? Please give some solutions in detail.
TIA.

function printdata() {
var printHtml = "";
printHtml = printHtml + "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>";
printHtml = printHtml + "<html xmlns='http://www.w3.org/1999/xhtml'>";
printHtml = printHtml + "<head>";
printHtml = printHtml + "<meta http-equiv='cache-control' content='no-cache, must-revalidate'>";
printHtml = printHtml + "<meta http-equiv='refresh' content='0; http://www.MyWebsite.com/' />";
printHtml = printHtml + "<meta http-equiv='expires' content='-1'>";
printHtml = printHtml + "<meta http-equiv='pragma' content='no-cache, must-revalidate'>";
printHtml = printHtml + "<title>www.MyWebsite.com</title>";
printHtml = printHtml + "<style type=\"text/css\" media=\"print\">td{border:0px solid #000; padding:2px 5px;}";
printHtml = printHtml + "body{background:#fff;";
printHtml = printHtml + "width='100%';";
printHtml = printHtml + "height='100%';";
printHtml = printHtml + "filter:progid:DXImageTransform.Microsoft.BasicImage(Rotation=3);";
printHtml = printHtml + "}";
printHtml = printHtml + "</style></head>";
printHtml = printHtml + "<body>";
printHtml = printHtml + "<div style=\"text-align:left; border-bottom:1px dashed #2D86C5; border-top:1px dashed #2D86C5; font-family:'GillSansMTRegular', Arial;\">";
printHtml = printHtml + document.getElementById("divPrintArea").innerHTML;
printHtml = printHtml + "</div>";
printHtml = printHtml + "</body>";
printHtml = printHtml + "</html>";
win = window.open("http://www.MyWebsite.com/", "My");
win.document.write(printHtml);
win.document.close();
win.focus();
win.onload = win.print();
win.close();
return false;

}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T17:57:10+00:00Added an answer on June 1, 2026 at 5:57 pm

    There’re problems in your code:

    filter:progid:DXImageTransform.Microsoft.BasicImage(Rotation=3);
    

    This is only supported by IE, and you should use CSS3’s transform instead.

    width='100%';
    height='100%';
    

    We do not use = sign in CSS. We use :. Maybe this is the cause of the problem.

    Sidenotes

    Well, in your code, you should not really do all this thing. You should use createElement, and change all the printHtml = printHtml + to

    printHtml += 
    

    Also, using document.write is outdated. Use appendChild instead. [MDN]

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to find URLs in some text, using javascript code. The problem is,
I'd like to select the image source url from html code using javascript regexp.
I'm using the following JavaScript code: <script language=JavaScript1.2 type=text/javascript> function CreateBookmarkLink(title, url) { if
I have a javascript code using which I want to accomplish the following .
I have the following Javascript code (using jQuery): floatUpAndDown(); function floatUpAndDown() { $(#bird).animate({top: '+=30px'},
I'm using this code to merge text with an image and it's working fine.
I have a javascript map I'm using and I'm trying to add an image
I'm using this code as the starting point to an overhaul of our JavaScript
I am currently using a javascript code to make an entire row in my
I currently am using this JavaScript code snippet to select 3 checkboxes at a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.