PDF forms get online content - javascript

Would it be possible to use the inbuilt Javascript in adobe pdf forms to get contents/scrape a web page?
When I googled if Javascript could do this there where CSP errors,
but pdf forms does not have this as far as I know.
thanks,
g3

As you suspected, it is not possible to achieve this with Acrobat's Javascript extensions.
There are a number of third party tools that can convert a website to a pdf. If you also need to build a form, rather than just convert a webpage, you could write a program that would leverage a third party conversion tool, then build the form using Acrobat's Interapplication Communication API reference. If you're more comfortable with Javascript, you could even use the PDDoc's JSObject to build the form with Javascript.

You could use the wkhtmltopdf tool to get the HTML Content of a website and save it to a PDF
Then you can simply run
wkhtmltopdf http://google.com google.pdf to get the Content of Google.com and save it to the PDF "google.pdf".

It is possible. Check out the methods of Net.HTTP found in the "JavaScript for Acrobat API Reference". You might find a more recent version of the reference here.

Related

vuejs pdf from html

I need to generate pdf and paste the values of variables in certain places. In fact, this is going to be an order confirmation on my site. Later I will store it on firebase storage. which library do you recommend? Is there any way to generate pdf from html layout?
Yes, there are.
Python has : xhtml2pdf to convert html to pdf.
Otherwise, I would strongly recommend reportlab (still for python)
If you prefer to use Javascript there is PDFKit

Attach PDF to PDF as attachment (not as a page) via Javascript in HTML (not in Acrobat)

I would like to generate a PDF portfolio using JS from an HTML/CSS page on a local machine. I would use a PDF template file which includes a PDF portfolio Navigator in SWF form. I have successfully accomplished this using C# and a command line program, but can not identify the proper Javascipt components to do this browser-side or pseuo-server with Node.js. Basically, I am looking for something which will allow me to append a PDF to a new or existing PDF via configuration choices and an 'assemble' action using a JS or HTML button. iTextSharp provides the required PDF interaction functionality, but I can not figure out to run this inside an HTML to allow configuration via the HTML/CSS DOM (i.e. checkboxes, text field desciptors, etc...). Does a library with this type of functionality exist?
So you want to create a PDF using JavaScript?
On a quick google search, I found what appears to be a javascript library for creating and manipulating PDFs call jsPDF
If you want information on how to upload files with JavaScript alone, here is an article on how to do that. It also shows you how to use the file element.
For style, I recommend using a CSS Framework is you don't know much about CSS. I personally use Twitter Bootstrap for quickly prototyping things. It's quick and easy, and has good documentation. You can also use this to see how to make a form in HTML. I haven't got any good starter tutorials for HTML off the top of my list, sorry.
If you don't know much about JavaScript, when it comes to getting the options from the form, so that you can use them as configuration options, I'd suggest using the jQuery framework. It'll help you get up and running quickly enough
Note, all of this shouldn't replace basic training in JavaScript and HTML/CSS. Frameworks make things simpler, but if you don't know how to do something without a framework, you're going to have a hard time with a lot of the more complicated things. This goes for every language

How can I crawl an HTML5 website and convert its HTML content to PDF (using a Python or Ruby library)?

I'm looking for an engine/solution/framework/gem/egg/lib/whatever for either Ruby or Python to log into a website, crawl HTML5 content (mainly charts on a canvas), and be able to convert it into a PDF file (or image).
I'm able to write crawling scripts in mechanize so I can log onto the website and crawl the data, but mechanize does not understand complex JavaScript + HTML5.
So basically I'm looking for an HTML5/JavaScript interpreter.
This question is a bit confusing... sorry re-read my answer after reading the question again.
Your question has two parts:
1. How can I crawl a website
Crawling can be done using Mechinize, but as you said, it doesn't do Javascript very well. So one alternative is to use Capybara-webkit or Selenium (firefox / chrome).
Usually this is used for testing, but you may be able to drive it using Ruby code to navigate the various pages.
2. How can I convert the output to PDF
If you need to convert the crawled content to PDF, I don't think there is a way to do that. You may be able to take a screenshot (useful for testing) using Capybara-webkit or Selenium, but converting that to PDF may be just a matter of pumping it through some command line utility.
If you're looking for a true HTML to PDF converter (usually used to generate reports from views in a rails app), then use PDFKit
Basically it's a WebKit browser that can output to PDF. Really simple to run with.

Javascript site search on CD-ROM site without copy-and-paste?

Newbie here.
I want to create a site search for my offline website which will be on a CD.
Is it possible to use javascript to index the html pages automagically without me having to copy-and-paste every page into the script?
Thanks in advance for any assistance/guidance.
No, with Javascript it's not possible to read files on the hard disc.
But you could use another language to automatically generate the index.

PDF Reader/editor in Ajax/ASP.Net

I am working on project that allows to read document within the browser without the need to install software , It's a part of a management application for companies.
I tried out to work with iTextSharp ,PDFSharp , but these labrories don't allows you to do what I want to do.It's just for generating pdf from HTML.
I checked out for another solution , I found an interesting project developed by Mozilla Lab . Mozilla is working on technology that will allow PDF documents to be rendered within the browser, rather than utilizing a browser plug-in or an external app to open them.
https://github.com/Marak/pdf.js/
I wonder to know Can I integer this script and use it with ASP.Net ? , If yes , I will be pleased to be guided by you with code source or external links that you recommend in order to implement this solution.
I believe that link you have sighted is about creating PDF file in browser (and not about showing existing PDF in browser).
Said that, there is another interesting project pdf.js that is trying to render PDF using java-script and HTML 5. Its essentially a java-script library that takes PDF bytes and attempt to render them. As such, you should able to integrate it in any web site regardless of server side technology - include the script and make relevant calls. See this simple example to get started.

Categories

Resources