How to resize html content so it will fit in A4 pdf? - itext

Having issue with setting content to A4 pdf because of it size. Things i've tried : overflow-wrap,word-wrap ,custom customSplitCharacter class,setting max width of html,table,body. Are there any ideas how to set pdf size so table will automatically fit into it (without scrolling)? My itext dependencies: itext7-core(7.1.13), html2pdf (3.0.2),itextpdf(5.5.13.2)
Pdfview:
Htmlview:
public byte[] testingGetPDFInByte() {
String html = new String(testing('', 1, 1,
Collections.emptyList()).toByteArray());
ByteArrayOutputStream baos = new ByteArrayOutputStream();
WriterProperties writerProperties = new WriterProperties();
writerProperties.addXmpMetadata();
PdfWriter pdfWriter = new PdfWriter(baos, writerProperties);
PdfDocument pdfDoc = new PdfDocument(pdfWriter);
pdfDoc.setDefaultPageSize(PageSize.A4);
FontProvider fontProvider = new DefaultFontProvider(true, true, false);
genDocConfigProperties.getFontPaths().forEach(fontProvider::addFont);
ConverterProperties props = new ConverterProperties();
props.setFontProvider(fontProvider);
props.setImmediateFlush(false);
final com.itextpdf.layout.Document document = HtmlConverter.convertToDocument(html, pdfDoc, props);
document.flush();
document.close();
return baos.toByteArray();
}
Table part of html:
<xsl:variable name="stl" select="'border:1px solid black;padding:5px;page-break-inside:avoid;max-width:30px;word-wrap: break-word;vertical-align:top;'" />
<table style="border-collapse: collapse;margin:5px;table-layout: fixed;">
<tr style="{$stl}">
<td style="{$stl}" rowspan="2">
<span style="font-weight: bold;">№</span>
</td>
<td style="{$stl}" rowspan="2">
<span style="font-weight: bold;">Дата прибытия</span>
</td>
<td style="{$stl}" rowspan="2">
<span style="font-weight: bold;">Станция отправления</span>
</td>
<td style="{$stl}" colspan="3">
<span style="font-weight: bold;">СС</span>
</td>
<td style="{$stl}" rowspan="2">
<span style="font-weight: bold;">Дата отправления</span>
</td>
<td style="{$stl}" rowspan="2">
<span style="font-weight: bold;">Станция отправления</span>
</td>
<td style="{$stl}" rowspan="2">
<span style="font-weight: bold;">Код операции</span>
</td>
<td style="{$stl}" colspan="3">
<span style="font-weight: bold;">Пассажир</span>
</td>
<td style="{$stl}" rowspan="2">
<span style="font-weight: bold;">Стоимость места</span>
</td>
<td style="{$stl}" rowspan="2">
<span style="font-weight: bold;">Номер места</span>
</td>
<td style="{$stl}" rowspan="2">
<span style="font-weight: bold;">Номер и тип привилегии</span>
</td>
<td style="{$stl}" rowspan="2">
<span style="font-weight: bold;">Дата продажи</span>
</td>
<td style="{$stl}" rowspan="2">
<span style="font-weight: bold;">Терминал</span>
</td>
<td style="{$stl}" rowspan="2">
<span style="font-weight: bold;">Билет</span>
</td>
<td style="{$stl}" rowspan="2">
<span style="font-weight: bold;">№ поезда</span>
</td>
<td style="{$stl}" rowspan="2">
<span style="font-weight: bold;">№ вагона</span>
</td>
</tr>
<tr style="{$stl}">
<td style="{$stl}">
<span style="font-weight: bold;">Код</span>
</td>
<td style="{$stl}">
<span style="font-weight: bold;">Описание</span>
</td>
<td style="{$stl}">
<span style="font-weight: bold;">Продажа</span>
</td>
<td style="{$stl}">
<span style="font-weight: bold;">ФИО</span>
</td>
<td style="{$stl}">
<span style="font-weight: bold;">Тип документа</span>
</td>
<td style="{$stl}">
<span style="font-weight: bold;">№ документа</span>
</td>
</tr>
<xsl:for-each select="responseTikets">
<tr style="{$stl}">
<td style="{$stl}">
<xsl:value-of select="position()" />
</td>

There may be several ways of solving your issue:
Try to set specified properties for in html file.
Try to use the proposed code below to suit html table in pdf with A4 page size. Here the table is scaled and put as formXObject in Canvas and fitted into rectangle with set size. So if table width increase, it should be scaled and fit the pdf page size.
try (InputStream is = FileUtil.getInputStreamForFile(path to html file)) {
List<IElement> iElements = HtmlConverter.convertToElements(is);
Div div = new Div();
for (IElement elem : iElements) {
if (elem instanceof IBlockElement) {
div.add((IBlockElement) elem);
} else if (elem instanceof Image) {
div.add((Image) elem);
} else if (elem instanceof AreaBreak) {
div.add((AreaBreak) elem);
} else {
Assert.fail("The #convertToElements method gave element which is unsupported as root element, it's unexpected.");
}
}
PageSize pageSize = PageSize.A4;
try (PdfDocument pdfDocument = new PdfDocument(new PdfWriter(output pdf path))) {
pdfDocument.setDefaultPageSize(pageSize);
PdfCanvas pdfCanvas = new PdfCanvas(new PdfStream(), new PdfResources(), pdfDocument);
try (Canvas canvas = new Canvas(pdfCanvas, new Rectangle(Float.MAX_VALUE, Float.MAX_VALUE))) {
Rectangle htmlSize = div.createRendererSubTree().setParent(canvas.getRenderer())
.layout(new LayoutContext(new LayoutArea(1, new Rectangle(
pageSize.getWidth(),
pageSize.getHeight()
))))
.getOccupiedArea()
.getBBox();
PdfFormXObject formXObject = new PdfFormXObject(htmlSize);
try (Canvas canvasForDiv = new Canvas(formXObject, pdfDocument)) {
canvasForDiv.add(div);
}
PdfPage pageNewDoc = pdfDocument.addNewPage();
PdfCanvas canvasToAddXObject = new PdfCanvas(pageNewDoc);
canvasToAddXObject.addXObjectFittedIntoRectangle(formXObject, fit(new Rectangle(0, 0, formXObject.getWidth(), formXObject.getHeight()), pageNewDoc.getPageSize()));
}
}
}
private static Rectangle fit(Rectangle img, Rectangle page) {
float ws = page.getWidth()/img.getWidth();
float hs = page.getHeight()/img.getHeight();
float scale = Math.min(ws, hs);
return new Rectangle(0,page.getHeight()-img.getHeight()*scale, img.getWidth()*scale, img.getHeight()*scale);
}
Also you can use rotated page size (ex. PageSize.A4.rotate()).

Related

how to get the input text value which is inside the table column in Dialog in Karate

I got a table like below that renders in the dialog box. I am trying to capture the value of input which is inside the column.
The Xpath is /html/body/div[9]/div[2]/table/tbody/tr[8]/td[2]/table/tbody/tr[1]/td[1]/input'
I did try multiple ways to get required value but could't get it so someone help me how to capture input value which is inside the particular , full xpath and css path is not working.
<table>
<tbody>
<tr>
<td>Room type:</td>
<td><b>
Deluxe Balcony Riverview - All Inclusive
</b>
</td>
</tr>
<tr>
<td>Date:</td>
<td><b>
01 Mar 2022
</b>
</td>
</tr>
<tr>
<td>Minimum Stay:</td>
<td>
<input name="txtMinimumStay" type="text" value="1" id="txtMinimumStay" class="helper" title="The minimum nights a guest must stay in this room type" style="width:40px;">
night(s)
</td>
</tr>
<tr>
</tr>
<tr>
<td>Maximum Stay:</td>
<td>
<input name="txtMaximumStay" type="text" value="0" id="txtMaximumStay" class="helper" title="The maximum nights a guest can stay in this room type" style="width:40px;">night(s)
</td>
</tr>
<tr>
<td>Sold:
</td>
<td><b>
0
room(s)</b>
</td>
</tr>
<tr>
<td>Allocation:</td>
<td>
<table>
<tbody>
<tr>
<td width="70px">
<input name="textAllocation" value="0" id="textAllocation" type="text" style="width: 50px">
</td>
<td style="font-size: 9px">Extra adult rate (per night):</td>
<td>
<input name="txtAdultPrice" type="text" value="21" maxlength="4" id="txtAdultPrice" class="helper" title="Extra person charge for adults" onchange="updateGuestCapacity(false)" style="width:40px;">
$AUD
<br>
<span id="Regularexpressionvalidator1" style="display:none;">Please only enter a whole number for the adult rate</span>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td>Rate:</td>
<td>
<br>
<table>
<tbody>
<tr>
<td width="70px">
<input name="txtQuickRate" type="text" id="txtQuickRate" style="width: 50px;" value="85">
$AUD
</td>
<td style="font-size: 9px">Extra child 1 rate (per night):</td>
<td>
</td>
<td>
<input name="txtChildPrice" type="text" value="15" maxlength="4" id="txtChildPrice" class="helper" title="Extra person charge for children 1" onchange="updateGuestCapacity(false)" style="width:40px;">
$AUD
<br>
<span id="Regularexpressionvalidator2" style="display:none;">Please only enter a whole number for the child 1 rate</span>
</td>
</tr>
<tr>
<td></td>
<td style="font-size: 9px">Extra child 2 rate (per night):</td>
<td>
</td>
<td>
<input name="txtChild2Price" type="text" value="7" maxlength="4" id="txtChild2Price" class="helper" title="Extra person charge for children 2" onchange="updateGuestCapacity(false)" style="width:40px;">
$AUD
<br>
<span id="Regularexpressionvalidator3" style="display:none;">Please only enter a whole number for the child 2 rate</span>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td>Availability Status:
</td>
<td>
<table id="rblStopSellDialog" cellspacing="0" cellpadding="0" style="font-size:8pt;border-collapse:collapse;">
<tbody>
<tr>
<td><input id="rblStopSellDialog_0" type="radio" name="rblStopSellDialog" value="0" checked="checked"><label for="rblStopSellDialog_0">Available</label></td>
</tr>
<tr>
<td><input id="rblStopSellDialog_1" type="radio" name="rblStopSellDialog" value="1"><label for="rblStopSellDialog_1">Stop sell</label></td>
</tr>
<tr>
<td><input id="rblStopSellDialog_2" type="radio" name="rblStopSellDialog" value="2"><label for="rblStopSellDialog_2">Closed to arrival</label></td>
</tr>
<tr>
<td><input id="rblStopSellDialog_3" type="radio" name="rblStopSellDialog" value="3"><label for="rblStopSellDialog_3">Closed to departure</label></td>
</tr>
<tr>
<td><input id="rblStopSellDialog_4" type="radio" name="rblStopSellDialog" value="4"><label for="rblStopSellDialog_4">On Request</label></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>

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();"

Perl Mechanize identify content between span tag within specific div tag

Perl WWW::Mechanize::Firefox has successfully retrieved the contents of the web page, and stored in the scalar variable $content.
my $url = 'http://finance.yahoo.com/quote/AAPL/financials?p=AAPL';
$mech->get($url);
my $content= $mech->content();
In examining $content, I'm interested in identifying and saving all the information between the span tags inside the table.
There a varies classes that I have no interest in.
Attempt # 1 did not work.
my $tree = HTML::TreeBuilder->new_from_content($txtRawData);
my #list = $mech->find('span');
foreach ( #list ) {
print $_->as_HTML();
}
Attempt # 2 did not work.
foreach my $tag ($tree->look_down(_tag => 'span')) {
my $value = $tag->as_text;
}
The HTML table of interest is:
<div class="Mt(10px)">
<table class="Lh(1.7) W(100%) M(0)">
<tbody>
<tr class="Bdbw(1px) Bdbc($lightGray) Bdbs(s) H(36px)">
<td class="Fw(b) Fz(15px)">
<span>Revenue</span>
</td>
<td class="C($gray) Ta(end)">
<span>9/24/2016</span>
</td>
<td class="C($gray) Ta(end)">
<span>9/26/2015</span>
</td>
<td class="C($gray) Ta(end)">
<span>9/27/2014</span>
</td>
</tr>
<tr class="Bdbw(1px) Bdbc($lightGray) Bdbs(s) H(36px)">
<td class="Fz(s) H(35px) Va(m)">
<span>Total Revenue</span>
</td>
<td class="Fz(s) Ta(end)">
<span>
<span>215,639,000</span>
</span>
</td>
<td class="Fz(s) Ta(end)">
<span>
<span>233,715,000</span>
</span>
</td>
<td class="Fz(s) Ta(end)">
<span>
<span>182,795,000</span>
</span>
</td>
</tr>
<tr class="Bdbw(1px) Bdbc($lightGray) Bdbs(s) H(36px)">
<td class="Fz(s) H(35px) Va(m)">
<span>Cost of Revenue</span>
</td>
<td class="Fz(s) Ta(end)">
<span>
<span>131,376,000</span>
</span>
</td>
<td class="Fz(s) Ta(end)">
<span>
<span>140,089,000</span>
</span>
</td>
<td class="Fz(s) Ta(end)">
<span>
<span>112,258,000</span>
</span>
</td>
</tr>
<tr class="Bdbw(0px)! H(36px)">
<td class="Fw(b) Fz(s) Pb(20px)">
<span>Gross Profit</span>
</td>
<td class="Fw(b) Fz(s) Ta(end) Pb(20px)">
<span>
<span>84,263,000</span>
</span>
</td>
<td class="Fw(b) Fz(s) Ta(end) Pb(20px)">
<span>
<span>93,626,000</span>
</span>
</td>
<td class="Fw(b) Fz(s) Ta(end) Pb(20px)">
<span>
<span>70,537,000</span>
</span>
</td>
</tr>
</tbody>
</table>
</div>
What is the best way to select (set focus upon) one specific table (their could be multiple tables inside the $content variable), and save the text between the span tags to an array (to be passed to the next procedure - to be inserted into a database table)?
I also would like to highlight that:
Sometimes, the text is inside a two (double) sets of span tags.
There is no table header row (or th tags).
Your first attempt works if you actually do it on $tree and not on $mech.
Combined with as_text from your second attempt is pretty nice.
use HTML::TreeBuilder;
my $tree = HTML::TreeBuilder->new_from_content(my #foo = <DATA>);
my #list = $tree->find('span');
foreach ( #list ) {
say $_->as_text();
}
__DATA__
<div class="Mt(10px)">
<table class="Lh(1.7) W(100%) M(0)">
...
This outputs a list of span contents. You should be able to clean those up and work with them.
Revenue
9/24/2016
9/26/2015
9/27/2014
...
Of course as an actual table (array-of-arrays) it would probably make more sense, but for that we'd have to know what it is you are trying to do.

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();