문제

I have a problem with the generation of a PDF with wkhtmlpdf. Here is my investigation:

1- Generation of PDF with static Google Map image in default mode (default size)

The web page and PDF contain the image.

2- Generation of PDF with static Google Map image with business licence (customize size)

The web page contains the image, the PDF not.

3- In command line

If I run in command line the wkhtmlpdf instruction, I receive this exception code:

Exit with code 1 due to http error: 1202

The only difference between the both is the url parameters &client=XXXXX and &signature=YYY are added for the business call at Google.

I didn't find a description for this http error code on the net and I wonder me if it's really a right http error code.

I am not an expert with wkhtmltopdf.

도움이 되었습니까?

해결책

This is actually issue #1502 and is fixed in the development version, for which you can download a snapshot from the website.

다른 팁

So, the description for this error code is: PDF generated OK, but some request(s) did not return HTTP 200.

In waiting the final version, I decided to load the Google Map image in local and after put a reference in the web page.

With this solution, I don't have any exception while the generation of PDF.

Below is the code to load and save the Google Map image.

String myUrl = "http://www.lesoir.be/sites/default/files/imagecache/475x317/2014/04/02/1670051557_B972392274Z.1_20140402231342_000_GIT27H8H9.2-0.jpg";

URL imageURL = new URL(myUrl);
RenderedImage img = ImageIO.read(imageURL);


File outputfile = new File("C:\\Dev\\Tmp\\Img\\image.jpg");
ImageIO.write(img, "jpg", outputfile);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top