Laravel Blade Shows Special Characters - laravel

I am working on a project where I need to create the PDF from the view. but in the blade file the "ß ß ß ß ß ß" characters, as I checked my codes there are no tags which contain these characters. can any one help me to fix this issue? I have added the blade file code. Please have a look.
<html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#4.6.0/dist/css/bootstrap.min.css" integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l" crossorigin="anonymous">
</head>
<body>
#if (count($data['data']) > 0)
<table class="table table-condensed">
<tr>
<td><img src="{{public_path().'/theme/frontend/images/logo.png'}}"alt="kpvlogo"></td>
<td colspan="8" style="text-align: center; font-size:24px; font-weight: bold;">Weekly Ranking</td>
<td colspan="6" >Week Ending {{$data['end']}}</td>
</tr>
<tr>
<thead>
<th style="font-weight: bold;">Store</th>
<th style="font-weight: bold;">Net Sales</th>
<th style="font-weight: bold;">+/- Last Year %</th>
<th style="font-weight: bold;">Cust.Count +/- %</th>
<th style="font-weight: bold;">Labour %</th>
<th style="font-weight: bold;">Food %</th>
<th style="font-weight: bold;">Cash %</th>
<th style="font-weight: bold;">GSS</th>
<th style="font-weight: bold;">Complaints</th>
<th style="font-weight: bold;">Speed of Service</th>
<th style="font-weight: bold;">Training</th>
<th style="font-weight: bold;">Rank</th>
</thead>
</tr>
<tbody>
#foreach ($data['data']['grid'] as $item)
<tr>
<td>{{$item['store']}}</td>
<td class="text-right">{{$item['net_sales']}}</td>
<td class="text-right">{{$item['last_year']}}</td>
<td class="text-right">{{$item['customer_count']}}</td>
<td class="text-right">{{$item['labour']}}</td>ß
<td class="text-right">{{$item['food']}}</td>
<td class="text-right">{{$item['cash']}}</td>
<td class="text-right">{{$item['gss']}}</td>
<td class="text-right">{{$item['complaints']}}</td>
<td class="text-right">{{$item['speed_of_service']}}</td>
<td class="text-right">{{$item['training']}}</td>
<td class="text-right">{{$item['rank']}}</td>
</tr>
#endforeach
<tr>
<td colspan="12" class="text-center">Top Performer of the Week</td>
</tr>
<tr>
<td colspan="12" class="text-center">Congratulations to the team from <b>{{$data['data']['top']['store']}}</b> for achieving the overall best results this week.</td>
</tr>
<tr>
<td colspan="12" class="text-center">Thank You!</td>
</tr>
</tbody>
</table>
#endif
{{-- <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script>
var body_text = $('body').text();
var match = body_text.match('ß');
console.log(match);
</script> --}}
</body>
</html>

It would help if you can identify where in the blade file the special characters appear. Seeing that none of the ß ß ß ß ß ß characters can be found in your blade, this suggests that what's causing it is somewhere in your database. I recommend you inspect the data and the database column of the $item where the characters are seen and you may find the cause.

Related

How to solve design break when use page-break in dompdf

When generating the pdf with page-break-before after 3rd rows the design is breaking down. Here is my code
<!DOCTYPE html>
<html lang="en">
<head>
<title>DOM-PDF</title>
</head>
<body>
<table style="width:100%;">
<thead>
<tr>
<th>Serial</th>
<th>Name</th>
<th>Roll</th>
<th>Info</th>
</tr>
</thead>
<tbody>
#php
$n = 0;
for($i=0;$i<10;$i++){
#endphp
<tr style="text-align:center;">
<td>1</td>
<td>Rashedul Hasan</td>
<td>1208039</td>
<td>I am an employee.</td>
</tr>
#php
if($n==3){
echo "<i style='page-break-before:always;'></i> ";
}
$n++;
}
#endphp
</tbody>
</table>
</body>
</html>
This is the pdf view of page 1
This is the pdf view of page 2
In page 2 second row is moving to the right. How to fix it?
What about using chunks instead of breaking the table?
{{-- Replace collect()->times(10) with a collection when you're getting the actual data from DB --}}
#foreach (collect()->times(10)->chunk(3) as $chunk)
<table style="width:100%;">
<thead>
<tr>
<th>Serial</th>
<th>Name</th>
<th>Roll</th>
<th>Info</th>
</tr>
</thead>
<tbody>
#foreach($chunk as $result)
<tr style="text-align:center;">
<td>{{ $result }}</td>
<td>Rashedul Hasan</td>
<td>1208039</td>
<td>I am an employee.</td>
</tr>
#endforeach
</tbody>
</table>
<i style='page-break-before:always;'></i>
#endforeach

How to use REST API PdfReactor / MS Flow Post Request

I would like to convert a simple html file to PDF using PDF Reactor and MS Flow.
I set up a PdfReactor running in a docker container.
Can somebody help me to get the http post request right to have PdfReactor convert the file to pdf?
PdfReactor Documentation
The payload for most of POST methods of the PDFreactor Web Service must be in XML, JSON or ZIP format (see also https://www.pdfreactor.com/product/doc_html/index.html#payload).
So you should set the „body“ of your request to a JSON like the following:
{
document: "Your File Content"
}
NEW Flow HTTP Request Picture
With this request i was able to pass through the payload.
The content of the "html" Variable is going to look like this.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Inspectionlist 0583 / 16.05.2020</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.Stil1 {
font-size: 36px;
font-weight: bold;
}
.Stil11 {font-size: 44px}
.Stil12 {font-size: 36px}
-->
</style>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="39%"><div align="center" class="Stil1">
<p><span class="Stil11">I n s p e c t i o n s </span> <br>
16.05.2020<br>
</p>
</div></td>
<td width="32%"><div align="center"><span class="Stil11"><span class="Stil12">Ship-No.:</span> <span class="Stil1">0583</span></span> <br>
</div></td>
</tr>
</table>
<table width="100%" border="1" align="center" cellpadding="5" cellspacing="0" bordercolor="#999999">
<tr bgcolor="#CCCCCC">
<th width="20" scope="col"><strong>No.</strong></th>
<th width="70" scope="col"><strong>Start of insp. </strong></th>
<th width="70" scope="col"><strong>End of insp. </strong></th>
<th width="30" scope="col"><strong>Class.</strong></th>
<th width="30" scope="col"><strong>Yard</strong></th>
<th width="30" scope="col"><strong>Owner</strong></th>
<th width="158" scope="col"><strong>Responsible</strong></th>
<th width="30" scope="col"><div align="center"><strong>BGN</strong></div></th>
<th width="481" scope="col"><strong>Description</strong></th>
<th width="130" scope="col"><strong>Pre-Inspection Yard </strong><strong>Contractor</strong></th>
</tr>
<tr>
<td width="20"><div align="center"><span class="Stil8"></span></div></td>
<td width="70"><div align="center"><span class="Stil8"><B><FONT SIZE="6">No Inspections!<B></FONT> </span></div></td>
<td width="70"><div align="center"><span class="Stil8"></span></div></td>
<td width="30"><div align="center"><span class="Stil8"></span></div></td>
<td width="30"><div align="center"><span class="Stil8"></span></div></td>
<td width="30"><div align="center"><span class="Stil8"></span></div></td>
<td><div align="center"><span class="Stil8"></span></div></td>
<td width="30"><div align="center"><span class="Stil8"></span></div></td>
<td><p align="left" class="Stil3 Stil6"><strong>No.</strong> <strong>Location:</strong> <br><br>
<br></p>
</td>
<td><div align="center"><span class="Stil8"><br>
</span></div> <div align="center"></div></td>
</tr>
</table>
<center> printed on: 15.05.2020 - 19:15 </center>
</body>
</html>
After the conversion the pdf is not readable by e.g acrobat, do you guys know what i'm missing?

Why Xpath 3.0 works, but Xquery 3.0 doesn't work with the same expression

I launched Xpath in Oxygen. In Xpath 3.0 found what i need but in Xquery 3.0 doesn't find.
This is my Xpath expression
//table[tbody/tr/th/p[contains(text(), 'All Water System Contacts')]]/tbody/tr[3]/td[1]
This is my xml code
I put part code.
<table border="1" cellpadding="1" cellspacing="1" summary="." width="640">
<tbody>
<tr>
<th colspan="3">
<p>All Water System Contacts </p></th>
</tr>
<tr>
<th>Type</th>
<th>Contact</th>
<th>Communication</th>
</tr>
<tr>
<td align="center">AC - Administrative Contact - GENERAL MANAGER </td>
<td align="center">GRANT, JOHN, W <br/> PO BOX 869<br/> BIG SPRING, TX 79721-0869 </td>
<td align="center">
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse"
width="100%">
<tbody>
<tr>
<th><b>Electronic Type</b></th>
<th><b>Value</b></th>
</tr>
</tbody>
</table>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse"
width="100%">
<tbody>
<tr>
<th><b>Phone Type</b></th>
<th><b>Value</b></th>
</tr>
<tr>
<td align="center">BUS - Business</td>
<td align="center">432-267-6341 </td>
</tr>
<tr>
<td align="center">FAX - Facsimile</td>
<td align="center">432-267-3121 </td>
</tr>
<tr>
<td align="center">BUS - Business</td>
<td align="center">432-267-6070 </td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td align="center">OW - Owner </td>
<td align="center">COLORADO RIVER MUNICIPAL WATER DISTRICT <br/> PO BOX 869<br/> BIG
SPRING, TX 79721-0869 </td>
<td align="center"> </td>
</tr>
</tbody>
</table>
I tried different functions.
I don't know why it doesn't work and what difference
Please help me.
I suspect your real, complete input has an XHTML default namespace declaration xmlns="http://www.w3.org/1999/xhtml" and in oXygen for XPath you have the setting enabled to "use the default namespace of the root element" so your path works with XPath out of the box while for XQuery you need to make sure you explicitly set
declare default element namespace 'http://www.w3.org/1999/xhtml';
in the prolog of your XQuery file or code sample.

Add image at background, outlook problems

have problem like in title. Have email template, everything are ok, but background image doesn't work on outlook. Unfortunately most people in my country use it. Below my code:
<!--#subject Email - Header #-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="initial-scale=1.0, width=device-width" />
</head>
<body>
{{var non_inline_styles}}
<!-- Start Image Background -->
<table class="image-background" cellpadding="0" cellspacing="0" border="0" width="100%" bgcolor="22262b" background="http://met.ivycommerce.eu/glamoura_main_image.jpg">
<tr>
<td class="image-background" align="center" style="background: url('http://met.ivycommerce.eu/pattern.png') 0 0 repeat">
<table class="container-table" cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="separator-50" height="50"> </td>
</tr>
<!-- Start Three Column -->
<tr>
<td>
<table class="container-table" cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="center" align="center">
<a href="{{store url=""}}">
<img style="display: block; margin: 0 auto;"
{{if logo_width}}
width="{{var logo_width}}"
{{else}}
width="165"
{{/if}}
{{if logo_height}}
height="{{var logo_height}}"
{{else}}
height=""
{{/if}}
src="{{var logo_url}}"
alt="{{var logo_alt}}"
border="0"/>
</a>
</td>
</tr>
</table>
</td>
</tr>
<!-- Start Three Column -->
<tr>
<td class="separator-30" height="30"> </td>
</tr>
<tr>
<td align="center">
<table align="center" border="0" cellpadding="0" cellspacing="0" width="60">
<tr>
<td class="separator-line" bgcolor="#ffffff" height="1"> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="separator-30" height="30"> </td>
</tr>
<tr>
<td class="colored-heading" align="center" height="28">
<div style="line-height: 28px;">Nasza Misja</div>
</td>
</tr>
<tr>
<td class="heading" align="center" height="28">
<div style="line-height: 28px;">To uśmiechnięci Klienci</div>
</td>
</tr>
<tr>
<td class="separator-10" height="10"> </td>
</tr>
<tr>
<td class="sub-heading" align="center" height="24">
<div style="line-height: 24px;">Dziękujemy, że dołączyłeś do wielkiego grona Bionaturalnych.</div>
</td>
</tr>
<tr>
<td class="separator-50" height="50"> </td>
</tr>
<tr>
<td align="center">
<table align="center" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="button" align="center" valign="middle" height="38" width="140">
Wejdź Do Sklepu
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="separator-50" height="50"> </td>
</tr>
</table>
</td>
</tr>
</table>
<!-- End Image Background -->
<!-- Begin wrapper table -->
<table width="100%" cellpadding="0" cellspacing="0" border="0" id="background-table">
<tr>
<td valign="top" class="container-td" align="center">
<table cellpadding="0" cellspacing="0" border="0" align="center" class="container-table">
<tr>
<td valign="top" class="top-content">
<!-- Begin Content -->
I was try with some code, but not success :( when background are ok, rest align left, but have to be center. Can somebody help me?
Outlook generally requires old school type programming and has a lot of things that are not permitted in email that are allowed in website programming. This means that the style works best when included in the header and background images cannot be used. If you want to use a background image, say behind a title for example, you would need to create the title and background as a single image to insert as you would any other image. The downside to this is that Outlook will not download images unless the user specifies to do so. Since a majority of your users use Outlook, best practices says to program for them and then test it across all other browsers. Here is a list of issues identified by Mailchimp, an email service provider, that specifically pertain to Outlook and what fixes, if available, can be performed. http://kb.mailchimp.com/campaigns/previews-and-tests/my-campaign-looks-bad-in-outlook.
In reviewing your code provided, here are some other things that I think you might want to consider:
Use fixed measurements instead of percentages;
Instead of using code for spacing, use a 1px x 1px transparent or background colored image that you can adjust the height and the width of to make the space work the way you want;
Put all styles at the top in css format, for example:
<style type="text/css">
body{
margin:0;
padding:0;
font-family:"Trebuchet MS", arial, sans-serif;
}
</style></head>
I have been programming email newsletters for almost ten years now and the most simple, basic code works the best when the majority of your users have Outlook. Finally, I recommend that you always run your code through an html validator, such as https://validator.w3.org/ to check your code. Even the smallest error can result in unanticipated results with Outlook or other browsers.
Zydol,
To make this work, you will need to use VML to create an object and assign the background image to that. You can read more about this technique here: https://www.emailonacid.com/blog/article/email-development/emailology_vector_markup_language_and_backgrounds
I do believe Bulletproof Backgrounds is the answer you're looking for!
https://backgrounds.cm/

Parse table in HTML Agility Pack for WP7

I have following HTML:
<table cellspacing="8" cellpadding="6" border="1" style="color: Black; background-color: LightGoldenrodYellow;
width: 60%;" id="GridView2" rules="all">
<tbody>
<tr style="color: White; background-color: #CF4B0A; font-weight: bold;">
<th align="center" scope="col">
Booked At
</th>
<th align="center" scope="col">
Booked On
</th>
<th align="center" scope="col">
Delivered At
</th>
<th align="center" scope="col">
Delivered On
</th>
<th scope="col">
Details
</th>
</tr>
<tr align="left" style="color: #333333; background-color: #FFFBA1; font-family: Arial;
font-size: Small;">
<td align="center">
Not Available
</td>
<td align="center">
Not Available
</td>
<td align="center">
DATA
</td>
<td align="center">
12/01/2012
</td>
<td>
<a href="javascript:__doPostBack('GridView2$ctl02$LinkButton1','')" id="GridView2_ctl02_LinkButton1">
Details</a>
</td>
</tr>
</tbody>
</table>
I would like to parse the above table using HTML Agility pack. I'm using the HAP solution for WP7, downloaded from Codeplex.
Any quick help will be appreciated.
To parse the HTML, use HAP's HtmlDocument.LoadHtml() function and pass it the actual string. That will give you a DOM with all the HTML objects in it.

Resources