Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement print to PDF now that chrome and firefox now implement this part of WebDriver spec? #355

Closed
imbilltucker opened this issue Nov 27, 2020 · 2 comments · Fixed by #462

Comments

@imbilltucker
Copy link

In the Webdriver spec, there is a print function to generate a PDF of the current webpage. Both chrome and firefox now support this print-to-pdf command.

I don't see this implemented in etaion. Did I miss it? Can it be added?

Here's the corresponding issue in Selenium: SeleniumHQ/selenium#8802

@imbilltucker imbilltucker changed the title Implement print to PDF nwo that chrome and firefox now implement this part of WebDriver spec? Implement print to PDF now that chrome and firefox now implement this part of WebDriver spec? Dec 3, 2020
@jakemcc
Copy link

jakemcc commented Apr 16, 2022

In case anyone else sees this issue and wants to do this, it was pretty easy to implement on top of etaoin.api/execute. This hasn't been battle tested but it something I'm using in a personal project.

(let [pdf-data (etaoin.api/execute {:driver driver
                                    :method :post
                                    :path [:session (:session driver) :print]})]
  (if (zero? (:status pdf-data))
    {:data (:value pdf-data)}
    {:error (:value pdf-data)}))

@lread
Copy link
Collaborator

lread commented Jun 20, 2022

Thanks @imbilltucker (and @jakemcc) I'll follow up with a PR with print support.

lread added a commit to lread/etaoin that referenced this issue Jun 21, 2022
Exposed as `print-page` (avoids conflict with clojure.core/print).

Closes clj-commons#355
lread added a commit that referenced this issue Jun 21, 2022
Exposed as `print-page` (avoids conflict with clojure.core/print).

Closes #355
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants