Giter VIP home page Giter VIP logo

Comments (6)

GendelfLugansk avatar GendelfLugansk commented on May 15, 2024 1

Hello. URL length is limited to 2097152 characters. This is an error chromium throws in console for very big html which contains few base64-encoded images: Refusing to load URL as it exceeds 2097152 characters. Unfortunately I can't share html that I'm trying to convert (those images contain some sensitive data)

from html-pdf-chrome.

popsail avatar popsail commented on May 15, 2024

What if it's a remote chrome instance, though?
How would you pass the temporary file?

from html-pdf-chrome.

westy92 avatar westy92 commented on May 15, 2024

This would only work for locally-running Chrome instances.

from html-pdf-chrome.

westy92 avatar westy92 commented on May 15, 2024

This is likely a better solution: cyrus-and/chrome-remote-interface#95 (comment).

from html-pdf-chrome.

westy92 avatar westy92 commented on May 15, 2024

I believe this is blocked by ChromeDevTools/devtools-protocol#13.

from html-pdf-chrome.

westy92 avatar westy92 commented on May 15, 2024

This does not appear to be an issue any longer. I was able to generate a 365 page PDF with the code below that used an HTML string composed of over over 2 million characters.

it('should generate from a lengthy HTML string', async () => {
  const options: HtmlPdf.CreateOptions = {
    port,
  };
  const filler = `
    <p>
      Bacon ipsum dolor amet fatback pastrami tongue short ribs jowl jerky meatloaf chuck pancetta pork pork loin tail cow brisket. Frankfurter chuck prosciutto tongue venison beef ribs filet mignon brisket turkey chicken hamburger ground round porchetta leberkas short ribs. Jerky doner ball tip, beef strip steak pancetta venison shankle boudin brisket. Rump leberkas biltong bresaola. Tongue burgdoggen strip steak beef ribs salami doner. Hamburger beef ribs shank, ribeye tail chuck pig turkey short loin shankle boudin cow. Cupim spare ribs turducken pastrami frankfurter jowl.
      Shankle beef corned beef porchetta. Capicola kevin pork chop short ribs, ham hock pancetta shankle. Buffalo kielbasa turducken beef ribs tongue. Filet mignon kevin pork loin pastrami meatloaf. Alcatra sausage brisket burgdoggen flank filet mignon biltong short ribs pork chop jowl pork venison rump sirloin beef ribs.
      Rump flank hamburger shank meatball alcatra ground round doner ham boudin. Beef pig pork chop bacon short loin ball tip rump, ground round frankfurter pork belly strip steak chicken landjaeger picanha. Ham frankfurter ball tip drumstick sausage doner salami. Venison alcatra kielbasa ribeye salami pork belly rump fatback cupim buffalo jerky pig bresaola. Picanha biltong brisket prosciutto hamburger kielbasa. Hamburger buffalo chuck spare ribs.
      Strip steak short ribs bacon, hamburger drumstick tenderloin filet mignon ball tip. Jowl biltong tenderloin doner capicola, porchetta boudin pork loin prosciutto pastrami shankle pork belly. Short ribs t-bone capicola tail tri-tip turkey chicken pig fatback ham brisket bresaola. Jerky sausage tail, venison spare ribs prosciutto meatloaf beef ribs swine shoulder tri-tip sirloin salami cupim.
      Capicola drumstick kielbasa pork jerky. Brisket chicken kielbasa salami flank short ribs, venison prosciutto swine bresaola ham spare ribs buffalo. Andouille chicken doner ball tip alcatra short loin burgdoggen. Capicola picanha strip steak meatball t-bone, bresaola cow ground round pastrami tenderloin tongue buffalo cupim prosciutto. Tongue spare ribs leberkas, pork pig jerky pancetta turducken kevin t-bone kielbasa boudin ribeye pork loin shankle. Tail drumstick turducken chuck shankle shank t-bone. Cow pastrami salami corned beef cupim alcatra, ham brisket sirloin meatloaf shankle.
    </p>
  `;
  const html = `
    <html>
      <head>
      </head>
      <body>
        ${filler.repeat(850)}
        END
      </body>
    </html>
  `;
  console.log(html.length);
  const result = await HtmlPdf.create(html, options);
  await result.toFile('long.pdf');
});

Please add a comment if you see this issue surface again.

from html-pdf-chrome.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.