Android merge pdf files

In the Split Pdf file tutorial, I showed you how to split a Pdf file into multiple Pdf files using iTextG library. Sometimes, you wish to
merge multiple Pdf files into a sing Pdf file. In iTextG, merging Pdf files can be done simply as splitting a Pdf file.To achieve the goal, first you need to have a list of paths of the source Pdf files. Then you use the PdfReader to read all pages of every source Pdf file and add the pages to a PdfCopy object. In the example application below, you can merge two Pdf files into one Pdf file called meragedresult.pdf. The user is able to select the Pdf files from his/her device by clicking the browser button (...) next to the text boxes. In your phone, you need to install a File Explorer app so that you will be able to choose a Pdf file once you press the browse buttons.
﻿

Now let start with the example application. You create a new Android project. Then add two EditTexts, and three Buttons.

Here is the code written in the MainActivity class to allow the user to select Pdf files from the device and merge them. The result file is in the sdcard directory. Do not forget to declare WRITE_EXTERNAL_STORAGE permission in the AndroidManifest.xml file.

@Override // Save tag of the clicked button // It is used to identify the button has been pressed public void onSaveInstanceState( Bundle outState) { super.onSaveInstanceState(outState); outState.putString("savText", btTag);

This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages: C, C++, C#, Java, VB.NET, Python, VBA,PHP & Mysql, SQL, JSP, ASP.NET,HTML, CSS, JQuery, JavaScript and other applications such as MS Excel, MS Access, and MS Word. However, we don't guarantee all things of the web are accurate. If you find any error, please report it then we will take actions to correct it as soon as possible.