![]() ![]() It can be as complex as you like and may include image references and stylesheeet information - just make sure it is valid HTML You can also convert an HTML string to a PDF by supplying the HTML directly. Example #3 - How to convert an HTML string to a PDF using Android.InputStreamReader request = new InputStreamReader(, apiURL,įile pdfFile = new File (localFolder, "MySampleImageFile.jpg") Params.put("OutputFormat", "jpg") // Set Output format as JPG to convert page into image. You can use "png", "bmp" or "svg" formats for images. Line #9 allows you to change the default output format so the html is converted into an image. Example #2 - How to convert a webpage to an image using Android. ![]() Toast.makeText(getBaseContext(), "Error while generating PDF file!!", Toast.LENGTH_LOG).show() OutputStream opStream = new FileOutputStream(pdfFile) InputStreamReader request = new InputStreamReader(, apiURL, new void onResponse(byte response)įile localFolder = new File(Environment.getExternalStorageDirectory(), "WebPageToPDF") įile pdfFile = new File (localFolder, "MySamplePDFFile.pdf") a url starting with http or an HTML string note: be sure to copy the helper function ConvertHTMLStringToPDF() from this webpage Example #1 - How to convert a webpage to a PDF using Android. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |