How to create links to sections in pdf - html

Can we create a hyperlink or an embed tag that will display a specified page/section of a PDF document?
let me know if anybody has any idea
ex:
Open PDF using subsection

I know appending #page=X works, but I've now had some luck appending #subsection.X.Y. For example: http://tug.ctan.org/macros/latex/contrib/beamer/doc/beameruserguide.pdf#subsection.14.1

Just to go to an existing PDF file page you can use
#page=pageNumber
PDF parameter.
Yes it seems to be possible, please see this link http://www.pdfobject.com/examples/index.php and http://www.pdfobject.com/ for more information. This is from the site "PDFObject is an easy-to-use method for dynamically embedding PDF files into HTML documents. It uses JavaScript to generate and inject a standards-friendly "
<script type="text/javascript">
window.onload = function (){
var success = new PDFObject({ url: "http://www.adobe.com/content/dam/Adobe
/en/devnet/acrobat/pdfs/pdf_open_parameters_v9.pdf#page=6&zoom=150,0,216"
}).embed("pdf");
};
</script>
As you can see you can change the URL link to
thefile.pdf#page=YOURDESIREDPAGE
Linking to a destination within PDF in a webpage as found on this page,
Citation start:
"
Linking to a destination is essentially the same principle but involves a few more
steps
and setting up. First up, you'll need to create the destination.
Creating a destination in a PDF using Adobe Acrobat:
Manually navigate through the PDF for the desired location, and magnification.
Move your curser to the right of the PDF, in the navigation pane.
Right click and select destination. This will open the Destinations pane.
Right click, select New Destination enter an appropriate name and select the area that
you want the destination to link to.
NOTE: Make sure that the name does not have any spaces as it makes it easier to link to
afterwards.
You are now ready to link to the destination using a similar syntax as linking to a
specific page, instead of #page write #nameddest.
Append "#nameddest=" and the name of your chosen destination. So, if your PDF has a
named destination, "TOC", that points to a table of contents, then your link code will
look like this:
Link Text
"

Related

PdfBook Extension - MediaWiki - Fullurl parser function link automatically to every category page

I am able to display a download link in category to download all the pages of that category.
In the below link, it is written as
In order to include this parser function link automatically to every category page, add it to the Mediawiki:Categoryarticlecount page.
Rather than adding the download link manually to all categories, i tried the above. That is, added the download link in Mediawiki:Categoryarticlecount page to automatically include the fullurl parser function link to every category page. But it didnt work.
Parser function link : [{{fullurl:{{FULLPAGENAME}}|action=pdfbook}} | Download]
How to achieve this?
Any help is appreciated.
You have two typos in there:
The system message is at MediaWiki:Category-article-count (note the camel-case in MediaWiki)
The external link syntax is [url text], not [url | text], so it should be [{{fullurl:{{FULLPAGENAME}}|action=pdfbook}} Download]
Other than that, your code looks fine.

retrieving URLs from functions within HTML (python)

I need to scrape some URLs from some retailer product pages, but the specific URLs I need to get aren't in the html part of the page. The html looks like this for each of the items on which one would click to get to the page with the URL I need to grab:
<div id="name" class="hand bold" onclick="AVON.productcontrol.Go(45714);">ADVANCE TECHNIQUES Color Protection Conditioner Bonus Size</div>
I wrote the following to get URLs from the page, but since the actual URLs I need don’t seem to be stored in the page, it doesn’t get what I need:
def getUrls(URL):
"""input: product page url
output: list of urls to products
"""
connection = urllib.urlopen(URL)
dom = lxml.html.fromstring(connection.read())
selAnchor = CSSSelector('a')
foundElements = selAnchor(dom)
urlList = [e.get('href') for e in foundElements]
return urlList
Is there a way to get the link that the function after ‘onclick’ (I guess AVON.productcontrol.Go(#);) takes you to? I don’t fully understand html, and while I’ve read a bit about onclick, I can’t figure out how the function after 'onclick' works.
In order to find the URL that you are taken to on click, you need to find the JavaScript source code of the 'Go' function and read and understand it. It's buried somewhere within a tag or some JavaScript .js file that is referenced directly or indirectly by the HTML page. Happy digging!
Or: you automate the interaction with the web page with a tool like Selenium (http://docs.seleniumhq.org/) and just check where it takes you if you click.

How to show a preview of a file on a panel in a UiApp using GAS

I want to display a preview of a(ny) file on a panel in a UiApp using GAS.
I'm using DriveApp, not DocsList.
Using file.getThumbnail() or file.getAs(mimeType) I can get a Blob of any file.
Documentation at https://developers.google.com/apps-script/reference/drive/file#getThumbnail%28%29 states that (at least) I can get those blobs being converted to 'application/pdf'.
I don't know how to display those blobs (or pdf-files as such) on a panel.
Can anybody tell me what I should do?
You cant display them inside the panel because you would need to iframe it, which isnt possible even with htmlServices.
Use an anchor to open the link on another page. You can link to the original file.
You can convert a spreadsheet with a pdf but i don"t know with any File.
I use this code
var pdf = DocsList.getFileById(newSpreadsheet.getId()).getAs('application/pdf').getBytes();
var attach = {fileName:'Weekly Status.pdf',content:pdf, mimeType:'application/pdf'};
You cna test It with this source if he can help you .
https://gist.github.com/ixhd/3660885

Button to download HTML of a page

Is there a way to have a button/link and when you click on it, it will take the current page location and download an HTML version of it? It will be an iframe too, and the link should just download the iframe's content. Thanks!
The following JavaScript will take the current document and provide it as a download link. Tested in Chrome, not sure about others. Keep in mind that IE has limits for DataURI size. Furthermore, you'll lose your external images/CSS/etc, unless you inject the base tag into the top of the head tag (or find some other way to roll in resources):
// create the link to trigger download
// you could alternatively fetch an existing tag and update it
var a = document.createElement('a');
// send as type application/octet-stream to force download, not in browser
a.href =
"data:application/octet-stream;base64," +
btoa("<html>"+ document.getElementsByTagName('html')[0].outerHTML +
"</html>");
a.innerText = "Download this page";
// put the link wherever you want
document.body.appendChild(a);
EDIT: also doesn't provide a filename, or a .htm at the end of the download link... hmph. Those things can only really be provided by the Content-Disposition header, and that requires sending a request off to the server, so... not a fantastic user experience, but the easiest way to get the exact page state as the user sees it.
All you need is a simple script that takes the file name as a param and generates a zip. Here is an example in PHP.

how to set default location in browse tag

Am doing project in j2ee.I use Browse button. I need to fetch images/files from a folder inside my project folder, everytime.I wish to set my project's folder name as a default location for my browse button.How to do that?
am using tis following code in a jsp page:
and calling the value in servlet :
String image= (String) request.getParameter("img");
while browsing ,the whole path is getting displayed but only the name of the image is passing as value in the sevlet.How to get the entire path? or how to set my project folder as default location while browsing?
If this is rendering a standard
<input type="file".../>
Then you have no control over the default directory.
Using flash gains you a bit more control (filetype preset, single/multiple file selection etc.)
I'm not sure if Java Applets have more access/options, hopefully someone can advise.
PS. for the standard input tag, the browser will remember the last location you used, so you only need to navigate once, if you are uploading several files from the same directory.
I actually solved this problem with an interesting trick. Here's how...
Create an external vbscript include file called vbshelper.inc which contains the following code:
function stuffKeys(x)
Set wshShell = CreateObject("WScript.Shell")
wshShell.Sendkeys(x)
end function
Inside your HTML code header, place the following line as your first < Script> element...
< Script type="text/VBScript src="vbshelper.inc">
later, in your HTML code, create the button like this...
< input type="File" id="srcFile" onchange="go_do_something()" onclick="stuffkeys(' C:\Temp\*.txt~')">
Note the space before the C in ' C:\Temp*.txt~' and the tilde ~ after the .txt.