This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { //******************* iText Resim EKLEME ******************* | |
// Logoyu bitmap'e çevirip stream ile baytlara ayırıp pdfe basıyoruz | |
Bitmap bmp = BitmapFactory.decodeResource(context.getResources(), | |
R.drawable.home); | |
ByteArrayOutputStream stream = new ByteArrayOutputStream(); | |
bmp.compress(Bitmap.CompressFormat.PNG, 100, stream); | |
byte[] byteArray = stream.toByteArray(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Fontu Çekip Türkçe Karakter Sorununu Atlatmak İçin Ayarladığımız Kısım | |
BaseFont arial = null; | |
try { | |
arial = BaseFont.createFont("assets/arial.ttf", | |
BaseFont.IDENTITY_H,BaseFont.EMBEDDED); | |
} catch (Exception e) { | |
Log.e("hata","Font Çekme Hatası "+e.toString()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> | |
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.harun.pdfolusturucu; | |
import android.content.Context; | |
import android.graphics.Bitmap; | |
import android.graphics.BitmapFactory; | |
import android.os.Environment; | |
import android.util.Log; | |
import android.widget.Toast; | |
import com.itextpdf.text.BaseColor; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Bu kodları MainActivity İçerisine Yazabilirsiniz | |
// İlgili resimleri kendi resimlerinizin adıyla değiştiriniz | |
ArrayList<Integer> resimId = new ArrayList<>(); | |
resimId.add(R.drawable.harun_xyz); | |
resimId.add(R.drawable.harun_xyz_opacity_25); | |
// Context ve Resim idlerini yolluyoruz | |
new PDFOlusturucu().pdfOlustur(MainActivity.this,resimId); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
android { | |
compileSdkVersion 29 | |
buildToolsVersion "29.0.3" | |
viewBinding { | |
enabled = true | |
} | |
defaultConfig { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Android Studio 4.0 View Binding | |
android { | |
buildFeatures { | |
viewBinding = true | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainActivity extends AppCompatActivity { | |
// Bağlamadan önce tek tek tanımlama | |
private Button buttonBagla; | |
private TextView textViewBagla; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainActivity extends AppCompatActivity { | |
private ActivityMainBinding binding; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
binding = ActivityMainBinding.inflate(getLayoutInflater()); | |
setContentView(binding.getRoot()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Button | |
android:id="@+id/buttonBagla" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:text="View Binding" | |
android:layout_centerInParent="true" | |
tools:viewBindingIgnore="true"/> |