Convert web page to pdf

 To convert a web page on a WebView to pdf in Sketchware, follow the steps given below.

1. Create a more block extra in your Sketchware project and put following codes in it.


android.print.PrintJob printJob;

@androidx.annotation.RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)

private void PrintTheWebPage(WebView webView) {

android.print.PrintManager printManager = (android.print.PrintManager) this.getSystemService(Context.PRINT_SERVICE);

String jobName = "My_webpage" + webView.getUrl();

android.print.PrintDocumentAdapter printAdapter = webView.createPrintDocumentAdapter(jobName);

assert printManager != null;

printJob = printManager.print(jobName, printAdapter, new android.print.PrintAttributes.Builder().build());



2. In the button click event for saving the webpage as pdf put following codes.



} else { 

showMessage("Not available for device below Android LOLLIPOP");


Here change webview1 to id of your WebView.

3. Done. Save and run the project. For more understanding watch the video below.


  1. This comment has been removed by the author.

  2. Bro,
    Please post an article about how to convert listview into pdf

  3. Please explain a bit about the first code
    Why is webView ID in the first code but webview1 ​in the second code ?

  4. I am unable to export code and other app assets from sketchware since it was removed from play store. Can you plz guide on how to export so I can compile app code into actual apk. Thanks

  5. Worked for me can I vertically zoom webview so that I dont see webview headers.

  6. I generally check this kind of article and I found your article which is related to my interest.Ideal Pdf Editor Genuinely it is good and instructive information. Thankful to you for sharing an article like this.


Post a Comment

Popular posts from this blog

Simple car racing android game in Sketchware

Creating a Drawing View in Sketchware

Enable Fullscreen for Youtube videos in WebView

How to enable upload from webview in Sketchware?

List of Calendar Format symbols valid in Sketchware