API Documentation > Sample Codes > Sample Code: Create a Custom Screen Size Page Screenshot

Sample Code: Create a Custom Screen Size Page Screenshot

We know it is a little bit confused to use two sizes in one API. Good thing is that, we already predefined the screen size of all devices. But in case you are a advanced user who want see what the website looks like on a larger or smaller screen, we still provide this option to you.

System Predefined Screen Sizes

In our system, we already predefined the size for all devices as following:

Mobile Phones except iPhone5: 320x480

iPhone5: 320x500
iPhone6: 375x667
iPhone6+: 414x736
Tablets: 1024x768
Desktop: 1280x800

Some engineers may point out that the resolution of iPhone screen is much higher than we supported. We know it. But the mobile screen resolution does not work as we expected. That is why we define this number.

Limitations

  • 1. For iPhone4, iPhone5 and iPad, you cannot customize the screen size.
  • 2. For Android phone and windows phone, the max width is 600 and the max height is 800. (That will be a very large screen. ;J ) The min width is 200 and the min height is 200.
  • 3. For windows pad and android pad, the max width is 1280 and the max height is 1024. The min width is 400 and the min height is 400.
  • 4. For PC (Desktop or laptop), the max width is 3000 and the max height is 3000. The min width is 400 and the min height is 400.

Most Asked Question

Many customers asked why the screen parameters does not work as they expected. We found most of the case is that they did not send the correct size. For example, if you want to simulate a 400x400 screen, but the image size is still default size, you will see a very strange result. Please make sure you used the right image size as you expected. See more information about the customized image size.

Customize the PC Screen to 1024x768

Rest API

http://api.page2images.com/restfullink?p2i_url=TARGET_URL&p2i_key=YOUR_API_KEY&p2i_screen=1024x768&p2i_device=6&p2i_size=512x384

IMG API

<img src='http://api.page2images.com/directlink?p2i_url=TARGET_URL&p2i_key=YOUR_API_KEY&p2i_screen=1024x768&p2i_device=6&p2i_size=512x384'>

JS API

<img src='http://api.page2images.com/directlink?p2i_url=TARGET_URL&p2i_key=YOUR_API_KEY&p2i_screen=1024x768&p2i_device=6&p2i_size=512x384'> 
<script src="http://www.page2images.com/js/p2i.js"></script> <script> var p2i=new page2images(); p2i.thumbnail('demo');</script>
Click this here to see the demo image

Customize the Android Phone Screen Size

Rest API

http://api.page2images.com/restfullink?p2i_url=TARGET_URL&p2i_key=YOUR_API_KEY&p2i_screen=400x500&p2i_device=2&p2i_size=400x500

IMG API

<img src='http://api.page2images.com/directlink?p2i_url=TARGET_URL&p2i_key=YOUR_API_KEY&p2i_screen=400x500&p2i_device=2&p2i_size=400x500'>

JS API

<img src='http://api.page2images.com/directlink?p2i_url=TARGET_URL&p2i_key=YOUR_API_KEY&p2i_screen=400x500&p2i_device=2&p2i_size=400x500'> 
<script src="http://www.page2images.com/js/p2i.js"></script> <script> var p2i=new page2images(); p2i.thumbnail('demo');</script>
Click this here to see the demo image
Sample Codes
Download Java sample source code for website screenshot
Download PHP sample source code for website screenshot
Download Python sample source code for website screenshot
Download PHP sample source code for convert HTML to image
Use Code Generator to Build the Code

Using our Code Generator, you can quickly generate the source code for IMG Tags. Use page2images code generator for website screenshot.

Free Engineering Service

Premium and XLarge rate plan users get free help with writing and testing code. Please contact us if you need help.

version:1.7