Macro to Convert a Multi-Page Web Page to a Single PDF

Example: the list of books in the library of Edge Books by People at |
at the bottom, links to the next pages:


Note that each page URL has an easy to recognize syntax, namely for example for page 2:

Books by People at |

Thanks in advance for your time and help.

Hey @ronald,

That's really hard to do.

You'll have to:

  • Print the current page to PDF,
  • Load the next page,
  • Wait or the page to fully load,
  • Print to PDF,
  • Repeat until the end.

Once that's done you'll have to stitch the PDFs together.

Someone sufficiently web-programming savvy could probably load all the separate pages into one and then print it – but that's not a simple task.


1 Like

Thanks very much for giving my question some thought.

The excellent @pete31 from the DevonThink Forum (also in the KM Forum) wrote the following AppleScript which works perfectly through DevonThink

I asked in the DevonThink forum because the app comes with all kinds of pdf functions

Thanks again very much @pete31 !

Is it possible to import multiple web pages as one PDF into DevonThink? - DEVONthink - DEVONtechnologies Community

-- Create PDFs from URLs and merge them

property theURL : ""
property theURL_Query : "?page="
property theURL_StartPage : 0
property theURL_EndPage : 9

tell application id "DNtp"
      set theGroup to display group selector "Choose destination:"
      set theDate to do shell script "date \"+%Y-%m-%d% %H:%M:%S\""
      repeat with i from theURL_StartPage to theURL_EndPage
         set thisURL to theURL & theURL_Query & i
         set thisRecord to create PDF document from thisURL in theGroup with pagination
      end repeat
      set theChildren to search "kind:pdf creationDate>=" & theDate in theGroup
      if theChildren ≠ {} then
         set theRecord to merge records theChildren in theGroup
         set name of theRecord to (name without extension of theRecord) & space & "[Merged]"
         set URL of theRecord to theURL
         error "No PDF records found"
      end if
   on error error_message number error_number
      if the error_number is not -128 then display alert "DEVONthink" message error_message as warning
   end try
end tell
1 Like


Keep in mind that this is site-specific and will not just work everywhere.

Although it's probably adaptable to most cases.

BTW – be sure to mention when you're using Apps like DEVONthink Office.

1 Like

OK thank you.