0

I am trying to use phantomjs to turn html into pdf, and I have some html code with image src attributes that have "?" in them so that they can pass in info from the get array.

Example

<!DOCTYPE HTML>
<html>
<head>
</head>
<body>
<img src="www.somewhere.com/pictures?id=1229384&key=somekey"/>
<div><a href="www.somewhere.com/pictures?id=1229384&key=somekey">link</a></div>
</body>
</html>

When I try to turn the html into a pdf using phantomJS rasterize.js it cuts the href and the src at the "?" and the stuff in the get information is not passed in, and thus the image does not appear.

Does anyone know how I can get passed this?

  • Sorry the href was supposed to be in the anchor tag and img was supposed to say src, i'll edit the question – Curious_goat Jul 03 '15 at 13:45
  • PhantomJS is a "normal" browser. It handles doesn't simply throw away the query. Perhaps there is something else going on. How the page is built together. Please register to the `onConsoleMessage`, `onError`, `onResourceError`, `onResourceTimeout` events ([Example](https://gist.github.com/artjomb/4cf43d16ce50d8674fdf)). Maybe there are errors. – Artjom B. Jul 03 '15 at 13:57
  • @Curious_goat Use `casper.options.verbose = true; casper.options.logLevel = "debug";` to get erros – Diego Borges Jul 03 '15 at 14:29
  • Thanks For your help Artjom and Diego, I included the error stuff in the code and I saw unable to load resource and ssl handshake failed, and was able to solve the problem using this post http://stackoverflow.com/questions/26415188/casperjs-phantomjs-doesnt-load-https-page – Curious_goat Jul 03 '15 at 15:21

0 Answers0