How to access HTML link content using JavaScript - javascript

I have an HTML page which contains a table for the year 2015. On this HTML page, there are links from 2011 to 2015. Every year has different table. I need to access these table elements using JavaScript. Any ideas about how to do it?
Thanks

If I were you I would parse the entire page. Right click the screen and click view source in windows. This will show the xml of the webpage that you could parse. I would advise you to use jparse.

Related

How to determine an end of a page before converting html to pdf using wkhtmltopdf?

I have an HTML page that is generated dynamically, based on a specific form. Once an HTML page is generated, it can be converted to PDF using wkhtmltopdf.
If the page is too long, wkhtmltopdf will automatically split it into multiple pages, but I want to have control over WHERE the split will happen.
I need this because each page will contain specific charts for the specific information that will be displayed on the page and whenever automatic split happens, I sometimes get a chart not being related to the text displayed on the page.
So ideally I want to be able to determine whether the form generated content is too long for 1 page or not and then manually add a new page with controlled content.
To add a new page, I'm basically using the following CSS rule, which works fine:
#media print {
.new-page {
page-break-before: always;
}
}
The application is built in Laravel + Svelte.js (but I don't think it matters much, because I'm just trying to figure out how to approach the issue in general).
Perhaps I could get some recommendations?
To control where to split your page, you can use the page-break-after attribute.
Example :
<div style="page-break-after:always;"></div>

Generate PDF of a section of a php page once rendered into HTML and CSS and account for pdf page-breaks

The system I am working on has a questionnaire in it and then shows the responses to the admin in a nice report on screen. I need to create functionality that turns the on screen report into a pdf, similar to how the browser generates a pdf of the page when you select print. Although I need to only turn a section of the page into pdf. And it would be ideal to be able to alter the HTML so that the pdf page breaks don't interfere with the presentation of the report.
You can download a pdf of how the report looks, generated by the browser functionality. This is just an example, I need the pdf to be generated by a link or button and not include the whole page (the top part in this case).
I have tried some php HTML to pdf generators, but it's difficult because the HTML is dynamically generated so I'm not sure how to send all the HTML, once rendered, to the page that creates the pdf.
To overcome the page breaks, I've considered using javascript or jquery to read the height of the div of each question within the report and then write a simple script to calculate if the next div will fit on the page and if not add a margin on top of that div so that it starts on a new page.
What software can I use to generate the pdf, given these requirements? Either php or javascript. Appreciate the help.
Have you considered Snappy for PHP? It makes use of wkhtmltopdf behind the curtains to convert any HTML document into PDF.
We are using it and it works great.
https://github.com/KnpLabs/snappy
You could try mpdf and use the page-break-inside: avoid property which is actually a CSS property. I have not used this, but it might be what you're looking for.
Looks like you can add this property to the <div> and <table> tags (mPDF Supported CSS).

Need to scroll to a specific line in a PDF embedded in html page

I am looking for a solution where in I am able to move to a specific line in a pdf embedded in HTML .
At the moment I am using object tag to display the pdf in html page .
I know by using open parameters I can scroll through a pdf to a specific page but I am unsure how can this be achieved for a particular line navigation .
Open parameters example has been shared in the below mentioned question link but I need some parameter which helps me reach a particular line in PDF may be using some co-ordinates if that's achievable.The requirement is to scroll a PDF to a particular line and only the PDF should get scrolled not the original HTML page.
How to move the scroll bar of the browser on a pdf file with ASP / Javascript?
I can use any of the JQuery PDF viewers as mentioned here :
http://www.jqueryrain.com/2012/09/best-jquery-pdf-viewer-plugin-examples/
in case your solution uses them .
Please note I don't want to move to a particular location in an HTML page as mentioned in below post rather its about navigating to a particular line in a PDF embedded in a page.
How can I scroll to a specific location on the page using jquery?
Any help or leads would be really appreciated .
Thanks in advance.
Create a destination in the PDF file (assuming you are the one generating it) at the appropriate line, and add #destination to the end of the URL
See https://helpx.adobe.com/acrobat/kb/link-html-pdf-page-acrobat.html#OpenaPDFfiletoasetdestination for an explanation on linking to PDF page numbers and destinations.
Assuming you don't have access to a PDF's source, you can open to a page by adding &page=pagenum to the URL as noted at link html pdf page. You may also want to look at this question.

Open and display excel spreadsheet in HTML window and manipulate data

My requirement is to create a webpage where after clicking on a button/hyperlink, a window will open in same page, and that window should show excel spreadsheet.
Please note that I know how to open an excel in HTML window but here i want to display excel spreadsheet in editable format in my webpage developed in HTML window.
Please let me know if this is achievable through HTML, Javascripting.
Thanks.
Because you've asked only to read the data you can simply export the spreadsheet to html and from there it'll work like any other webpage. Here are the instructions: http://www.extendoffice.com/documents/excel/674-excel-export-to-html.html
Try this Javascript library to display data as excel in html you can pass your data in different formats as well, ex:- json, list, array etc.

How can I create a Table of Contents automatically in a Sharepoint 2007 wiki page?

As our users get more familiar with the wiki functionality, and like it, we see that pages are getting longer and more difficult to navigate.
We would like to be able to generate table of contents on a per-wiki-page basis to allow easier navigation, i.e. the users create content whose hierarchy is represented by h2/h3/h4 elements and then the TOC is automatically generated at the top of the wiki page with each entry in the TOC being a link to the corresponding h2/h3/h4 element in the page.
We do not have access to Sharepoint Designer so any funny stuff will have to involve css/javascript inserted using a Content Editor Web Part.
Best regards,
Colm O'Gairbhith
In case this may be useful to anyone else, I ended up using the jquery tableofcontents plugin.
The tutorial Automatically Generate Table of Contents with jQuery explains how to use this.

Categories