Closed mamunchy closed 5 years ago
Have you tried with a non-https URL?
What do you get when you try to convert http://benbarkay.com/test.html
?
If this works, then it's likely that you are missing libssl1.0
.
i have tried to convert http://benbarkay.com/test.html
but same, no pdf is generated, no error log i am using windows 10, java 1.8, spring boot 2.0.5 and 2.1.1
What's printed out if you add .error(System.out::println)
before the call to .convert(...)
?
Can you write to that location normally? Say by running something like:
try (FileWriter fw = new FileWriter(PATH_TO_PDF, false)) {
fw.append("test");
}
If it's not that, then can your process access http://benbarkay.com/test.html
? Maybe the application is blocked by firewall or some other "security" software.
my system can access http://benbarkay.com/test.html, using .error(System.out::println) now get an error:
[500] Internal Server Error io/woo/htmltopdf/HtmlToPdf
From the above error message it appears that the remote server is failing to generate a response
I'm also unable to generate a pdf from a URL. With the following code:
File report = File.createTempFile("report", ".pdf");
HtmlToPdf.create()
.object(HtmlToPdfObject.forUrl("http://benbarkay.com/test.html"))
.error(System.out::println)
.convert(report.getAbsolutePath());
Generates the following output error:
Failed loading page http:// (sometimes it will work just to ignore this error with --load-error-handling ignore)
This happens for the version 1.0.6.
I too get the url load error.
Failed loading page http:// (sometimes it will work just to ignore this error with --load-error-handling ignore)
Sorry about that. Fixed in 1.0.7
, should be public in central within several minutes.
Many thanks @benbarkay
@benbarkay can you please help me in adding page count in footer and customizable pagesize for my pdf
Here is my code boolean success = HtmlToPdf.create().pageSize(PdfPageSize.A4) .object(HtmlToPdfObject.forHtml(htmlString). headerFontSize(12). headerCenter("My Pdf title"). pageCount(true)) .convert(destination);
I am using spring boot 2.0.5 and 2.1.1 Saving HTML as a PDF file is generating file boolean success = HtmlToPdf.create() .object(HtmlToPdfObject.forHtml("
Apples, not oranges
")) .convert("/path/to/file.pdf");but "Saving a webpage from URL as a PDF file IS NOT WORKING
boolean success = HtmlToPdf.create() .object(HtmlToPdfObject.forUrl("https://github.com/wooio/htmltopdf-java")) .convert("/path/to/file.pdf"); EVEN NOT GIVE ANY ERROR.