Comments (4)
I have the same issue, HTML is as followed:
<html>
<body style="font-family: arial;">
<h1 align="right">Change Order</h1>
<br />
<hr style="width: 90%">
<table align="center" style="width: 80%;">
<tr>
<td>Attention: <span id="attention"></span></td>
<td>Company: <span id="company"></span></td>
</tr>
<tr>
<td style="padding-top: 9px;">Date: <span id="date"></td>
<td></span></td>
</tr>
<tr>
<td style="padding-top: 9px;">Address: <span id="address"></span></td>
<td></td>
</tr>
</table>
<br />
<hr style="width: 90%;">
<div align="center">
<h4 style="width: 80%; text-align: left;">Description of Charge</h4>
</div>
<table align="center" style="width: 80%; border: 1px solid;" id="main_data">
<tr>
<th style="width: 75%; text-align: left;">Description</th>
<th style="width: 25%;">Cost</th>
</tr>
</table>
<div align="center">
<h4 style="width: 73%; text-align: right;">Tax: <span id="tax"></span> <br /> Total: <span id="total"></span></h4>
</div>
<table align="center" style="width: 80%;">
<tr>
<td style="width: 30%">Client Signature</td>
<td valign="bottom"><hr style="margin-top: 22px;"/></td>
</tr>
<tr>
<td style="padding-top: 9px;">Date:</td>
<td></span></td>
</tr>
<tr>
<td style="width: 30%">Contractor Signature</td>
<td valign="bottom"><span id="signature"></span><br /><hr style="margin-top: 22px;"/></td>
</tr>
<tr>
<td style="padding-top: 9px;">Date: <span id="date"></span></td>
<td></span></td>
</tr>
</table>
</body>
</html>
The code used to render is:
self.PDFCreator = [NDHTMLtoPDF createPDFWithHTML:@"<html> <body style='font-family: arial;'> <h1 align='right'>Change Order</h1> <br /> <hr style='width: 90%'> <table align='center' style='width: 80%;'> <tr> <td>Attention: <span id='attention'></span></td> <td>Company: <span id='company'></span></td> </tr> <tr> <td style='padding-top: 9px;'>Date: <span id='date'></td> <td></span></td> </tr> <tr> <td style='padding-top: 9px;'>Address: <span id='address'></span></td> <td></td> </tr> </table> <br /> <hr style='width: 90%;'> <div align='center'> <h4 style='width: 80%; text-align: left;'>Description of Charge</h4> </div> <table align='center' style='width: 80%; border: 1px solid;' id='main_data'> <tr> <th style='width: 75%; text-align: left;'>Description</th> <th style='width: 25%;'>Cost</th> </tr> </table> <div align='center'> <h4 style='width: 73%; text-align: right;'>Tax: <span id='tax'></span> <br /> Total: <span id='total'></span></h4> </div> <table align='center' style='width: 80%;'> <tr> <td style='width: 30%'>Client Signature</td> <td valign='bottom'><hr style='margin-top: 22px;'/></td> </tr> <tr> <td style='padding-top: 9px;'>Date:</td> <td></span></td> </tr> <tr> <td style='width: 30%'>Contractor Signature</td> <td valign='bottom'><span id='signature'></span><br /><hr style='margin-top: 22px;'/></td> </tr> <tr> <td style='padding-top: 9px;'>Date: <span id='date'></span></td> <td></span></td> </tr> </table> </body> </html>"
pathForPDF:[@"~/Documents/delegateDemo.pdf" stringByExpandingTildeInPath]
delegate:self
pageSize:kPaperSizeA4
margins:UIEdgeInsetsMake(10, 5, 10, 5)];
from ios-htmltopdf.
Having a similar issue as well, except the HTML being rendered onto the PDF is being prematurely cut off on the first page. It only seems to happen when one column in the table is particularly wide.
As you can see, where "SUBTOTAL" stars on the next page should actually be a part of the table above.
This is the HTML that's being rendered:
<html lang='en'>
<head>
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'></meta>
<meta charset='utf-8'></meta>
<title>Example 1</title>
<link rel='stylesheet' href='pro_monochrome_template.css' media='all'></link>
</head>
<body>
<header class='clearfix'>
<div id='logo'>
<img src='logo_6A979AF8B0E90B7F405911F9512BE8C1.jpg'></img>
</div>
<h1 id='invoice_num'>Invoice INV0001</h1>
<div id='company' class='clearfix'>
<div id='company_company' class='company'>Test Company</div>
<div id='company_name' class='name'>Anna Haro</div>
<div id='company_address1' class='address'>1001 Leavenworth Street</div>
<div id='company_address2' class='address'>Sausalito CA 94965</div>
<div id='company_phone' class='phone'>555-522-8243</div>
<div id='company_email' class='email'>[email protected]</div>
</div>
<div id='client'>
<div id='client_name_container' class='client_container'>
<span id='client_name_label' class='client_table_label'>Name</span>
<span id='client_name' class='client_table_value'>Daniel Higgins</span>
</div>
<div id='client_phone_container' class='client_container'>
<span id='client_phone_label' class='client_table_label'>Phone</span>
<span id='client_phone' class='client_table_value'>555-478-7672</span>
</div>
<div id='client_effective_date_container' class='client_container'>
<span id='effective_date_label' class='client_table_label'>Date</span>
<span id='effective_date' class='client_table_value'>September 24, 2015</span>
</div>
</div>
</header>
<main>
<table>
<thead>
<tr id='item_header'>
<th id='item_header_desc' class='service'>Description</th>
<th id='item_header_total'>Total</th>
</tr>
</thead>
<tbody id='items'>
<tr>
<td class='item-desc'>
<h3 class='name'>Item 1</h3>
<span class='desc'>This is a very long description, and when there is a long description then the description table cell becomes very wide. When a table cell becomes very wide, the renderer starts to cut the table off early into the page.</span>
</td>
<td class='total'>$4.00</td>
</tr>
<tr>
<td class='item-desc'>
<h3 class='name'>Item 2</h3>
<span class='desc'>Test here</span>
</td>
<td class='total'>$15.00</td>
</tr>
<tr id='subtotal' class='footer_row'>
<td id='subtotal_label'>Subtotal</td>
<td id='subtotal_amt' class='total'>$19.00</td>
</tr>
<tr id='total' class='footer_row'>
<td id='total_label' class='grand total'>Total</td>
<td id='total_amt' class='grand total'>$19.00</td>
</tr>
<tr id='paid' class='footer_row'>
<td id='paid_label'>Paid</td>
<td id='paid_amt' class='total'>$0.00</td>
</tr>
<tr id='due' class='footer_row'>
<td id='due_label' class='grand total'>Due</td>
<td id='due_amt' class='grand total'>$19.00</td>
</tr>
</tbody>
</table>
<div id='notices'>
<div id='notes' class='notice'></div>
</div>
</main>
</body>
</html>
from ios-htmltopdf.
Did you guys, have fix your problems with that pdf cuttings issues ?
I had similar problem when using table. I replaced my table with inline block divs or flex, and fix the problem.
I had the same issue too using css: float and text-align.
Anyone has a workaround about all those problems ?
from ios-htmltopdf.
After a lot of searching it seems the problem (for me at least) was with my print CSS. Printing the HTML from a browser gave the same blank page at the end.
Simple fix—add this to the CSS:
html, body { height: auto; }
May not work for everyone but it fixed my problem.
from ios-htmltopdf.
Related Issues (20)
- Content is cropped if too wide HOT 5
- Multiple HTML files to one PDF HOT 1
- Balnk page because of page-break trough CSS HOT 3
- Crashes on iOS8.1 HOT 5
- page breaks HOT 4
- Images not come in generated pdf HOT 2
- How to get page number display on header HOT 2
- not recognising href tag HOT 1
- Unwanted scale factor when rendering pages
- Swift compatible?
- Carthage support HOT 1
- iPad pdf generate issue HOT 1
- HTMLtoPDF did fail error HOT 1
- increase margin for first page
- Hyperlink not working HOT 1
- Convert multiple HTML to multiple pdf using a for loop.
- Footer for pdf
- pod update not getting latest version
- Images missing after change to WKWebView HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ios-htmltopdf.