# Printing a wix web page

**URL:** <https://forum.wixstudio.com/t/printing-a-wix-web-page/12196>\
**Category:** Ask the community\
**Tags:** question, code\
**Created:** [December 2, 2017, 5:15pm UTC](https://forum.wixstudio.com/t/printing-a-wix-web-page/12196 "2017-12-02T17:15:06Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![mustafa](https://avatars.discourse-cdn.com/v4/letter/m/f19dbf/32.png) [@mustafa](https://forum.wixstudio.com/u/mustafa)\
**Post date:** [December 2, 2017, 5:15pm UTC](https://forum.wixstudio.com/t/printing-a-wix-web-page/12196/1 "2017-12-02T17:15:06Z")

</div>

Hi, I want to add a button which allows the user to print the page (essentially simulate the CTRL+P functionality)

Any suggestions?

---

<div class="post-metadata">

**Author:** ![andreas-kviby](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/andreas-kviby/32/790_2.png) [@andreas-kviby](https://forum.wixstudio.com/u/andreas-kviby)\
**Post date:** [December 2, 2017, 6:20pm UTC](https://forum.wixstudio.com/t/printing-a-wix-web-page/12196/2 "2017-12-02T18:20:49Z")

</div>

Use the javascript function window.print.

> **[Window print() Method](https://www.w3schools.com/jsref/met_win_print.asp)**
>
> W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.

---

<div class="post-metadata">

**Author:** ![mustafa](https://avatars.discourse-cdn.com/v4/letter/m/f19dbf/32.png) [@mustafa](https://forum.wixstudio.com/u/mustafa)\
**Post date:** [December 2, 2017, 8:30pm UTC](https://forum.wixstudio.com/t/printing-a-wix-web-page/12196/3 "2017-12-02T20:30:23Z")

</div>

I get this error ReferenceError: window is not defined

---

<div class="post-metadata">

**Author:** ![andreas-kviby](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/andreas-kviby/32/790_2.png) [@andreas-kviby](https://forum.wixstudio.com/u/andreas-kviby)\
**Post date:** [December 2, 2017, 9:06pm UTC](https://forum.wixstudio.com/t/printing-a-wix-web-page/12196/4 "2017-12-02T21:06:02Z")

</div>

Can you paste in your code.

---

<div class="post-metadata">

**Author:** ![admin-20](https://avatars.discourse-cdn.com/v4/letter/a/f07891/32.png) [@admin-20](https://forum.wixstudio.com/u/admin-20)\
**Post date:** [January 24, 2018, 1:11pm UTC](https://forum.wixstudio.com/t/printing-a-wix-web-page/12196/5 "2018-01-24T13:11:19Z")

</div>

The window.printf() doesn’t work due to the structure of a WixCode website. The code is sandboxed and the use of HTML and Javascript is strictly limited.

Any other option?

---

<div class="post-metadata">

**Author:** ![mustafa](https://avatars.discourse-cdn.com/v4/letter/m/f19dbf/32.png) [@mustafa](https://forum.wixstudio.com/u/mustafa)\
**Post date:** [January 24, 2018, 1:16pm UTC](https://forum.wixstudio.com/t/printing-a-wix-web-page/12196/6 "2018-01-24T13:16:36Z")

</div>

Hi Admin, is there a way to connect a PDF api?

---

<div class="post-metadata">

**Author:** ![edgar-koster](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/edgar-koster/32/1352_2.png) [@edgar-koster](https://forum.wixstudio.com/u/edgar-koster)\
**Post date:** [January 24, 2018, 8:20pm UTC](https://forum.wixstudio.com/t/printing-a-wix-web-page/12196/7 "2018-01-24T20:20:52Z")

</div>

Hi mustafa. Are you any good in js? You can use a html element, pass data to it, make it show a button, and in it add something like jspdf. With that you can make a pdf in a html page, so in the html element it should funtion too.

---

<div class="post-metadata">

**Author:** ![syed-adnan-ali](https://avatars.discourse-cdn.com/v4/letter/s/41988e/32.png) [@syed-adnan-ali](https://forum.wixstudio.com/u/syed-adnan-ali)\
**Post date:** [February 4, 2018, 8:59pm UTC](https://forum.wixstudio.com/t/printing-a-wix-web-page/12196/8 "2018-02-04T20:59:32Z")

</div>

Hey Mustafa, did you end up finding a solution for this?

---

<div class="post-metadata">

**Author:** ![darken-angel](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/darken-angel/32/876_2.png) [@darken-angel](https://forum.wixstudio.com/u/darken-angel)\
**Post date:** [February 28, 2018, 5:19am UTC](https://forum.wixstudio.com/t/printing-a-wix-web-page/12196/9 "2018-02-28T05:19:25Z")

</div>

Hi Everyone

Any one found way? otherwise help us vote for this feature as it is very useful.  
Link [here](https://support.wix.com/en/article/request-making-your-pages-printer-friendly) .

---

<div class="post-metadata">

**Author:** ![wisam-tozah](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/wisam-tozah/32/2682_2.png) [@wisam-tozah](https://forum.wixstudio.com/u/wisam-tozah)\
**Post date:** [March 24, 2018, 11:28am UTC](https://forum.wixstudio.com/t/printing-a-wix-web-page/12196/10 "2018-03-24T11:28:29Z")

</div>

Hi  
any solution ?

---

<div class="post-metadata">

**Author:** ![av-promotional](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/av-promotional/32/2796_2.png) [@av-promotional](https://forum.wixstudio.com/u/av-promotional)\
**Post date:** [June 10, 2018, 2:50pm UTC](https://forum.wixstudio.com/t/printing-a-wix-web-page/12196/11 "2018-06-10T14:50:45Z")

</div>

I understand that there is now no possibility of building a Wicks print button. The only option is by pressing ctrl p. I would be happy to know if anyone knows how I set a button to click on it and call the keyboard as if I clicked ctrl p? Thanks!

---

<div class="post-metadata">

**Author:** ![info85223](https://avatars.discourse-cdn.com/v4/letter/i/aca169/32.png) [@info85223](https://forum.wixstudio.com/u/info85223)\
**Post date:** [December 7, 2018, 12:23am UTC](https://forum.wixstudio.com/t/printing-a-wix-web-page/12196/12 "2018-12-07T00:23:40Z")

</div>

Any update so far?

---

<div class="post-metadata">

**Author:** ![darken-angel](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/darken-angel/32/876_2.png) [@darken-angel](https://forum.wixstudio.com/u/darken-angel)\
**Post date:** [December 7, 2018, 12:42pm UTC](https://forum.wixstudio.com/t/printing-a-wix-web-page/12196/13 "2018-12-07T12:42:39Z")

</div>

Hi Gentlemen

it is possible to print webpage through html component with combination of window print and html postmessage event.

Good thing is you can design/ customize the outcome as you like.

DA

---

<div class="post-metadata">

**Author:** ![andreas-kviby](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/andreas-kviby/32/790_2.png) [@andreas-kviby](https://forum.wixstudio.com/u/andreas-kviby)\
**Post date:** [December 7, 2018, 12:57pm UTC](https://forum.wixstudio.com/t/printing-a-wix-web-page/12196/14 "2018-12-07T12:57:33Z")

</div>

Do you want to print from html component at also send a message back to Wix Code using the postMessage code?

Then use the code to print from iframe and then after or before that

```javascript
window.parent.postMessage("Page has been printed", "*");

```

And that message will be sent back to the code part of your page.

---

<div class="post-metadata">

**Author:** ![salman-hammed](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/salman-hammed/32/2576_2.png) [@salman-hammed](https://forum.wixstudio.com/u/salman-hammed)\
**Post date:** [December 7, 2018, 1:50pm UTC](https://forum.wixstudio.com/t/printing-a-wix-web-page/12196/15 "2018-12-07T13:50:56Z")

</div>

@darken-angel Yes it’s possible for wix code to print the wix page

> **[Salman2301 | Print Wix Page](https://www.salman2301.com/print-page)**
>
> Printing any Wix page using the following methos. This code only works for a premium site. Paste the code in the following sections.
> HTML, Wix code Code Panel, Custom Code section

I have used in this example  
Basically you need code in three region this only work for premium site cause we need a custom code (Under tracking and analytic section in wix dashboard)

I have coded in a way that the wix code trigger \> html component code then \> it will trigger the custom code  
But you need a premium site to do this  
You can also check this blog to create a customization PDF

> **[Create PDF using Wix code and pdf-generator-api | Salman 2301](https://www.salman2301.com/forum/wix-code-advance/create-pdf-using-wix-code-and-pdf-generator-api)**
>
> A PDF is created and downloaded when the user submited a form.
> Usage: Create a Invoice, Create a certificate for the user etc. on form submission.
> Sample Website link
> Requirement: 1. Free account in pdfgeneratorapi
> 
> Overall Layout:i) PDF GENERATOR...

---

<div class="post-metadata">

**Author:** ![briangutierrez6523](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/briangutierrez6523/32/876_2.png) [@briangutierrez6523](https://forum.wixstudio.com/u/briangutierrez6523)\
**Post date:** [January 4, 2019, 5:28pm UTC](https://forum.wixstudio.com/t/printing-a-wix-web-page/12196/16 "2019-01-04T17:28:39Z")

</div>

For the meanwhile do the following:  
Click “Add”\>“More”\>click on “HTML iframe”\> and paste this code.

Print

---

<div class="post-metadata">

**Author:** ![av-promotional](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/av-promotional/32/2796_2.png) [@av-promotional](https://forum.wixstudio.com/u/av-promotional)\
**Post date:** [January 6, 2019, 11:27am UTC](https://forum.wixstudio.com/t/printing-a-wix-web-page/12196/17 "2019-01-06T11:27:33Z")

</div>

This code will help to print a blank page, just the html window but not all the background and content found on the site.

---

<div class="post-metadata">

**Author:** ![yisrael-wix](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/yisrael-wix/32/1107_2.png) [@yisrael-wix](https://forum.wixstudio.com/u/yisrael-wix)\
**Post date:** [January 6, 2019, 2:24pm UTC](https://forum.wixstudio.com/t/printing-a-wix-web-page/12196/18 "2019-01-06T14:24:21Z")

</div>

You can’t trick the **HtmlComponent** by using parent, window, top, etc. Same goes with the Javascript **evaluate()** function. It is sandboxed and does not allow access to the DOM.

---

<div class="post-metadata">

**Author:** ![chris-derrell](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/chris-derrell/32/1774_2.png) [@chris-derrell](https://forum.wixstudio.com/u/chris-derrell)\
**Post date:** [January 7, 2019, 2:14am UTC](https://forum.wixstudio.com/t/printing-a-wix-web-page/12196/19 "2019-01-07T02:14:47Z")

</div>

Like @salman-hammed said, you can only do this by entering custom JavaScript in the Tracking and Analytics section of a custom site, but it’s very possible. That’s the only set of custom code which has the scope of the webpage itself.

---

<div class="post-metadata">

**Author:** ![chris-derrell](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/chris-derrell/32/1774_2.png) [@chris-derrell](https://forum.wixstudio.com/u/chris-derrell)\
**Post date:** [February 12, 2019, 1:34pm UTC](https://forum.wixstudio.com/t/printing-a-wix-web-page/12196/20 "2019-02-12T13:34:57Z")

</div>

@ben Do you have a premium site to test it on? You can only put code into the tracking and analytics section of a premium site witha domain

[Next page](https://forum.wixstudio.com/t/printing-a-wix-web-page/12196.md?page=2)
