wooio / htmltopdf-java

An HTML to PDF conversion library written in Java, based on wkhtmltopdf.
MIT License
173 stars 97 forks source link

CookieJar #44

Open l-baszak opened 4 years ago

l-baszak commented 4 years ago

Hi, I'm trying to pass cookies to my html conversion, but have no idea how. HtmlToPdf contains cookieJar method, but passing string like this ->"COOKIE_LABEL=\"COOKIE_VALUE\"; expires=Thu, 03-Sep-2020 12:53:09 GMT; domain=mail.intalio.pl; path=/;") doesn't actually make any difference. I try to pass authentication cookie with session id, which will resolve my image href into actual image object.

l-baszak commented 4 years ago

I'm also adding my code snippet which using for converting

HtmlToPdf pdf_obj = HtmlToPdf.create()
                .object(HtmlToPdfObject.forHtml(<HTML_STRING>).useExternalLinks(true).enableJavascript(true).convertInternalLinksToPdfReferences(true).loadImages(true))
                .cookieJar("ZM_AUTH_TOKEN=\"<AUTH_TOKEN_STRING>\"; expires=Thu, 03-Sep-2020 12:53:09 GMT; domain=some-domain.pl; path=/;");

  boolean success = pdf_obj.convert("./test.pdf");
sliqiao commented 1 year ago

I also have the problem,but i do not know how to solve