Creating Multipage PDF witth Headers and Footers iTextSharp - itext

Hello everyone and thanks for your help in advance. I need to develop an application to generate a multipage PDF with iTextSharp. Each page needs to have a header and footer. Additionally, each page will have a variety of different objects including tables, paragraphs, and something similar to listitems (probably a cone column table). I'm trying to find a tutorial to accomplish this. At the heart of my confusion is how to determine when a break should happen and how to not overlay the footer if for example the table or paragraph is too long to fit on the page. Any help would be appreciated.
I appreciate the response from Bruno and am intrigued with styling an HTML page, then rendering with iText, but I'm really struggling with how to actually do this on a real page. Here is some sample HTML of the page I want to print:
<body>
<header class="onlyprint">
<ul>
<li>
Dr. Who
</li>
<li>
1234 Somewhere St.
</li>
<li>
Anywhere, US 12345
</li>
</ul>
</header>
<div id="divmain" style="width: 760px;">
<ul id="ulPatientDetails">
<li>
<label>Patient Name:</label>
<span>TESTCASE, TOM</span>
</li>
<li>
<label>MRNumber:</label>
<span>999999</span>
</li>
<li>
<label>Patient DOB:</label>
<span>99/99/9999</span>
</li>
</ul>
<table id="tblhistorian">
<caption>Historian</caption>
<tr>
<th>Time Entered</th>
<th>Historian</th>
<th>Historian Name</th>
<th>Other Persons</th>
<th>Language</th>
<th>Other Language</th>
<th>Translator</th>
<th>Entered By</th>
</tr>
<tr>
<td>
99/99/9999
</td>
<td>
Mother
</td>
<td></td>
<td></td>
<td>
English
</td>
<td></td>
<td></td>
<td>
Dr. Who
</td>
</tr>
</table>
<ul id="ulPatientAllergies">
<li>
<label>Allergies:</label>
<span>BLAH BLAH BLAH BLAH</span>
</li>
</ul>
<table id="tblTobaccoUse">
<caption>Tobacco Use</caption>
<tr>
<th>Patient Uses Tobacco</th>
<th>Family Uses Tobacco</th>
<th>Entered By</th>
<th>Time Entered</th>
</tr>
<tr>
<td>N/A</td>
<td>No</td>
<td>Someone</td>
<td>99/99/9999</td>
</tr>
</table>
<table id="outsidemedications">
<caption>Active Prescriptions</caption>
<tr>
<th>Date</th>
<th>Prescribed By</th>
<th>Prescription</th>
<th>SIG</th>
<th>Route</th>
<th>Dispense</th>
<th>Refills</th>
</tr>
<tr>
<td>
99/99/9999
</td>
<td>
DR. WHO
</td>
<td>
BLAH BLAH BLAH BLAH
</td>
<td>
BLAH BLAH BLAH BLAH
</td>
<td>
</td>
<td>
</td>
<td>
0
</td>
</tr>
<tr>
<td>
99/99/9999
</td>
<td>
DR. WHO
</td>
<td>
BLAH BLAH BLAH BLAH
</td>
<td>
BLAH BLAH BLAH BLAH
</td>
<td>
BLAH BLAH BLAH BLAH
</td>
<td>
</td>
<td>
</td>
</tr>
</table>
<table id="outsidemedications">
<caption>Other Medications</caption>
<tr>
<th>Medication</th>
<th>SIG</th>
<th>Source</th>
<th>Category</th>
<th>Comments</th>
<th>Entered By</th>
<th>Date Entered</th>
</tr>
<tr>
<td colspan="7">No current medications.</td>
</tr>
</table>
<table id="tblChiefComplaints">
<caption>Chief Complaints</caption>
<tr>
<th>Category</th>
<th>Description</th>
<th>Duration</th>
</tr>
<tr>
<td>General</td>
<td>BLAH BLAH BLAH BLAH</td>
<td>BLAH BLAH BLAH BLAH</td>
</tr>
<tr>
<td>General</td>
<td>BLAH BLAH BLAH BLAH</td>
<td>BLAH BLAH BLAH BLAH</td>
</tr>
</table>
<table id="tblReviewOfSystems">
<caption>Review of Systems</caption>
<tr>
<th>Category</th>
<th>Symptom</th>
<th>Result</th>
</tr>
<tr>
<td>General</td>
<td>BLAH BLAH BLAH BLAH</td>
<td>None</td>
</tr>
<tr>
<td>Skin</td>
<td>BLAH BLAH BLAH BLAH</td>
<td>None</td>
</tr>
<tr>
<td>Eyes</td>
<td>BLAH BLAH BLAH BLAH</td>
<td>None</td>
</tr>
<tr>
<td>Ears</td>
<td>BLAH BLAH BLAH BLAH</td>
<td>None</td>
</tr>
<tr>
<td>Nose</td>
<td>BLAH BLAH BLAH BLAH</td>
<td>None</td>
</tr>
<tr>
<td>Mouth or Teeth</td>
<td>BLAH BLAH BLAH BLAH</td>
<td>None</td>
</tr>
<tr>
<td>Face or Neck</td>
<td>BLAH BLAH BLAH BLAH</td>
<td>None</td>
</tr>
<tr>
<td>Respiratory</td>
<td>BLAH BLAH BLAH BLAH</td>
<td>None</td>
</tr>
<tr>
<td>Cardio</td>
<td>BLAH BLAH BLAH BLAH</td>
<td>None</td>
</tr>
<tr>
<td>Abdomen</td>
<td>BLAH BLAH BLAH BLAH </td>
<td>None</td>
</tr>
<tr>
<td>MSLymph</td>
<td>BLAH BLAH BLAH BLAH</td>
<td>None</td>
</tr>
<tr>
<td>Neuro</td>
<td>BLAH BLAH BLAH BLAH</td>
<td>None</td>
</tr>
</table>
<table id="tblPesentIllnesses">
<caption>History of Present Illnesses</caption>
<tr>
<th>Complaint</th>
<th>Entered By</th>
<th>Time Entered</th>
</tr>
<tr>
<td>BLAH BLAH BLAH BLAH</td>
<td>Dr. Who</td>
<td>99/99/9999</td>
</tr>
<tr>
<td>BLAH BLAH BLAH BLAH</td>
<td>Dr. Who</td>
<td>99/99/9999</td>
</tr>
<tr>
<td>BLAH BLAH BLAH BLAH</td>
<td>Dr. Who</td>
<td>99/99/9999</td>
</tr>
</table>
<table id="tblFamilyIllnesses">
<caption>Family History</caption>
<tr>
<th>Relationship</th>
<th>Name</th>
<th>DOB</th>
<th>Age</th>
<th>Illness</th>
</tr>
</table>
<table id="tblWellChildHistory">
<caption>Well Child History</caption>
<tr>
<th>Dietary History</th>
<th>Physical Activity</th>
<th>Sleeping Habits</th>
<th>Bowel Habits</th>
<th>Dental Visit In Past Year</th>
<th>Exposure To Illnesses</th>
<th>Alcohol Use</th>
<th>Drug Use</th>
<th>Travel History</th>
<th>Sexual Activity</th>
<th>Entered By</th>
<th>Time Entered</th>
</tr>
<tr>
<td colspan="3">No past medical history.</td>
</tr>
</table>
<table id="tblSocialHistory">
<caption>Social History</caption>
<tr>
<th>Primary Caregiver</th>
<th>Home Status</th>
<th>Child Attends</th>
<th>School Name</th>
<th>Grade</th>
<th>School Performance</th>
<th>Entered By</th>
<th>Time Entered</th>
</tr>
<tr>
<td colspan="12">No social history entered for this visit.</td>
</tr>
</table>
<table id="tblDevelopmentalMilestones">
<caption>Developmental Milestones</caption>
<tr>
<th>Category</th>
<th>Question</th>
<th>Answer</th>
<th>Entered By</th>
<th>TimeEntered</th>
</tr>
<tr>
<td colspan="3">No developmental assessment entered.</td>
</tr>
</table>
<table id="tblDevelopmentalComments">
<caption>Developmental Comments</caption>
<tr>
<th>Comment</th>
<th>Entered By</th>
<th>TimeEntered</th>
</tr>
<tr>
<td colspan="3">No developmental comments entered.</td>
</tr>
</table>
<table id="tblHouseholdRiskFactorResponses">
<caption>Household Risk Factors</caption>
<tr>
<th>Question</th>
<th>Response</th>
<th>Comment</th>
</tr>
<tr>
<td colspan="3">No household risk factors entered for this visit.</td>
</tr>
</table>
<table id="tblFamilyBarriersResponses">
<caption>Family Barriers</caption>
<tr>
<th>Question</th>
<th>Response</th>
<th>Comment</th>
</tr>
<tr>
<td colspan="3">No household risk factors entered for this visit.</td>
</tr>
</table>
<table id="tblPHQAAssessments">
<caption>PHQ-A Assessment</caption>
<tr>
<th>Question</th>
<th>Response</th>
<th>Score</th>
</tr>
<tr>
<td colspan="3">No current assessments.</td>
</tr>
</table>
<table id="tblPatientVitals">
<caption>Vitals</caption>
<tr>
<th>Time Entered</th>
<th>Temp.</th>
<th>H.R.</th>
<th>R.R.</th>
<th>Weight</th>
<th>Height</th>
<th>BMI</th>
<th>Head Circ.</th>
<th>O2 Sat.</th>
<th>BP</th>
<th>Comments</th>
<th>Entered By</th>
</tr>
<tr>
<td>11/3/2017 2:51:00 PM</td>
<td>98.6</td>
<td>90</td>
<td>25</td>
<td>58.0000</td>
<td>0.0000</td>
<td></td>
<td>0.0000</td>
<td>0.0000</td>
<td>0/0 Sitting Sitting</td>
<td></td>
<td>Dr. Who</td>
</tr>
</table>
<ul id="ulexamdetails">
<li id="liphysicalexamheader">Physical Exam</li>
<li><span class="categorylabel">General</span></li>
<li><span class="spnormal">BLAH BLAH BLAH BLAH</span><span class="spexception"> Except: BLAH BLAH BLAH BLAH</span></li>
<li><span class="categorylabel">Skin</span></li>
<li><span class="spnormal">BLAH BLAH BLAH BLAH</span></li>
<li><span class="categorylabel">Head</span></li>
<li><span class="spnormal">BLAH BLAH BLAH BLAH</span></li>
<li><span class="categorylabel">Eyes</span></li>
<li><span class="spnormal">BLAH BLAH BLAH BLAH</span></li>
<li><span class="categorylabel">Ears</span></li>
<li><span class="spnormal">BLAH BLAH BLAH BLAH</span></li>
<li><span class="categorylabel">Nose</span></li>
<li><span class="spnormal">BLAH BLAH BLAH BLAH</span></li>
<li><span class="categorylabel">Mouth</span></li>
<li><span class="spnormal">BLAH BLAH BLAH BLAH</span><span class="spexception"> Except: BLAH BLAH BLAH BLAH</span></li>
<li><span class="categorylabel">Face Or Neck</span></li>
<li><span class="spnormal">BLAH BLAH BLAH BLAH</span></li>
<li><span class="categorylabel">Respiratory</span></li>
<li><span class="spnormal"></span></li>
<li><span class="categorylabel">Cardio</span></li>
<li>
<span class="spnormal">BLAH BLAH BLAH BLAH
</span>
</li>
<li><span class="categorylabel">Abdomen</span></li>
<li>
<span class="spnormal">BLAH BLAH BLAH BLAH
</span>
</li>
<li><span class="categorylabel">MS/Lymph</span></li>
<li><span class="spnormal">BLAH BLAH BLAH BLAH</span></li>
<li><span class="categorylabel">Neuro</span></li>
<li><span class="spnormal">BLAH BLAH BLAH BLAH</span></li>
</ul>
<table id="tblVisionResults">
<caption>Vision Results</caption>
<tr>
<th>Left Eye</th>
<th>Right Eye</th>
<th>Entered By</th>
<th>Time Entered</th>
</tr>
<tr>
<td colspan="4">No vision results this visit.</td>
</tr>
</table>
<table id="tblHearingTestResults">
<caption>Hearing Results</caption>
<tr>
<th>Frequency</th>
<th>Db Right</th>
<th>Db Left</th>
<!--
<th>Entered By</th>
<th>Time Entered</th>
-->
</tr>
<tr>
<td colspan="4">No hearing results this visit.</td>
</tr>
</table>
<table id="tblInhouseLabs">
<caption>In-house Labs</caption>
<tr>
<th>Lab</th>
<th>Lab Value</th>
<th>Comment</th>
<th>Entered By</th>
<th>Time Entered</th>
</tr>
<tr>
<td colspan="4">No in-house labs results this visit.</td>
</tr>
</table>
<table id="tblInhouseUrineResults">
<caption>In-house Urine Results</caption>
<tr>
<th>Leukocytes</th>
<th>Nitrite</th>
<th>Urobili</th>
<th>Protein</th>
<th>PH</th>
<th>Blood</th>
<th>SG</th>
<th>Ketone</th>
<th>Bilirubin</th>
<th>Glucose</th>
<th>Entered By</th>
<th>Time Entered</th>
</tr>
<tr>
<td colspan="12">No urine results this visit.</td>
</tr>
</table>
<table id="tblInOfficeCourse">
<caption>Assessment</caption>
<tr>
<th>In-Office Course</th>
<th>Entered By</th>
<th>Time Entered</th>
</tr>
<tr>
<td colspan="3">No in-office course.</td>
</tr>
</table>
<fieldset id="fldassessment">
<legend>Assessment</legend>
<table id="tbldiagnosiscodes" name="tbldiagnosiscodes"></table>
<table id="tblPatientAssessment">
<caption>Assessment</caption>
<tr>
<th>Assessment</th>
<th>Entered By</th>
<th>Time Entered</th>
</tr>
<tr>
<td>BLAH BLAH BLAH BLAH</td>
<td>Dr. Who</td>
<td>99/99/9999</td>
</tr>
</table>
<table id="tblComplianced">
<caption>Compliance</caption>
<tr>
<th>Compliance</th>
<th>Compliance Code</th>
<th>Entered By</th>
<th>Time Entered By</th>
</tr>
<tr>
<td colspan="4">No Compliance Entered This Visit.</td>
</tr>
</table>
</fieldset>
<fieldset id="fldplanofcare">
<legend>Plan of Care</legend>
<table id="tblvisitprescriptions" name="tblvisitprescriptions"></table>
<table id="tblDiagnosisCodes">
<caption>Diagnosis Codes</caption>
<tr>
<th>Code</th>
<th>Description</th>
</tr>
<tr>
<td colspan="2">No Diagnosis Codes Entered</td>
</tr>
</table>
<table id="tblCPTCodes">
<caption>CPT Codes</caption>
<tr>
<th>Code</th>
<th>Description</th>
</tr>
<tr>
<td>
99213
</td>
<td>
ESTAB. EXPANDED
</td>
</tr>
</table>
<table id="tblPrescriptionsThisVisit">
<caption>Prescriptions This Visit</caption>
<tr>
<th>Date</th>
<th>Prescribed By</th>
<th>Prescription</th>
<th>SIG</th>
<th>Route</th>
<th>Dispense</th>
<th>Refills</th>
</tr>
<tr>
<td>
99/99/9999
</td>
<td>
Dr. Who
</td>
<td>
BLAH BLAH BLAH BLAH
</td>
<td>
BLAH BLAH BLAH BLAH
</td>
<td>
</td>
<td>
</td>
<td>
0
</td>
</tr>
</table>
<table id="tblLabsOrdered">
<caption>Labs Ordered This Visit</caption>
<tr>
<th>Date</th>
<th>Test Ordered</th>
<th>Ordered By</th>
<th>Order Urgency</th>
</tr>
<tr>
<td colspan="4">No Labs Ordered This Visit.</td>
</tr>
</table>
<table id="outsidemedications">
<caption>Radiology Orders This Visit</caption>
<tr>
<th>Date</th>
<th>Test Ordered</th>
<th>Ordered By</th>
<th>Order Urgency</th>
</tr>
<tr>
<td colspan="4">No Radiology Ordered This Visit.</td>
</tr>
</table>
<table id="tblcptcodes" name="tblcptcodes"></table>
<table id="tblReferrals">
<caption>Referrals This Visit</caption>
<tr>
<th>Speciality</th>
<th>Speciality Group</th>
<th>Specialist</th>
</tr>
<tr>
<td colspan="4">No Referrals This Visit.</td>
</tr>
</table>
<div id="divplanofcare">
<ul id="ulcareplanlist">
<li>BLAH BLAH BLAH BLAH</li>
</ul>
</div>
</fieldset>
</div>
<!--End of body-->
<footer class="onlyprint">
<ul>
<li>Tom Testcase</li>
<li>99/99/9999</li>
</ul>
</footer>
</body>
I'm not exactly sure how to implement the CSS to make sure the page contents don't overwrite the footer. Also, since many of the elements on the page are tables that may expand, do you have to have some advance knowledge of how much data is in these element on where to use page break? Would someone please help me get started? Thanks.

An example of setting up your document with headers, footers and page breaks with CSS:
Page set up
#page {
size: A4 portrait;
margin-left: 0.5cm;
margin-right: 0.5cm;
background: #FFF;
}
Headers
#page {
#top-left {
margin: 10pt 0 10pt 10pt;
border-top: .25pt solid #666;
font-size: 9pt;
color: #FFF;
}
#top-center {
margin: 10pt 10pt 10pt 0;
border-top: .25pt solid #666;
font-size: 9pt;
color: #FFF;
}
#top-right {
margin: 10pt 10pt 10pt 0;
border-top: .25pt solid #666;
font-size: 9pt;
color: #FFF;
}
}
Footers
#page {
#bottom-left {
margin: 10pt 0 10pt 10pt;
border-top: .25pt solid #666;
font-size: 9pt;
color: #FFF;
}
#bottom-center {
margin: 10pt 10pt 10pt 0;
border-top: .25pt solid #666;
font-size: 9pt;
color: #FFF;
}
#bottom-right {
margin: 10pt 10pt 10pt 0;
border-top: .25pt solid #666;
font-size: 9pt;
color: #FFF;
content: "Page " counter(page) " of " counter(pages); /* Add if you need page numbers */
}
}
Page breaks
Use page-break-before, page-break-after, and page-break-inside on your elements to set up appropriate page breaks.
Additional reading
https://www.w3.org/TR/css3-page/
https://developer.mozilla.org/en-US/docs/Web/CSS/Paged_Media
Update by Bruno Lowagie
The above anwer is correct, but incomplete. It explains how to define headers and footers in HTML, but doesn't explain how to create a PDF with those headers and footers. Fortunately, this requires only a single line of code.
See the HTML to PDF tutorial. In Chapter 2: defining styles and CSS, there's a section named Adding "Page X of Y" using an #page rule that shows how the #page rule works in combination with the pdfHTML add-on for iText 7.
All you need to do, is write this line of code:
HtmlConverter.ConvertToPdf(src, dest);
where src is the source (a HTML file) and dest is the destination (a PDF file).

First of all: we no longer talk about iTextSharp. iTextSharp was renamed to iText for .NET. The current version is iText 7.
Adding headers and footers is explained in chapter 3 of the iText 7 Jump-Start Tutorial for .NET:
First, you need to create an implementation of the IEventHandler interface, for example:
protected internal class MyEventHandler : IEventHandler {
public virtual void HandleEvent(Event #event) {
PdfDocumentEvent docEvent = (PdfDocumentEvent)#event;
PdfDocument pdfDoc = docEvent.GetDocument();
PdfPage page = docEvent.GetPage();
int pageNumber = pdfDoc.GetPageNumber(page);
Rectangle pageSize = page.GetPageSize();
PdfCanvas pdfCanvas = new PdfCanvas(page.NewContentStreamBefore(), page.GetResources(), pdfDoc);
//Set background
Color limeColor = new DeviceCmyk(0.208f, 0, 0.584f, 0);
Color blueColor = new DeviceCmyk(0.445f, 0.0546f, 0, 0.0667f);
pdfCanvas.SaveState()
.SetFillColor(pageNumber % 2 == 1 ? limeColor : blueColor)
.Rectangle(pageSize.GetLeft(), pageSize.GetBottom(), pageSize.GetWidth(), pageSize.GetHeight())
.Fill()
.RestoreState();
//Add header and footer
pdfCanvas.BeginText()
.SetFontAndSize(C03E03_UFO.helvetica, 9)
.MoveText(pageSize.GetWidth() / 2 - 60, pageSize.GetTop() - 20)
.ShowText("THE TRUTH IS OUT THERE")
.MoveText(60, -pageSize.GetTop() + 30)
.ShowText(pageNumber.ToString())
.EndText();
//Add watermark
iText.Layout.Canvas canvas = new iText.Layout.Canvas(pdfCanvas, pdfDoc, page.GetPageSize());
canvas.SetProperty(Property.FONT_COLOR, Color.WHITE);
canvas.SetProperty(Property.FONT_SIZE, 60);
canvas.SetProperty(Property.FONT, C03E03_UFO.helveticaBold);
canvas.ShowTextAligned(new Paragraph("CONFIDENTIAL"), 298, 421, pdfDoc.GetPageNumber(page), TextAlignment.
CENTER, VerticalAlignment.MIDDLE, 45);
pdfCanvas.Release();
}
}
In the event handler above, we set a back ground, add a header and a footer, add a watermark. That's more than you need, but feel free to adapt.
Once you have this implementation, you can declare it as an event handler for a specific PdfDocument instance:
PdfDocument pdf = new PdfDocument(new PdfWriter(dest));
pdf.AddEventHandler(PdfDocumentEvent.END_PAGE, new MyEventHandler(this));
For the full example, see C03E03_UFO.cs.

Related

Perl XML::LibXML XPath 2.0 to XPath 1.0

I have the following XPath that works fine in XPath 2.0 (as tested in OxygenXML):
//h2[a[#id='start']]/following-sibling::*[not(preceding-sibling::*[self::div[#id='end']])]
but I'm getting different results when I use it with LibXML findnodes():
my #nodes = $source_doc->findnodes('//h2[a[#id="start"]]/following-sibling::*[not(preceding-sibling::*[self::div[#id="end"]])]');
After checking the LibXML documentation, it seems that LibXML supports XPath 1.0 only. How would I go about changing my XPath to something that works with XPath 1.0? Is it even possible to create a compatible path like this in XPath 1.0?
Since I've been asked to provide, I'm updating the post to include my sample data and the output I'm getting when I run the XPath I entered above:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="insn.css" />
<meta name="generator" content="encodingindex.xsl" />
<title>Index by Encoding</title>
</head>
<body><hr /><h1 class="topleveltable"><a name="top" id="top"></a>Top-level encodings</h1><div
class="regdiagram-32"></div><hr /><h2><a name="dp" id="start"></a>Data-processing and
miscellaneous instructions</h2><div class="decode_navigation">
<p>These instructions are under the top-level.</p>
</div><div class="regdiagram-32">
<table class="regdiagram">
<thead>
<tr>
<td>31</td>
<td>0</td>
</tr>
</thead>
<tbody>
<tr class="firstrow">
<td colspan="4" class="lr">!= 1111</td>
<td colspan="2" class="lr">00</td>
<td class="lr">op0</td>
<td colspan="5" class="lr">op1</td>
<td colspan="12" class="lr"></td>
<td class="lr">op2</td>
<td colspan="2" class="lr">op3</td>
<td class="lr">op4</td>
<td colspan="4" class="lr"></td>
</tr>
</tbody>
</table>
</div><div class="instructiontable">
<table class="instructiontable">
<tr>
<th colspan="5">Decode fields</th>
<th rowspan="2"> Instruction details </th>
</tr>
<tr>
<th class="bitfields">op0</th>
<th class="bitfields">op1</th>
<th class="bitfields">op2</th>
<th class="bitfields">op3</th>
<th class="bitfields">op4</th>
</tr>
<tr class="instructiontable">
<td class="bitfield"> 0 </td>
<td class="bitfield"> </td>
<td class="bitfield"> 1 </td>
<td class="bitfield"> != 00 </td>
<td class="bitfield"> 1 </td>
<td class="iformname">Extra load/store</td>
</tr>
<tr class="instructiontable">
<td class="bitfield"> 0 </td>
<td class="bitfield"> 0xxxx </td>
<td class="bitfield"> 1 </td>
<td class="bitfield"> 00 </td>
<td class="bitfield"> 1 </td>
<td class="iformname">Multiply and Accumulate</td>
</tr>
</table>
</div><hr /><h2><a name="sync" id="sync"></a>Synchronization primitives and
Load-Acquire/Store-Release</h2><div class="decode_navigation">
<p>These instructions are under <a href="#dp">Data-processing and miscellaneous
instructions</a>.</p>
</div><div class="regdiagram-32">
<table class="regdiagram">
<thead>
<tr>
<td>31</td>
<td>0</td>
</tr>
</thead>
<tbody>
<tr class="firstrow">
<td colspan="4" class="lr">!= 1111</td>
<td colspan="4" class="lr">0001</td>
<td class="lr">op0</td>
<td colspan="11" class="lr"></td>
<td colspan="2" class="lr">11</td>
<td colspan="2" class="lr"></td>
<td colspan="4" class="lr">1001</td>
<td colspan="4" class="lr"></td>
</tr>
</tbody>
</table>
</div><hr /><hr /><h2><a name="dpmisc" id="dpmisc"></a>Miscellaneous</h2><div
class="decode_navigation">
<p>These instructions are under <a href="#dp">Data-processing and miscellaneous
instructions</a>.</p>
</div><div class="regdiagram-32">
<table class="regdiagram">
<thead>
<tr>
<td>31</td>
<td>30</td>
<td>0</td>
</tr>
</thead>
<tbody>
<tr class="firstrow">
<td colspan="4" class="lr">!= 1111</td>
<td colspan="5" class="lr">00010</td>
<td colspan="2" class="lr">op0</td>
<td colspan="1" class="lr">0</td>
<td colspan="12" class="lr"></td>
<td colspan="1" class="lr">0</td>
<td colspan="3" class="lr">op1</td>
<td colspan="4" class="lr"></td>
</tr>
</tbody>
</table>
</div><div class="instructiontable">
<table class="instructiontable">
<tr>
<th colspan="2">Decode fields</th>
<th rowspan="2"> Instruction details </th>
</tr>
<tr>
<th class="bitfields">op0</th>
<th class="bitfields">op1</th>
</tr>
<tr class="instructiontable">
<td class="bitfield"> 01 </td>
<td class="bitfield"> 010 </td>
<td class="iformname">BXJ</td>
</tr>
<tr class="instructiontable">
<td class="bitfield"> 01 </td>
<td class="bitfield"> 011 </td>
<td class="iformname">BLX (register)</td>
</tr>
</table>
</div><div class="decode_navigation">
<p>These instructions are under <a href="#dp">Data-processing and miscellaneous
instructions</a>.</p>
</div><div class="regdiagram-32">
<table class="regdiagram">
<thead>
<tr>
<td>31</td>
<td>30</td>
<td>0</td>
</tr>
</thead>
<tbody>
<tr class="firstrow">
<td colspan="4" class="lr">!= 1111</td>
<td colspan="3" class="lr">000</td>
<td colspan="2" class="lr">op0</td>
<td colspan="2" class="lr"></td>
<td class="lr">op1</td>
<td colspan="15" class="lr"></td>
<td colspan="1" class="lr">0</td>
<td colspan="4" class="lr"></td>
</tr>
</tbody>
</table>
</div><div class="decode_constraints">
<p> The following constraints also apply to this encoding: op0:op1 != 100 </p>
</div><div class="instructiontable">
<table class="instructiontable">
<tr>
<th colspan="2">Decode fields</th>
<th rowspan="2"> Instruction details </th>
</tr>
<tr>
<th class="bitfields">op0</th>
<th class="bitfields">op1</th>
</tr>
<tr class="instructiontable">
<td class="bitfield"> 0x </td>
<td class="bitfield"> </td>
<td class="iformname"><a href="#intdp3reg_immsh">Integer Data Processing (three register,
immediate shift)</a></td>
</tr>
<tr class="instructiontable">
<td class="bitfield"> 10 </td>
<td class="bitfield"> 1 </td>
<td class="iformname"><a href="#intdp2reg_immsh">Integer Test and Compare (two register,
immediate shift)</a></td>
</tr>
<tr class="instructiontable">
<td class="bitfield"> 11 </td>
<td class="bitfield"> </td>
<td class="iformname"><a href="#logic3reg_immsh">Logical Arithmetic (three register,
immediate shift)</a></td>
</tr>
</table>
</div><hr /><div class="iclass" id="intdp3reg_immsh">
<a name="intdp3reg_immsh" id="intdp3reg_immsh"></a>
<h3 class="iclass">Integer Data Processing (three register, immediate shift)</h3>
<p>These instructions are under <a href="#dpregis">Data-processing register (immediate
shift)</a>.</p>
<div class="regdiagram-32">
<table class="regdiagram">
<thead>
<tr>
<td>31</td>
<td>0</td>
</tr>
</thead>
<tbody>
<tr class="firstrow">
<td colspan="4" class="lr">!= 1111</td>
<td class="l">0</td>
<td>0</td>
<td>0</td>
<td class="r">0</td>
<td colspan="3" class="lr">opc</td>
<td class="lr">S</td>
<td colspan="4" class="lr">Rn</td>
<td colspan="4" class="lr">Rd</td>
<td colspan="5" class="lr">imm5</td>
<td colspan="2" class="lr">type</td>
<td class="lr">0</td>
<td colspan="4" class="lr">Rm</td>
</tr>
<tr class="secondrow">
<td colspan="4" class="droppedname">cond</td>
<td colspan="4"></td>
<td colspan="3"></td>
<td></td>
<td colspan="4"></td>
<td colspan="4"></td>
<td colspan="5"></td>
<td colspan="2"></td>
<td></td>
<td colspan="4"></td>
</tr>
</tbody>
</table>
</div>
<div class="decode_constraints">
<p> The following constraints also apply to this encoding: cond != 1111 && cond !=
1111 </p>
</div>
<div class="instructiontable">
<table class="instructiontable" id="intdp3reg_immsh">
<thead class="instructiontable">
<tr>
<th class="bitfields-heading" rowspan="" colspan="3">Decode fields</th>
<th class="iformname" rowspan="2" colspan=""> Instruction Details </th>
</tr>
<tr>
<th class="bitfields" rowspan="" colspan="">opc</th>
<th class="bitfields" rowspan="" colspan="">S</th>
<th class="bitfields" rowspan="" colspan="">Rn</th>
</tr>
</thead>
<tbody>
<tr>
<td class="bitfield">000</td>
<td class="bitfield"></td>
<td class="bitfield"></td>
<td class="iformname"><a name="AND_r" href="and_r.html" id="AND_r">AND, ANDS
(register)</a></td>
</tr>
<tr>
<td class="bitfield">001</td>
<td class="bitfield"></td>
<td class="bitfield"></td>
<td class="iformname"><a name="EOR_r" href="eor_r.html" id="EOR_r">EOR, EORS
(register)</a></td>
</tr>
</tbody>
</table>
</div>
</div><div class="decode_constraints">
<p> The following constraints also apply to this encoding: op0:op1 != 100 </p>
</div><div class="instructiontable">
<table class="instructiontable">
<tr>
<th colspan="2">Decode fields</th>
<th rowspan="2"> Instruction details </th>
</tr>
<tr>
<th class="bitfields">op0</th>
<th class="bitfields">op1</th>
</tr>
<tr class="instructiontable">
<td class="bitfield"> 0x </td>
<td class="bitfield"> </td>
<td class="iformname"><a href="#intdp3reg_regsh">Integer Data Processing (three register,
register shift)</a></td>
</tr>
<tr class="instructiontable">
<td class="bitfield"> 10 </td>
<td class="bitfield"> 1 </td>
<td class="iformname"><a href="#intdp2reg_regsh">Integer Test and Compare (two register,
register shift)</a></td>
</tr>
</table>
</div><hr /><h2><a name="dpimm" id="dpimm"></a>Data-processing immediate</h2><div
class="decode_navigation">
<p>These instructions are under <a href="#dp">Data-processing and miscellaneous
instructions</a>.</p>
</div><div class="regdiagram-32">
<table class="regdiagram">
<thead>
<tr>
<td>31</td>
<td>0</td>
</tr>
</thead>
<tbody>
<tr class="firstrow">
<td colspan="4" class="lr">!= 1111</td>
<td colspan="3" class="lr">001</td>
<td colspan="2" class="lr">op0</td>
<td colspan="1" class="lr"></td>
<td colspan="2" class="lr">op1</td>
<td colspan="20" class="lr"></td>
</tr>
</tbody>
</table>
</div><div class="instructiontable">
<table class="instructiontable">
<tr>
<th colspan="2">Decode fields</th>
<th rowspan="2"> Instruction details </th>
</tr>
<tr>
<th class="bitfields">op0</th>
<th class="bitfields">op1</th>
</tr>
<tr class="instructiontable">
<td class="bitfield"> 0x </td>
<td class="bitfield"> </td>
<td class="iformname"><a href="#intdp2reg_imm">Integer Data Processing (two register and
immediate)</a></td>
</tr>
</table>
</div><hr /><div class="iclass" id="intdp2reg_imm">
<a name="intdp2reg_imm" id="intdp2reg_imm"></a>
</div><div class="iclass" id="end">
<a name="ldstimm" id="ldstimm"></a>
<h3 class="iclass">Load/Store Word, Unsigned Byte (immediate, literal)</h3>
<div class="regdiagram-32">
<table class="regdiagram">
<thead>
<tr>
<td>31</td>
<td>0</td>
</tr>
</thead>
<tbody>
<tr class="firstrow">
<td colspan="4" class="lr">!= 1111</td>
<td class="l">0</td>
<td>1</td>
<td class="r">0</td>
<td class="lr">P</td>
<td class="lr">U</td>
<td class="lr">o2</td>
<td class="lr">W</td>
<td class="lr">o1</td>
<td colspan="4" class="lr">Rn</td>
<td colspan="4" class="lr">Rt</td>
<td colspan="12" class="lr">imm12</td>
</tr>
<tr class="secondrow">
<td colspan="4" class="droppedname">cond</td>
<td colspan="3"></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td colspan="4"></td>
<td colspan="4"></td>
<td colspan="12"></td>
</tr>
</tbody>
</table>
</div>
<div class="decode_constraints">
<p> The following constraints also apply to this encoding: cond != 1111 && cond !=
1111 </p>
</div>
<div class="instructiontable">
<table class="instructiontable" id="ldstimm">
<thead class="instructiontable">
<tr>
<th class="bitfields-heading" rowspan="" colspan="4">Decode fields</th>
<th class="iformname" rowspan="2" colspan=""> Instruction Details </th>
</tr>
<tr>
<th class="bitfields" rowspan="" colspan="">P:W</th>
<th class="bitfields" rowspan="" colspan="">o2</th>
<th class="bitfields" rowspan="" colspan="">o1</th>
<th class="bitfields" rowspan="" colspan="">Rn</th>
</tr>
</thead>
<tbody>
<tr>
<td class="bitfield">!= 01</td>
<td class="bitfield">0</td>
<td class="bitfield">1</td>
<td class="bitfield">1111</td>
<td class="iformname"><a name="LDR_l" href="ldr_l.html" id="LDR_l">LDR
(literal)</a></td>
</tr>
<tr>
<td class="bitfield">!= 01</td>
<td class="bitfield">1</td>
<td class="bitfield">1</td>
<td class="bitfield">1111</td>
<td class="iformname"><a name="LDRB_l" href="ldrb_l.html" id="LDRB_l">LDRB
(literal)</a></td>
</tr>
</tbody>
</table>
</div>
</div></body>
</html>
Here's the output using the XPath given above:
<div class="decode_navigation">
<p>These instructions are under the top-level.</p>
</div>
Just to clarify, the output should include all of the divs in the sample HTML, about 400 lines in total.
I've also tried the XPath suggestions I've been given below, but they produced the same results.
Edit: Here's my code:
use strict;
use warnings;
use feature 'say';
use XML::LibXML;
my $encoding_index_file = q(C:\path\to\testfile.html);
my $source_doc = XML::LibXML->load_html(
location => $encoding_index_file,
recover => 1,
suppress_errors => 1,
);
my ($node) = $source_doc->findnodes('//h2[a[#id="start"]]/following-sibling::*[not(preceding-sibling::div[#id="end"])]');
say $node->toString;
Not only does that XPath conform to XPath 1.0, it works correctly in XML::LibXML.
use strict;
use warnings qw( all );
use feature qw( say );
use XML::LibXML qw( );
my $doc = XML::LibXML->new->parse_html_string(<<'__EOS__');
<html>
<h2><a id="start">Foo</a></h2>
<div id="pre1"><img></div>
<div id="pre2"><img></div>
<div id="end"><img></div>
<div id="post1"><img></div>
<div id="post2"><img></div>
</html>
__EOS__
# Select all the siblings of the starting h2 element that follow
# it and don't have <div id="end"/> as a preceding sibling.
for my $node ($doc->findnodes('//h2[a[#id="start"]]/following-sibling::*[not(preceding-sibling::*[self::div[#id="end"]])]')) {
my $name = $node->nodeName;
my $id = $node->getAttribute('id');
say $id ? sprintf("%s#%s", $name, $id) : $name;
}
Output:
div#pre1
div#pre2
div#end
By the way,
//h2[a[#id="start"]]/following-sibling::*[not(preceding-sibling::*[self::div[#id="end"]])]
is a weird way of writing
//h2[a[#id="start"]]/following-sibling::*[not(preceding-sibling::div[#id="end"])]
Maybe you wanted
//h2[a[#id="start"]]/following-sibling::*[not(self::div[#id="end"] or preceding-sibling::div[#id="end"])]
That would produce the following output:
div#pre1
div#pre2
I managed to get to the bottom of what was causing the problem: Every sibling found by the XPath is handled by LibXML as a separate node, so I needed to assign them to an array, not a simple scalar as I was doing. The not-weird XPath suggested by ikegami was also better than the one I was using, as mine was doubling up everything in the output.
Here's the code that produces the correct results:
use strict;
use warnings;
use feature 'say';
use XML::LibXML qw( );
my $encoding_index_file = q(C:\path\to\testfile.html);
my $source_doc = XML::LibXML->load_html(
location => $encoding_index_file,
recover => 1,
suppress_errors => 1,
);
my $contents = "";
my #nodes = $source_doc->findnodes('//h2[a[#id="start"]]/following-sibling::[not(preceding-sibling::div[#id="end"])]');
foreach my $node (#nodes) {
my ($str) = $node->toString;
$contents = $contents . $str;
}
print $contents;

Cannot read the table elements in Protractor

Trying to read the following table.
<div class="well" style="background-color: #fff;">
<table class="table table-bordered table-striped table-condensed">
<tbody><tr>
<td style="width: 20%; vertical-align: middle">
<span class="label label-primary">Field0</span>
</td>
<td>Value0</td>
</tr>
<tr>
<td style="width: 120px;">Field1</td>
<td>Value1</td>
</tr>
<tr>
<td><strong>Field2</strong></td>
<td>Value2</td>
</tr>
</tbody>
</table>
</div>
However, I am stuck when I am trying to get each of the values individually.
"return $$('.well').get(0).all(by.tagName('td')).get(0).getText();"

Magento order email missing style

I have a question regarding the magento order emails.
I have created my own order template by loading the default template and modifying it. When i take a look via the 'preview template' button on there, the email appears without order information (of course) but with every styling etc.
However when my customer gets the email it is pure text with no styling at all.
What could i have been doing wrong
Idk if it helps but here is my email template:
{{template config_path="design/email/header"}}
{{inlinecss file="email-inline.css"}}
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td style='background: #fff' class="email-heading">
<h1 style='color: #68883e;'>Thank you for your order</h1>
<p>Your order is being process right now</p>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="order-details">
<h3 style='display: inline; float: left'>Your order <span class="no-link">#{{var order.increment_id}}</span></h3>
<p style='display: inline; float: right'>Placed on {{var order.getCreatedAtFormated('long')}}</p>
</td>
</tr>
<tr class="order-information">
<td>
{{if order.getEmailCustomerNote()}}
<table cellspacing="0" cellpadding="0" class="message-container">
<tr>
<td>{{var order.getEmailCustomerNote()}}</td>
</tr>
</table>
{{/if}}
{{layout handle="sales_email_order_items" order=$order}}
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="address-details">
<h6>Bill to:</h6>
<p><span class="no-link">{{var order.getBillingAddress().format('html')}}</span></p>
</td>
<td class="address-details">
<h6>Client:</h6>
<p><span class="no-link">{{var order.getclientfirstname().format('html')}}</span></p>
</td>
</tr>
<tr>
{{depend order.getIsNotVirtual()}}
<td class="method-info">
<h6>Shipping method:</h6>
<p>{{var order.shipping_description}}</p>
</td>
{{/depend}}
<td class="method-info">
<h6>Payment method:</h6>
{{var payment_html}}
</td>
</tr>
</table>
</td>
</tr>
</table><!-- asd-->
{{layout handle="sales_email_order_items" order=$order}}
{{template config_path="design/email/footer"}}
You shouldn't use the CSS classes to stylize the templates.
Also, you shouldn't use the file with the styles info, that is located anywhere else, as they are not supported by the majority of the email services.
Instead, you can directly use the attribute tags (to implement the stylazation) or use the styles right in the email code (using the tag <style>)
And here is the list of tags you can use:
https://www.campaignmonitor.com/css/

zurb ink email wrapper doesnt span across full width

I'm having issues with Zurb Ink's email. So it looks fine in desktop, however it there is this gap when it hits the media queries and it seems to be doing it with the containers when its stacked on top of each other. I want it to span the whole width.
http://i.stack.imgur.com/xygNK.png
Here is my code:
<table class="container" id="hero-container">
<!-- hero logo -->
<tr>
<td>
<table class="row">
<tr>
<td class="wrapper last">
<table class="twelve columns">
<tr>
<td id="hero-logo"><img id="logoImage" src="images/hero-logo.png" alt="Hero In The News" /></td>
<td class="expander"></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<!-- /hero logo -->
<!-- hero image -->
<tr>
<td>
<table class="row">
<tr>
<td class="wrapper last">
<table class="twelve columns">
<tr>
<td><img id="headerImage" src="images/hero-img.png" alt="City of San Jose - Capital of Silicon Valley" /></td>
<td class="expander"></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<!-- /hero image -->
<!-- hero main article -->
<tr>
<td>
<table class="row">
<tr>
<td>
<div class="wrapper last">
<table class="twelve columns">
<tr>
<td class="heading1 text-pad">Residents can Pace Energy Use <br/>with New Program</td>
<td class="expander"></td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table class="row">
<tr>
<td>
<div class="wrapper last">
<table class="twelve columns">
<tr>
<td class="text-pad"><p>The city of San Jose has implemented a program to help residents pace their water and energy consumption. </p></td>
<td class="expander"></td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</td>
</tr>
<!-- button -->
<tr>
<td>
<table class="row">
<tr>
<td>
<div class="wrapper last">
<table class="twelve columns">
<tr>
<td class="text-pad link"><p>Read Full Article</p></td>
<td class="expander"></td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</td>
</tr>
<!--/button -->
<!-- /hero main article -->
</table>
<!-- articles row 1 -->
<table class="container">
<tr>
<td>
<table class="row">
<tr>
<td class="wrapper">
<table class="six columns article">
<tr>
<td class="text-pad">
<h2>Energy Efficiency Program Ushers Green Jobs into Kern</h2>
<p>The green economy has arrived in Kern County, and not a moment...</p>
</td>
<td class="expander"></td>
</tr>
</table>
</td>
<td class="wrapper last">
<table class="six columns article">
<tr>
<td class="text-pad">
<h2>Stockton Gets a New “HERO”</h2>
<p>From insulation to more efficient air conditioning to solar panels to...</p>
</td>
<td class="expander"></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- /articles row 1-->
<!-- articles row 2 -->
<table class="container article-container">
<tr>
<td>
<table class="row">
<tr>
<td class="wrapper article-wrapper">
<table class="six columns article">
<tr>
<td class="text-pad">
<h2>Fresno estimates $56M from HERO program</h2>
<p>Officials with the City of Fresno expect to see more than $56 M...</p>
</td>
<td class="expander"></td>
</tr>
</table>
</td>
<td class="wrapper last article-wrapper-last">
<table class="six columns article">
<tr>
<td class="text-pad">
<h2>Lompoc City Council approves HERO Program</h2>
<p>A new program that helps homeowners make energy and...</p>
</td>
<td class="expander"></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
Caveat: I am new to Ink myself. What "jumps out" at me is that you're using a container on the outside and multiple rows inside. For full width, swap the row and container classes --> so that the table with class row contains a table with class container.

Jquery parent child selectors

I have the html structure below and I'm trying to select the row containing the text 'Related list item:'.
My Jquery is below:
$('#WebPartWPQ3 > table(eq:2) > tbody > tr > td > table > tbody > tr:last').remove();
but not working...
<DIV id="WebPartWPQ3" fixed_bound allowDelete="false" OnlyForMePart="true" HasPers="true" WebPartID="00000000-0000-0000-0000-000000000000" width="100%">
<TABLE cellSpacing="0" cellPadding="4" width="100%" border="0" fixed_bound xmlns:ddwrt2="urn:frontpage:internal" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:dsp="http://schemas.microsoft.com/sharepoint/dsp" xmlns:x="http://www.w3.org/2001/XMLSchema">
<TBODY fixed_bound>
<TR fixed_bound>
<TD class="ms-vb" fixed_bound>
</TD>
</TR>
</TBODY>
</TABLE>
<TABLE width="100%" border="0" fixed_bound xmlns:ddwrt2="urn:frontpage:internal" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:dsp="http://schemas.microsoft.com/sharepoint/dsp" xmlns:x="http://www.w3.org/2001/XMLSchema">
<TBODY fixed_bound>
<TR fixed_bound>
<TD fixed_bound>
<TABLE cellSpacing="0" width="100%" border="0" fixed_bound>
<TBODY fixed_bound>
<TR fixed_bound>
<TD class="ms-formlabel" vAlign="top" noWrap width="25%" fixed_bound>
<B fixed_bound>Title:
</B>
</TD>
<TD class="ms-formbody" vAlign="top" width="75%" fixed_bound>Employee annual leave approval
<BR fixed_bound/>
<BR fixed_bound/>
</TD>
</TR>
<TR fixed_bound>
<TD class="ms-formlabel" width="25%" fixed_bound>
<B fixed_bound>Approved Carry Forward days
<SPAN class="ms-formvalidation" fixed_bound> *
</SPAN>:
</B>
</TD>
<TD class="ms-formbody" width="75%" fixed_bound>
<SPAN fixed_bound>
<INPUT class="ms-input" id="ctl00_PlaceHolderMain_TaskForm_ff1_1_ctl00_ctl00_TextField" title="Approved Carry Forward days" style="IME-MODE: inactive" size="11" name="ctl00$PlaceHolderMain$TaskForm$ff1_1$ctl00$ctl00$TextField" fixed_bound value=""/>
<BR fixed_bound/>
</SPAN>
</TD>
</TR>
<TR fixed_bound>
<TD class="ms-formlabel" width="25%" fixed_bound>
<B fixed_bound>Review Comments:
</B>
</TD>
<TD class="ms-formbody" width="75%" fixed_bound>
<SPAN fixed_bound>
<TEXTAREA class="ms-long" id="ctl00_PlaceHolderMain_TaskForm_ff2_1_ctl00_ctl00_TextField" title="Review Comments" name="ctl00$PlaceHolderMain$TaskForm$ff2_1$ctl00$ctl00$TextField" rows="5" fixed_bound>
</TEXTAREA>
<BR fixed_bound/>
</SPAN>
</TD>
</TR>
<TR fixed_bound>
<TD class="ms-formlabel" vAlign="top" noWrap width="25%" fixed_bound>
<B fixed_bound>Related list item:
</B>
</TD>
<TD class="ms-formbody" vAlign="top" width="75%" fixed_bound>
<A href="http://orange.extra.net/people/hr/Workflows/Expire%20the%20employee%20year%20in%20a%20year/" fixed_bound>
</A>
</TD>
</TR>
</TBODY>
</TABLE>
</TD>
</TR>
</TBODY>
</TABLE>
<TABLE cellSpacing="0" cellPadding="4" width="100%" border="0" fixed_bound xmlns:ddwrt2="urn:frontpage:internal" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:dsp="http://schemas.microsoft.com/sharepoint/dsp" xmlns:x="http://www.w3.org/2001/XMLSchema">
<TBODY fixed_bound>
<TR fixed_bound>
<TD class="ms-vb" noWrap fixed_bound>
<INPUT style="DISPLAY: none" onclick="javascript: __doPostBack('ctl00$PlaceHolderMain$TaskForm','__update;__commit;__redirectsource;__redirectToList={};')" type="button" name="btnSave" fixed_bound jQuery1291028280448="3" value="Save Draft"/>
</TD>
<TD fixed_bound>
<INPUT onclick="javascript: __doPostBack('ctl00$PlaceHolderMain$TaskForm','__update;__workflowTaskComplete={0*};__commit;__redirectsource;__redirectToList={};')" type="button" name="btnMarkSubmited" fixed_bound value="Complete Task"/>
</TD>
<TD class="ms-vb" noWrap width="99%" fixed_bound>
<INPUT onclick="javascript: __doPostBack('ctl00$PlaceHolderMain$TaskForm','__cancel;__redirectsource;__redirectToList={};')" type="button" name="btnCancel" fixed_bound value="Cancel"/>
</TD>
</TR>
</TBODY>
</TABLE>
</DIV>
$('.ms-formlabel').last().children().remove();
I prefer to give an id to the tr and remove the tr by id.
$('#trid').remove();
$('#WebPartWPQ3').find('Related list item').closest('tr').remove();