What is the default method for printing in landscape orientation?

How can I print in default landscape mode? Even when I specify landscape mode, the printing comes out in portrait mode.

I have tried the following code but it is not working:

@media print{@page {size: landscape}}

I need help resolving this issue. I want to only display the text entered in the textbox. Please assist me in finding a solution.

Link to jsfiddle

 $scope.print = function(divName,secondDiv){
      $timeout(function () {
      var printContents = document.getElementById(divName).innerHTML;
    var printContents1 = document.getElementById(secondDiv).innerHTML;
    
      console.log(printContents);
      
        var w = window.open();
        w.document.open();
      $timeout(function(){
        w.document.onreadystatechange=function(){
           if(this.readyState==='complete'){
            this.onreadystatechange=function(){};
            w.focus();
            w.print();
            w.close();
           }
        }
      },1000);
      
        w.document.write('<!doctype html><html><head><title>');
        w.document.write('</title><link rel="stylesheet" type="text/css" href="css/main.css" /><link rel="stylesheet" type="text/css" href="css/docs.css" /><link rel="stylesheet" type="text/css" href="css/angular-material.css" /></head><body onload="window.print();window.close()"  style="font-size:14px;" ng-app="app" class="" ng-controller="mainController" >');
        w.document.write(printContents+printContents1); 
        w.document.write('</body></html>');
        w.document.write('<style>@media print {  input { border: none !important;text-align:right!important;font-size:12px!important;margin-top:2px!important; }  th,td{height:3px!important;position:relative;} }</style>');
        w.document.close(); 
        }, 1000);
      }
<div ng-hide="true" class="rec_wrapper" id="printableArea"
style="margin-top: 0px; width: 100%;">
<table class="makeWidth" border="1" style="border-collapse:collapse;">
... (additional content continues further) ...

Answer №1

Perhaps give this a shot, it could be successful.

@page {
    size: A4 portrait;
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Integrating AngularJS and MongoDB

Currently, I am in the process of integrating mongodb with an angular application for a project. The main task involves fetching the collection, passing it through express to convert it into an array, and then utilizing that array to generate a dynamic pa ...

Converting from CAPS lock to using the capitalize property in CSS

Is there a way to transform a sentence that is all in CAPs lock without changing it? This sentence is part of a paragraph, and I am looking for a CSS solution (maybe with a little Jquery) that works reliably across most devices! I have come across similar ...

What is the correct way to link an image path to my PHP script?

I am currently working on a project as a student where we created a MySQL database named Video_Game_Shop. Our task is to connect this database to a website using PHP and HTML, and display all the games listed in our database on one page. To achieve this, ...

Trouble arises when trying to deploy React application on Github pages

After running npm run deploy and following all the steps, it shows that the project is published successfully. However, upon checking the Github hosted link, only my navbar component is visible. Despite setting up the routes correctly in app.js to display ...

What is the best way to center a rotated element and have it aligned to the top?

* { box-sizing: border-box; } body { font-family: 'Poppins', sans-serif; margin: 0px; } .we-adopt { background-color: #8a8484; color: #ffffff; padding: 88px 0px; height: 100px; } .we-adopt-list span { display: i ...

Delete a pin that was added to the image through dynamic insertion

I am attempting to create a feature where clicking on an image element, which is dynamically added using jQuery, will remove it. This achievement is for a straightforward app that displays a pinned map-like image. HTML: <div class="imageMapContainer" ...

What sets apart a component from an element in ReactJs?

Confusion arises for me when I notice that the terms are often used interchangeably. Could somebody clarify the distinctions between them for me, please? ...

Issues arise when jQuery functions do not execute as expected within an "if" statement following

Recently, I delved into the realm of AJAX and embarked on a journey to learn its intricacies. Prior to seeking assistance here, I diligently scoured through past queries, such as this, but to no avail. Here is an excerpt from my code: $('.del'). ...

Examining the HTTP requests using AngularJS and CodeIgniter

Hey everyone,, I'm currently developing a web application where I am using "AngularJS" for the front-end and "CodeIgniter" for the back-end. Everything was working smoothly until I encountered an issue when making requests with AngularJS's built- ...

Having trouble clearing the value of a textfield in Ionic Angular?

Currently, I am working on a project built with Ionic and Angular. The problem I am encountering is related to user signups. Whenever an admin creates a new user, the user receives a signup link. Upon opening the link, a signup form is displayed. Although ...

Discovering how to choose an element from a list fetched through ajax in Angular

It's quite strange to me. Angular allows for selecting by reference, but not by value. Let me explain my situation: I have a form that lets users edit a model. I use ajax to fetch both the model and a list of possible values for one of the model&apo ...

What is the function type in React-Native?

I need assistance understanding the following function: const myFunction = () => () => { //perform a task } Can someone explain the meaning of this function? ...

What is the best way to serialize all li#id elements within an ul using jQuery's serialize() function

First and foremost, I want to clarify that I am utilizing the latest version of jQuery and not jQuery-UI. Below is the list I am working with: <ul id="audio_list"> <li id="trackid_1"></li> <li id="trackid_5"></li> ...

Execute a webpage in the background using PHP

Currently, I'm working on creating a basic PHP script to fetch four images from a server. The catch is that each time I retrieve a new image, I have to access a webpage first - like this: http://example.com/Set.cgi?Image=1 I don't have the abili ...

What issue is present with this AJAX query?

Can you help me figure out where I went wrong with this AJAX code example that I'm trying to learn from? function loadXMLDoc() { var xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new ...

Ways to connect changing information with form fields utilizing ngModel

I am facing an issue with binding dynamic data to a list of input and select fields. Despite using ngModel for binding, only the entry from the last object is being displayed. Sample data that needs to be bound is as follows: properties=[ { "Id ...

The resolution of the Ajax call promise remains elusive

When I make an AJAX call to a REST API in my JavaScript code, the purpose is to fetch a JSON file. The structure of the AJAX call resembles something like this: $.ajax(ajaxObj).then(function(response) {}).catch(function(err) {}); The network monitor refl ...

Updating the text input value in a database with PHP upon button click

Here is a breakdown of what has been implemented so far: The database table is named adhar_card. Below is the structure image for reference (Adhard_card_id serves as the primary key). https://i.sstatic.net/8j4m6.jpg Clicking on the verify button will cha ...

Navigating to a designated screen upon clicking a push notification in React-Native using firebase

I am struggling to configure my push notification so that it directs me to a specific screen when clicked. Currently, the push notification only opens the app if it is in the background. I have been searching online and experimenting for the past two days ...

Can MDBootstrap be integrated with Bootstrap for a cohesive design?

After using Bootstrap for many years, I recently started a project where I incorporated the Bootstrap CDN. However, I realized that I also needed certain features and components from MDBootstrap. When I added MDBootstrap, it caused conflicts with the Boots ...