🚨 HTML2PDF Deprecated [UPDATE + ALTERNATIVES]

What’s up Gliders!

Unfortunately Replit recently removed their free plan and automatically unpublished my html2pdf app. This means the original URL is no longer working.

I don’t want to leave you all stranded, so if you want to continue generating HTML based PDF’s for free, you have 3 options:

1. Host the code yourself (e.g. on Replit, Render, Netlify, etc):

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>HTML to PDF</title>
  <script src="https://cdn.tailwindcss.com"></script>
  <script>
    function getUrlParameter(name) {
      name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
      var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
      var results = regex.exec(location.search);
      return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
    }

    function loadPdfContent() {
      const pdfContent = getUrlParameter('PDF');
      if (pdfContent) {
        document.getElementById('content').innerHTML = pdfContent;
        setTimeout(function () {
          window.print();
        }, 500); // 1000 milliseconds = 1 second
      }
    }
  </script>
</head>

<body onload="loadPdfContent()">
  <div id="content"></div>
</body>

</html>

2. Use one of the versions below:

  • Render (New Host): https://pdfwizard.onrender.com/?PDF=HTML
  • Netlify (New Host): https://pdfwizard.netlify.app?PDF=HTML
  • Replit (Same Host, Dev Link): https://81477b6b-70f9-464e-a644-cc79738b18fb-00-2dp7qyh8jyudg.worf.replit.dev/?PDF=HTML

3. Enrol in the Glide Document Masterclass (better methods):

If you’re looking for more robust, flexible and scalable methods of generating free HTML based PDFs, you can enrol in my Glide Document Masterclass by clicking here. Below is the trailer :point_down:

6 Likes


image

if i want to use option 1 , it should be done the same way as HTML2PDF? But still cannot. Not sure which part i go wrong

It’s working for me… For example, copy the links below and open them in a new tab.

https://pdfwizard.netlify.app/?PDF=%3C!DOCTYPE%20html%3E%20%3Chtml%3E%20%3Chead%3E%20%3Ctitle%3ESimple%20HTML%20Table%3C/title%3E%20%3C/head%3E%20%3Cbody%3E%20%3Ch2%3EMy%20Simple%20Table%3C/h2%3E%20%3Ctable%20border=%221%22%3E%20%3Ctr%3E%20%3Cth%3EFirstname%3C/th%3E%20%3Cth%3ELastname%3C/th%3E%20%3Cth%3EAge%3C/th%3E%20%3C/tr%3E%20%3Ctr%3E%20%3Ctd%3EJohn%3C/td%3E%20%3Ctd%3EDoe%3C/td%3E%20%3Ctd%3E30%3C/td%3E%20%3C/tr%3E%20%3Ctr%3E%20%3Ctd%3EJane%3C/td%3E%20%3Ctd%3ESmith%3C/td%3E%20%3Ctd%3E25%3C/td%3E%20%3C/tr%3E%20%3C/table%3E%20%3C/body%3E%20%3C/html%3E

OR (even simpler)

https://pdfwizard.netlify.app/?PDF=<h1>Hello</h1>

Does they work for you?

Hi, tried putting the code directly on our website named the file ‘HTMLtoPDF.php’ but it is returning the error “Request-URI Too Long - The requested URL’s length exceeds the capacity limit for this server.”
Any ideas? Is it best hosted elsewhere?
Thanks.

URLs have a limit on how long they can be (imposed by browsers) so my guess is that you’re trying to convert a massive document? If not, it might be related to the php file? The example above is designed to be a html file (not sure if this matters in your case). Try convert something simple like <h1>hello</h1> and see what happens.

Dunno… But thanks for the warning!
image

1 Like

I am trying to convert a massive doc indeed, but those docs were working with the old URL

Interesting that they worked on the old instance but not when you self host… The code is literally the same. Have you tried option 1 with your docs? If both option 1 and 2 don’t work then it’s very odd because literally nothing changed besides the hosting provider, and that’s only affects option 1… If you’re using PHP then I assume you’re running a wordpress website… So your hosting provider or domain registrar may have weird limits imposed. Let me know how you go :+1:

I also just change a part to pdfwizard.netlify.app but most times isn’t work.
But before all was ok with this docs.
This night i have success with this new link, but now it became not work with my docs

1 Like

I’m trying option 1, I don’t wanna waste time on self-hosing since for me this is just a backup option for only one app :slight_smile:
It’s just that I assumed it would work if you host the same code with a different provider

1 Like

@slscustom.ru @tuzin what happens if you try the link below? It’s the dev link of the old app hosted on replit. If it works, that may be a temporary fix…

https://81477b6b-70f9-464e-a644-cc79738b18fb-00-2dp7qyh8jyudg.worf.replit.dev/?PDF=hello

I’m not sure how dev links work though… It may change or spin down after a while, so let me know how you go. This is essentially the exact same app as the original, just with a less pretty URL.

1 Like

Yep, it works, thanks!

Yes, 81477b6b-70f9-464e-a644-cc79738b18fb-00-2dp7qyh8jyudg.worf.replit.dev works exelent, fast, with any docs

So, we need to find stable and low cost host provider

For what it’s worth, I always use GitHub to host any custom code.

4 Likes

Thanks for this Marco, I have also found the new link is more fussy. 81477b6b-70f9-464e-a644-cc79738b18fb-00-2dp7qyh8jyudg.worf.replit.dev/?PDF works every time for me, and with some very large html too!

2 Likes

Woosh! Dodged a bullet here…thnx…I use that HTML2PDF site as well…but 81477b6b-70f9-464e-a644-cc79738b18fb-00-2dp7qyh8jyudg.worf.replit.dev/?PDF …also worked for me…

1 Like

(HTML to PDF (By Loqode))

Wow! This one is work. it can be used?

1 Like

It seems to work for now with no issues… Hopefully Replit doesn’t change the URL of this app again! If they do I will update this post with any alternatives I find.

1 Like

Hehhe thank youuu!!!

1 Like