Skip to content

Commit

Permalink
Merge pull request #2946 from simon04/ts-remove-deprecated
Browse files Browse the repository at this point in the history
Fix TypeScript: remove remove deprecated plugins
  • Loading branch information
HackbrettXXX authored Oct 6, 2020
2 parents 704f5a9 + 1abf1b0 commit 2cc2ecf
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 315 deletions.
177 changes: 0 additions & 177 deletions examples/basic.html
Original file line number Diff line number Diff line change
Expand Up @@ -229,183 +229,6 @@ <h2><a href="#">Font-metrics-based line sizing and split</a></h2>
<a href="javascript:demoStringSplitting()" class="button">Run Code</a></p>
</div>

<h2><a href="#">fromHTML plugin</a></h2>
<div class="to_pdf">
<div>
<p>This (BETA level. API is subject to change!) plugin allows one to scrape formatted text from an HTML
fragment into PDF. Font size, styles are copied. The long-running text is split to stated content width.
</p>
</div>
<div style="border-width: 2px; border-style: dotted; padding: 1em; font-size:120%;line-height: 1.5em;"
id="fromHTMLtestdiv">
<h2 style="font-size:120%">Header Two</h2>
<strong><em>Double style span</em></strong>
<span style="font-family:monospace">Monotype span with
carriage return. </span><span style="font-size:300%">a humongous font size span.</span>
Followed by long parent-less text node. asdf qwer asdf zxcv qsasfd qwer qwasfd zcxv sdf qwer qwe sdf wer
qwer asdf zxv.
<div <span style="font-family:serif">Serif Inner DIV (bad markup, but testing block detection)</div><span
style="font-family:sans-serif"> Sans-serif span with extra spaces </span>
Followed by text node without any wrapping element. <span>And some long long text span attached at the end
to test line wrap. qwer asdf qwer lkjh asdf zxvc safd qwer
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww
qewr asdf zxcv.</span>
<p style="font-size:120%">This is a <em style="font-size:120%">new</em> paragraph.</p>
This is more wrapping-less text.
<p id="bypassme" style="font-size:120%">This paragraph will <strong style="font-size:120%">NOT</strong> be
on resulting PDF because a special attached element handler will be looking for the ID - 'bypassme' - and
should bypass rendering it.</p>
<p style="font-size:120%;text-align:center">This is <strong style="font-size:120%">another</strong>
paragraph.</p>
<p>I want to hide this particular <span class="hide">word</span></p>
<p style="text-align:justify">
Integer dignissim urna tortor? Cum rhoncus, a lacus ultricies tincidunt, tristique lundium enim urna,
magna? Sed, enim penatibus? Lacus pellentesque integer et pulvinar tortor? Dapibus in arcu arcu, vut
dolor? Et! Placerat pulvinar cursus, urna ultrices arcu nunc, a ultrices dictumst elementum? Magnis
rhoncus pellentesque, egestas enim purus, augue et nascetur sociis enim rhoncus. Adipiscing augue placerat
tincidunt pulvinar ridiculus. Porta in sociis arcu et placerat augue sit enim nec hac massa, turpis
ridiculus nunc phasellus pulvinar proin sit pulvinar, ultrices aliquet placerat amet? Lorem nunc porttitor
etiam risus tempor placerat amet non hac, nunc sed odio augue? Turpis, magnis. Lorem pid, a porttitor
tincidunt adipiscing sagittis pellentesque, mattis amet, duis proin, penatibus lectus lorem eros, nisi,
tempor phasellus, elit.
</p>
<h2>Image Support</h2>
<p>
NOTES: the img src must be on the same domain or the external domain should allow Cross-origin.
</p>
<img
src="https://maps.googleapis.com/maps/api/staticmap?center=Brooklyn+Bridge,New+York,NY&zoom=13&size=400x300&scale=1&maptype=roadmap&markers=color:blue%7Clabel:S%7C40.702147,-74.015794&markers=color:green%7Clabel:G%7C40.711614,-74.012318&markers=color:red%7Ccolor:red%7Clabel:C%7C40.718217,-73.998284&sensor=false"
width="400" height="300">
<!-- ADD_PAGE -->
<h2>New page added with html comment: ADD_PAGE</h2>
<h2></h2>
<p>HTML Table:</p>
<p>
NOTES: Must set the COLGROUP tag with "with" on each COL tag as %, inspect the table. BTW the css does not
have a good style to render the table on the html :P, feel free to the add the CSS.
</p>
<table>
<colgroup>
<col width="60%">
<col width="40%">
</colgroup>
<thead>
<tr>
<th>
Heading1
</th>
<th>
Heading2
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
cell 1,1
</td>
<td>
cell 1,2
</td>
</tr>
<tr>
<td>
cell 2,1
</td>
<td>
cell 2,2
</td>
</tr>
<tr>
<td>
cell 3,1
</td>
<td>
cell 3,2
</td>
</tr>
<tr>
<td>
cell 4,1
</td>
<td>
cell 4,2
</td>
</tr>
</tbody>
</table>
<h2></h2>
<h2></h2>
<p>HTML Lists:</p>
<div style="margin-left:20px">
<ul>
<li>Lorem Ipsum</li>
<li>Dolor Sit amen</li>
<li>Lorem Ipsum</li>
<li>Dolor Sit amen</li>
</ul>
<ol>
<li>Lorem Ipsum</li>
<li>Dolor Sit amen</li>
<li>Lorem Ipsum</li>
<li>Dolor Sit amen</li>
</ol>
</div>
</div>
<div>
<p>
<pre>var pdf = new jsPDF('p', 'pt', 'letter')

// source can be HTML-formatted string, or a reference
// to an actual DOM element from which the text will be scraped.
, source = $('#fromHTMLtestdiv')[0]

// we support special element handlers. Register them with jQuery-style
// ID selector for either ID or node name. ("#iAmID", "div", "span" etc.)
// There is no support for any other type of selectors
// (class, of compound) at this time.
, specialElementHandlers = {
// element with id of "bypass" - jQuery style selector
'#bypassme': function(element, renderer){
// true = "handled elsewhere, bypass text extraction"
return true
},
'.hide': function(element, renderer){
// true = "handled elsewhere, bypass text extraction"
return true
}
}

margins = {
top: 80,
bottom: 60,
left: 40,
width: 522
};
// all coords and widths are in jsPDF instance's declared units
// 'inches' in this case
pdf.fromHTML(
source // HTML string or DOM elem ref.
, margins.left // x coord
, margins.top // y coord
, {
'width': margins.width // max width of content on PDF
, 'elementHandlers': specialElementHandlers
},
function (dispose) {
// dispose: object with X, Y of the last line add to the PDF
// this allow the insertion of new lines after html
pdf.save('Test.pdf');
},
margins
)

</pre>
<button onclick="javascript:demoFromHTML()" class="button">Run Code</button></p>
</div>
</div>


<h2><a href="#">Text alignment</a></h2>
<div>
<p>
Expand Down
46 changes: 0 additions & 46 deletions examples/js/basic.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 0 additions & 18 deletions examples/js/from-html.js

This file was deleted.

6 changes: 0 additions & 6 deletions examples/js/html2canvas.js

This file was deleted.

26 changes: 0 additions & 26 deletions modules.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -382,32 +382,6 @@ var configuration = {
folder: 'libs',
description: '',
deps: []
},
'from_html': {
name: 'FromHTML Plugin',
folder: 'deprecated',
description: 'Deprecated',
deps: [
'jspdf',
'cell'
]
},

'addhtml': {
name: 'AddHTML Plugin',
folder: 'deprecated',
description: 'Deprecated',
deps: [
'jspdf'
]
},
'html2pdf': {
name: 'html2pdf Plugin',
folder: 'deprecated',
description: 'Deprecated',
deps: [
'jspdf'
]
}
}

Expand Down
22 changes: 0 additions & 22 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -810,15 +810,13 @@ declare module "jspdf" {
* jsPDF plugins below:
*
* - AcroForm
* - AddHTML
* - AddImage
* - Annotations
* - AutoPrint
* - Canvas
* - Cell
* - Context2D
* - fileloading
* - FromHTML
* - html
* - JavaScript
* - split_text_to_size
Expand All @@ -829,16 +827,6 @@ declare module "jspdf" {
* - xmp_metadata
*/

// jsPDF plugin: addHTML
addHTML(
element: any,
x: number,
y: number,
options: any,
callback: Function
): jsPDF;
addHTML(element: any, callback: Function): jsPDF;

// jsPDF plugin: addImage
addImage(
imageData: string | HTMLImageElement | HTMLCanvasElement | Uint8Array,
Expand Down Expand Up @@ -958,16 +946,6 @@ declare module "jspdf" {
// jsPDF plugin: html
html(src: string | HTMLElement, options?: HTMLOptions): Promise<HTMLWorker>;

// jsPDF plugin: fromHTML
fromHTML(
HTML: string | HTMLElement,
x: number,
y: number,
settings?: any,
callback?: Function,
margins?: any
): jsPDF;

// jsPDF plugin: JavaScript
addJS(javascript: string): jsPDF;

Expand Down
10 changes: 0 additions & 10 deletions types/jspdf-tests-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,16 +241,6 @@ function test_images() {
getImageFromUrl("thinking-monkey.jpg", createPDF);
}

function test_add_html() {
const pdf = new jsPDF("p", "pt", "a4");
pdf.addHTML(document.body, function() {
const string = pdf.output("datauristring");
document
.getElementsByClassName("preview-pane")[0]
.setAttribute("src", string);
});
}

function test_context2d_smiley() {
const doc = new jsPDF("p", "pt", "a4");
const ctx = doc.context2d;
Expand Down
10 changes: 0 additions & 10 deletions types/jspdf-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,16 +240,6 @@ function test_images() {
getImageFromUrl("thinking-monkey.jpg", createPDF);
}

function test_add_html() {
const pdf = new jsPDF("p", "pt", "a4");
pdf.addHTML(document.body, function() {
const string = pdf.output("datauristring");
document
.getElementsByClassName("preview-pane")[0]
.setAttribute("src", string);
});
}

function test_context2d_smiley() {
const doc = new jsPDF("p", "pt", "a4");
const ctx = doc.context2d;
Expand Down

0 comments on commit 2cc2ecf

Please sign in to comment.