Import HTML is an attempt at implementing a website import function for InDesign
LATEST UPDATE: May 2018
Note: This script can currently only import online, publicly-accessible websites!
If you need to import HTML files saved locally on your personal computer, or if you need to access websites that require a username and password, we may be able to help. Get in touch!
Here’s an example of importing a page from a racing blog:
Instructions
Download the script, and install as usual for InDesign scripts.
Open the supplied HTMLTemplate.indd file and double-click on the script in the Scripts panel to run.
Paste the URL of the web article you want to import into InDesign and wait a few moments for the result. (A default link to an article is provided in the URL field, so you can try that first…)
What you get
You do not get an InDesign document that looks like the webpage!
What you hopefully do get, though, is:
(a) The text from the webpage, with sensible character styles and paragraph styles applied to it. All paragraph-level HTML tags (H1, H2, H3, p, etc.) are converted to similarly-named paragraph styles, and span-level HTML tags (em, strong, i, etc.) are converted to similarly-named character styles.
(b) The images on the webpage (optional).
(c) If there are tables on the webpage, these are reconstructed in InDesign. Very simply, though. So if the entire page is one big table, don’t expect too much!
(d) Hyperlinks. If there are any anchors (<a> elements) in the HTML, these are converted to hyperlinks in InDesign.
Included in the download package is an InDesign file that can server as a template for importing HTML. It includes pre-styles paragraph and character styles for common HTML tags. Note that the supplied template file is very basic and its use is completely optional. It just provides basic formatting for a handful of common elements.
What is it for?
Probably, the main use of importing the HTML into InDesign with this script rather than just copy-pasting from your browser is that the text comes in with paragraph and character styles applied – so it is ready to copy–paste into the document you’re preparing with very little hassle.
You also get the images imported.
So, have fun, and please leave feedback. I’d like to know what you use the script for, and how it goes!
Download
How it works, and a note about privacy
When you paste a URL into the script window and click OK, this URL is transmitted to our server (hosted by Bluehost.com) over an unencrypted connection. The server then fetches the requested web page, does some pre-processing on it to make it ready for InDesign import, and then sends it back to the HTML Import script, which places the file, downloads the pictures, and completes the formatting in InDesign.
The URL provided is logged by the Id-Extras.com server. No other information is stored, so while we do have a list of URLs requested, we do not store anything about who requested them.
David BlatnerApril 26, 2017 8:03 pm
Cool, Ariel! This is really going to be helpful. I’m looking forward to new, more robust versions!
ArielApril 26, 2017 8:22 pm
Thanks David!
Uwe LaubenderApril 26, 2017 8:13 pm
Hi Ariel,
just tested your script. Cool. Especially the image import…
What bugs me a bit is that I cannot paste in text—my URL—to the edit text field of the script’s alert at the start. I have to type in the URL. That could be a “speciality” of InDesign on Mac OSX …
Thanks,
Uwe
ArielApril 26, 2017 8:22 pm
Thanks Uwe. On MacOS you right-click and choose “paste”…
Uwe LaubenderApril 26, 2017 8:57 pm
Oops…
Yes. Right-click > Paste is working.
Thanks,
Uwe
ArielApril 26, 2017 9:14 pm
You’re the second person to ask me that today!
Keith GilbertApril 27, 2017 5:21 am
Well done Ariel! Wow.
Uwe LaubenderMay 5, 2017 3:37 pm
Thank you very much for providing the source with version 06.
Uwe
AnnukkaMay 9, 2017 11:47 am
Thank you veru much, really useful!
Tobias TrofastNovember 3, 2017 12:05 pm
Great work,
I really like the idea and been looking for something likes this for a while. A few humble suggestions and ideas:
– Language support. Seemlingy unknown characters are simply cut out. The page I tried to import had a UTF-8 encoding, uncertain if the script detects that?
– Paste code instead of url as an option.
ArielMay 13, 2018 5:39 pm
Hi Tobias: I’ve tested it, and I believe it now works pretty reliably with UTF-8.
Pasting HTML is coming soon, if there is enough demand.
adinaDecember 20, 2017 9:54 pm
hello, i was wondering if you could help me with actually importing a 930 post blog :), its on wordpress.com, and since every few dozen posts the address changes and lists a different page i was wondering if there was a way to import all posts without doing it manually for the 135 different pages 🙂
thanks,
adina
ArielJanuary 7, 2019 12:06 pm
This could definitely be done, but would require some custom scripting. Get in touch for a quote.
Andre WyssMay 18, 2018 12:35 pm
Hi Ariel
Unfortunately in my case the script doesn’t seem to work. OSX 10.12.6 | ID CC 13.1. I’ve tried several websites (e.g.https://magazin.swisscom.ch/datensicherheit-infrastruktur/treuhaender-datenschutz-outsourcing-praxis/). When I start the script, a small window pops up (with fast changing text) and dissappears, but the empty document doesn’t change at all. Any tipps or hints for this?
ArielMay 18, 2018 12:53 pm
Hi Andre,
Checked it and it works for me (though it doesn’t succeed in importing the 2 big images on the page). But the text comes in nicely formatted, that is with appropriate paragraph and character styles applied.
If you’re seeing “fast changing text”, my hunch is that you’ve got some sort of a firewall that is blocking InDesign’s connection to the outside world.
In which folder have you installed the script? Sometime the “Application” folder has more permissions that the “User” folder.
For corporate clients who have firewall issues like yours, the answer is to install the whole mechanism on their own protected servers. You, or anyone for whom this would be applicable, should get in touch about that.
Andre WyssMay 20, 2018 1:50 pm
Hi Ariel
I’ve tried your script outside our corporate environment and now everything works fine. Thank you for the helping hand the usefull script.
JustinJanuary 15, 2019 6:29 am
Forgive me I am new to indesign and mail merge.
I was wondering whether you think this script might be useful for mail merging images that you don’t want to have to download locally each time? You could just enter the URL into an excel field and indesign would automatically download the image in the right place.. does that sound like it could work?
Thanks!
ArielJanuary 15, 2019 1:20 pm
Hi Justin,
This script could certainly be expanded to include such functionality.
(There might already a free script floating around that will pull images into InDesign based on a text URL. Worth googling for that.)
Ariel
NathanFebruary 1, 2019 6:53 pm
Hi Justin, I’m trying to do the same thing. Did you figure it out?
NateDecember 9, 2019 6:55 pm
Just wanted to say thank you for this script – I am pulling a family blog into InDesign, and your script will save me hours and hours of manually importing photos.
Florian WyzniakApril 25, 2020 7:36 pm
Hello Ariel,
thanks for your work already. In wonder if there is a way to just use your script to only put an URL of an image into a textfield. I tried your script and managed to put put whole blogs with several images and texts into my document but if I use an url with just an image nothing appers. What am I doing wrong?
Thanks already for answering.
Best regards,
Florian
ArielApril 30, 2020 4:47 pm
Hi Florian,
Try wrapping the image in a div tag or p tags, or otherwise making it valid HTML.
Ariel