How to convert html to pdf using shell script - bash

I have written html in shell script and saving that output to output.html and i want convert that output.html to output.pdf and to output.json how to do that?
<table class="table table-sm">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">First</th>
<th scope="col">Last</th>
<th scope="col">Handle</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>#mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>#fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td colspan="2">Larry the Bird</td>
<td>#twitter</td>
</tr>
</tbody>
</table>

to convert the file in PDF you may need the utility to be installed
Follow this link to get this done
once you install the same, using the link mentioned run this
html2pdf filename

Related

laravel 9 Update, change a field of all rows with the same reference

I ask if anyone can help me, I import an excel table and create several rows of data with a column with the same reference, I want to update a field with a single input of all the rows with the 'Same' reference, for example I want to change the value of the same column with a single input and update the data to all, or add if it does not exist
<table class="table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">First</th>
<th scope="col">Last</th>
<th scope="col">Same</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>255</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>255</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>255</td>
</tr>
</tbody>
</table>

Formating View in maatwebsite Excel Export

I am new to maatwebsite Excel Export i am using view Excel Export in laravel and would like to know how one can specify the cell number where the data should go like a h1 tag like below snippet
<h5>PURCHASE ORDER</h5>
<hr>
<div class="container-flow">
<table id="table" class="table table-hover table-bordered table-sm text-center">
<thead>
<tr>
<th scope="col">No.</th>
<th scope="col">Product_Code</th>
<th scope="col"> Item_Description </th>
<th scope="col">Qty</th>
<th scope="col">Unit Price</th>
<th scope="col" >Value</th>
<th scope="col">Stock Less 90 Days</th>
<th scope="col">Stock More 90 Days</th>
when i export i get this
i would like to specify the cell where that tag should go like say cell B3 instead of current position cell A1
You can put some empty tags / cells before.
Try
<table>
<tr></tr>
<tr></tr>
<tr>
<td></td>
<td></td>
<td><h5>PURCHASE ORDER</h5></td>
</tr>
</table>
<hr>
<div class="container-flow">
<table id="table" class="table table-hover table-bordered table-sm text-center">
<thead>
<tr>
<th scope="col">No.</th>
<th scope="col">Product_Code</th>
<th scope="col"> Item_Description </th>
<th scope="col">Qty</th>
<th scope="col">Unit Price</th>
<th scope="col" >Value</th>
<th scope="col">Stock Less 90 Days</th>
<th scope="col">Stock More 90 Days</th>

How to Display the results in a table format [duplicate]

This question already has answers here:
Horizontal table layout using CSS
(4 answers)
Closed 2 years ago.
I want to display the result of the permissions table in a table format... I'm using Laratrust for roles and permissions
my RoleController
public function show($id)
{
$role = Role::with('permissions')->with('users')->where('id', $id)->first();
return view('admin.roles.show', compact('role'));
}
I want the results to be display in this table horizontally like the way I hard-coded it
show.blade.php
<table class="table">
<thead class="thead-dark">
<tr>
<th scope="col">PERMISSION</th>
<th scope="col">CREATE</th>
<th scope="col">READ</th>
<th scope="col">UPDATE</th>
<th scope="col">DELETE</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="col">Users</th>
<td>Create User</td>
<td>Read User</td>
<td>Update User</td>
<td>Delete User</td>
</tr>
<tr>
<th scope="col">Profile</th>
<td>Create Profile</td>
<td>Read Profile</td>
<td>Update Profile</td>
<td>Delete Profile</td>
</tr>
</tbody>
</table>
<thead class="thead-dark">
<tr>
<th scope="col">PERMISSION</th>
<th scope="col">CREATE</th>
<th scope="col">READ</th>
<th scope="col">UPDATE</th>
<th scope="col">DELETE</th>
</tr>
</thead>
<tbody>
#foreach($role as $key => $data)
<tr>
<th>{{$data->permission}}</th>
<th>{{$data->create}}</th>
<th>{{$data->read}}</th>
<th>{{$data->update}}</th>
<th>{{$data->delete}}</th>
</tr>
#endforeach
</tbody>
I think this should work if role variable have all the data
You can read in Laravel docs for more information https://laravel.com/docs/8.x/eloquent-relationships#eager-loading
And make sure in your Role model has permissions, users relationship then try this:
// controller file
public function show($id)
{
$role = Role::with(['permissions', 'users'])->where('id', $id)->first();
return view('admin.roles.show', compact('role'));
}
// blade file
<table class="table">
<thead class="thead-dark">
<tr>
<th scope="col">PERMISSION</th>
<th scope="col">CREATE</th>
<th scope="col">READ</th>
<th scope="col">UPDATE</th>
<th scope="col">DELETE</th>
</tr>
</thead>
<tbody>
#foreach($role->permissions as $permission)
<tr>
<th scope="col">{{ $permission->name }}</th>
<td>Create User</td>
<td>Read User</td>
<td>Update User</td>
<td>Delete User</td>
</tr>
#endforeach
</tbody>
</table>

How to select few columns by default in jQuery Bootgrid

I am trying to use http://www.jquery-bootgrid.com/examples#data-api
When table is loaded from SQL database, all columns show up as all check boxes are marked in drop down menu (image attached), I want that only selected columns show up by defult and user can mark the the realted column field in check box to make it visible.
.Image here
<table id="employee_grid" class="table table-condensed table-hover table-striped" width="70%" cellspacing="0" data-toggle="bootgrid">
<thead>
<tr>
<th data-column-id="id" data-type="numeric" data-identifier="true">id</th>
<th data-column-id="own_referrer">O_Refferer</th>
<th data-column-id="own_aact_status">own_aact_status</th>
<th data-column-id="rate">rate</th>
<th data-column-id="text_Details">text_Details</th>
<th data-column-id="remarks">remarks</th>
<th data-column-id="commands" data-formatter="commands" data-sortable="false">Commands</th>
</tr>
</thead>
</table>
found the solution. Just add ( data-visible="false" ) (without brackets) to the respective th line in table.
<table id="employee_grid" class="table table-condensed table-hover table-striped" width="70%" cellspacing="0" data-toggle="bootgrid">
<thead>
<tr>
<th data-column-id="own_referrer" data-visible="false">O_Refferer</th>
<th data-column-id="own_referrer">O_Refferer</th>
<th data-column-id="own_aact_status">own_aact_status</th>
<th data-column-id="rate">rate</th>
<th data-column-id="text_Details">text_Details</th>
<th data-column-id="remarks">remarks</th>
<th data-column-id="commands" data-formatter="commands" data-sortable="false">Commands</th>
</tr>
</thead>
</table>

XPATH: Finding rows that contain multiple texts

Im not sure why but the below query
.//*[#id='training_modules_list_table']/thead/tr[th[text()='ID']and th[text()='NAME']and th[text()='STATUS']and th[text()='VERSION']and th[text()='PACKAGE']and th[text()='REFERENCE']]
does not find anything in the html below.
<table class="table sortable stripe tablesaw-stack" data-tablesaw-mode="stack" id="training_modules_list_table">
<thead>
<tr>
<th data-sort="int">ID</th>
<th data-sort="string">Name</th>
<th data-sort="string">Status</th>
<th data-sort="string">Version</th>
<th data-sort="string">Package</th>
<th>Assigned Study</th>
<th data-sort="string">Reference</th>
<th data-sort="string"></th>
</tr>
</thead>
<tbody>
<tr>
While your question has less information that what actually you want to achieve but after seen your xpath it looks you are trying to write a xpath which return you all a tag element.
Try below xpath :-
//table[#id='training_modules_list_table']//tr/th/a
It will return you all element in a tag
Hope it will help you :)

Resources