How to Align Printed Output in Angular Components

I am a beginner in Angular and I am looking to display modal information. To print the data, I am using onclick=print(). The data shows up in the print preview, but it is not aligned correctly. Here is a screenshot of my page. I want to align the data properly. Here is my CSS code:

@media print {

        #non-printable {
          visibility: hidden;
        }
        #printable{
            visibility: visible;
            border: none;
            position: absolute !important;
            left: 0;
            top: 0;
            overflow-x: auto ;
            float: left;
        }
      }

This is my HTML code:

<div class="modal" id="dModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg" role="document" >
      <div class="modal-content" style="margin-left: auto; margin-right: auto;">
     
        <div class="modal-body" id="printable">
            <div class="container" style="width:100%" >

                  <div class="row">
                    <div class="col col-md-3">
                      <label>Irn Number :</label>
                    </div>
                    <div class="col col-md-9">
                      <label>{{irn}}</label>
                    </div>
                   
                  </div>
              
                  <div class="row">
                    <div class="col col-md-3">
                      <label>Status :</label>
                    </div>
                    <div class="col col-md-7">
                      <label>{{Status}}</label>
                    </div>
                 
                  </div>
              
                   <div class="row">
                    <div class="col col-md-3">
                      <label>QR code :</label>
                    </div>
                    <div class="col col-md-7" style="text-align: left;">
                      <label> <qrcode [qrdata]="qr" [width]="150" [errorCorrectionLevel]="'M'"></qrcode> </label>
                    </div>
                 
                  </div>
              
        </div>

        <div class="modal-footer" id="non-printable">
          <button id="btnPrint" type="button" class="btn btn-secondary" data-dismiss="modal" onclick="print()">Print</button>

        </div>
      </div>
    </div>
  </div>
  </div>

Thank you for your assistance.

Answer №1

To enhance the layout of the container class, consider including the properties

flex-direction: column; display: flex;

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

Tips for extracting CSS data with Selenium webdriver's executescript function

Just starting to learn Javascript in a Node environment... I'm trying to use the code snippet below to extract CSS values for a specific web element, but I'm having trouble parsing it in JavaScript. driver.executeScript(script, ele).then(p ...

Launching a website by running ng serve on an EC2 instance running Ubuntu 16.04

I have been trying to work on this Git project, but I'm facing issues in getting the website to function properly on my server. Oddly, everything seems to be working fine on my Mac. Despite not encountering any error messages, I am unable to access t ...

Converting a date from PHP to JavaScript

My PHP code generates the following date: <?php date_default_timezone_set('Europe/London'); echo date('D M d Y H:i:s O'); ?> Additionally, I have a JavaScript/jQuery script that displays this date on the website: setInterval( ...

Can a Vue computed property return a promise value?

I have a specific computed property in my code that triggers an API request and retrieves the required data: async ingredients() { const url = "/api/ingredients"; const request = new Request(url, { method: "GET", credentials: "same-or ...

Tips for utilizing the data-target feature in Bootstrap?

<button id="btn-id" class="navbar-toggler" type="button" data-toggle="collapse" data-target="#bs-navbar-collapse-1"> <span class="navbar-toggler-icon"></span> <span c ...

The VSCode Extension fails to launch after being packaged

I'm currently working on a straightforward VSCode extension that scans the active open file for any comments containing "//TODO: " and then presents a list of all TODO comments in a webview sidebar tab. While I have a functional prototype that runs s ...

how can you add an object to an array in react native without altering the properties of the array

In my attempt to contract an array for use in 'react-native-searchable-dropdown', I have encountered an issue while trying to push objects into the array. Here is the code snippet that I am struggling with: let clone=[]; obj={{id:8,name:'Yyf ...

I pressed the button but the globalCompositeOperation isn't working as expected. How can I make it function correctly to achieve the desired output like the second canvas?

<!DOCTYPE html> <html> <head> <title>Canvas Compositing Tutorial</title> </head> <body> <canvas id="myCanvas" width="200" height="200" style="border: 1px solid"></canvas> <br> <butt ...

Explanation of stdout and stderr in a child process using node.js version 8

I'm encountering an issue while attempting to initiate a child process in my node dev-server in order to configure the API json-server before launching it using the command: nom run dev -- reset The problem lies in the fact that the stdout and stder ...

The "unsubscribe" property of undefined cannot be read (rxJS - Subscription)

Exploring the world of subscriptions and observables in rxJS is my current focus. My goal is to modify the interval for an Observable by unsubscribing and then resubscribing with the updated interval. While this seems like a straightforward task, I could ...

What is the significance of vendor prefixes in the world of CSS3?

While I can see the rationale behind using prefixes for experimental non-official features to avoid conflicts, what is the reason for using them on shadows and similar elements? Shouldn't all vendors be implementing effects consistently according to ...

React.js: Passing an array as a property to an element results in the transformation of the array into an object

I'm trying to understand why passing an array as a prop to another element results in it getting transformed into an object with the array as its value. I need help understanding if this is a common JavaScript 'quirk' or specific to React an ...

The issue with Nextjs getStaticPaths is that it is not retrieving data from Firebase Firestore

I'm encountering an issue with fetching dynamic data from firestore in nextjs using getStaticPaths. While rendering the data from firestore with getStaticProps works, I'm facing a problem when trying to access specific item details as it leads me ...

Loading GLTF model via XHR may take an infinite amount of time to reach full completion

I am attempting to load a GLTF model of a piano using XHR and showcase the loading progress on a webpage. The model is being loaded utilizing the Three.js library. On a local server, everything works perfectly - the loading percentage is shown accurately, ...

Struggling to verify identity with MongoDB using node.js

After struggling to implement authentication for my mongo database, I finally made progress. Following multiple tutorials and resolving some technical issues (upgrading my server from version 2.4), I successfully added a user. In one shell, I start the s ...

Steer clear of using absolute positioning in Material-UI and React for better styling and layout

Is there a way to achieve the same layout without using position: absolute for the "Hello There" button? I want to remove that CSS property while keeping the design intact. Any better suggestions? Feel free to check out my codesandbox: CODESANDBOX -----&g ...

What is the best way to align the bottom of an anchor element with the bottom of an SVG element when positioning them together

I am working on a test website where I am trying to create an interesting visual layout. My goal is to place an SVG image in the background, with an anchor element and other elements laid out above it. The challenge I am facing is aligning the bottom of th ...

Eliminate any leading or trailing spaces around a string contained within a tag within a contenteditable div

I am working on a project to eliminate extra spaces before and after text within a bold tag. Functionalities: I developed a text editor where users can type text, select it, and apply bold formatting. Additionally, there is an HTML button that displays th ...

Using bootstrap to offset columns fails to function properly in the second row

I'm currently developing a weather application and I'm facing a challenge with centering columns using Bootstrap's grid system. I have two rows that display the current local weather conditions. In order to center these columns on the page, ...

Update of a window occurs automatically

When a user clicks a link on a web page, I open a new window. $('#visit').click(function () { window.open(getHostName() + "/visits" , 'VisitsReport'); }); Within the web page $(document).ready(function () { var initializeVis ...