I have below view which generates PDF invoice using MvcRazorToPdf library
<table border="0">
<tr>
<td>
<h1>Company Name </h1>
</td>
<td>
<div style="text-align:right;margin-right:0px;">
Invoice
</div>
</td>
</tr>
</table>
<hr/>
<div>
#Model.InvoiceNum
</div>
Above code generates below view in pdf
But how much ever I style the above div within td for invoice, I am not able to move the Invoice text to the right side of the pdf. I've tried adding link to bootstrap.css which doesn't work either. Anyone have any solution for this? Has anyone worked on styling the pdf with MvcRazorToPdf librabry?
Your text alignment is being respected, its just that by default, you table and its cells will be collapsed to fit the content (easy to check by using your browser tools to inspect the elements).
Give your table (or its cells a width), for example
<table style="width:100%;">
However, using <table> elements is not good practice (refer Why not use tables for layout in HTML? and Why Tables Are Bad (For Layout*) Compared to Semantic HTML + CSS.). Instead you can use floats or relative/absolute positioning, for example
<div style="position:relative;">
<h1>Company Name</h1>
<span style="position:absolute;right:0;bottom:0">Invoice</span>
</div>
or
<div>
<h1 style="display:inline-block">Company Name</h1>
<div style="float:right;margin-top:40px;">Invoice</div>
</div>
Related
I have a Rails app where I'm using Bootstrap and jquery dataTables.
The dataTable is wider than the Bootstrap span set in the parent div. I would like the table to stay within the width of the span.
This is the first 2 lines of the view page:
<div class="span12">
<table class="display table dataTable table-striped table-bordered table-condensed" id="dataTable1" >
Thanks for the help!
I ended up using this:
<div class="span12" style="width: 1100px;">
As per request by #Reddirt to promote my comment to an answer...
Have you tried to just put a width on the table? eg:
<table style="width:600px"
I'm having an issue with the Bootstrap 3 table-responsive on iOS 7 (iPad4 on safari).
When I load the webpage with the table it can only show 70% of the table and the rest is hidden to the right:
But the issue is when i scroll to the right the background color of the table is lost and the background of the body is shown:
I've simplified the table as much as possible to weed out anything silly i missed with no luck. Here is how the body is defined (i removed the table info because it's being created by some ng-repeats and aren't helpful):
<body style="background-color: #3E3E40;">
<div class="container">
<div class="table-responsive">
<table class="table" style="background-color: #E0E0E3;">
....
</table>
</div>
</div> <!-- /container -->
</body>
Any information or suggestions on how to fix this issue will be greatly appreciated!!!
How does this work for you? http://jsfiddle.net/panchroma/qYY2y/
HTML is unchanged, I'm applying the table background color to table-responsive div that wraps your table
.table-responsive{
background-color:#fff;
}
Hope this helps!
EDIT
A variation for #rapcal with a drop shadow on the responsive table
http://jsfiddle.net/panchroma/16yt4vnq/
Applying a drop shadow to the table directly won't work because of how the native bootstrap stying handles overflows on the table-responsive div. But if you wrap everything in another div you have more freedom
HTML
<div class="wrapper"> <!-- apply drop shadow to this div -->
<div class="table-responsive">
<table class="table"> ... </table>
</div>
</div>
I am trying to get a footer in a generated pdf file. I am using this library
https://github.com/andyhutch77/MvcRazorToPdf
Is there any way to get some of my content to the bottom of the page? Unfortunately pdf does not respond to position:absolute; bottom:0px; or margin-bottom.
The page shows an unknown amount of records on the page, so I cannot do it statically.
I found a way to solve this problem. It's not very neat, but I doubt there are other ways since MvcRazorToPdf does not support the margin and position styles.
<table id="wrapper" style="height:100%;">
<tr>
<td valign="top">
Put your site content here.
</td>
</tr>
<tr>
<td valign="bottom">
Put your footer here.
</td>
</tr>
</table>
If I add the following slide into the default presentation provided by reveal.js, then the table is not centred.
<section>
<p>This is centred</p>
<table>
<tr>
<td>This</td>
<td>is</td>
<td>not</td>
</tr>
</table>
</section>
I can fix it by adding in padding, but this then becomes dependent on the screen size, and I am worried that when I go to present the screen will be a different size. There must be a better way?
According to this and my testing, if you add the reveal class to your table, the newest reveal.js should center it.
<section>
<p>This is centred</p>
<table class="reveal">
<tr>
<td>This</td>
<td>is</td>
<td>not</td>
</tr>
</table>
</section>
I'm using bootstrap-sass to integrate Twitter Bootstrap in Rails but I'm having issues with the browser horizontal scrollbar showing without the need for it.
Sample code in a Rails View:
<div class="row-fluid">
<div class="span4"> </div>
<div class="span8">
<table>
<tr>
<td><%= image_tag("up-arrow.jpg") %></td>
<td><h3> Select a Maintenance category </h3></td>
</tr>
</table><br>
</div>
</div>
</div>
I can't find why it does it and how to fix it.
See these links examples: http://d.pr/hLQd and http://d.pr/LOOP (Look at the bottom horizontal scroll)
I fixed this particular issue by overwriting the gridGutterWidth value from 20px (default) to 30 or 35px.
Don't think it's a Bootstrap bug though.
Thanks!