<?php  

if (isset($_POST['submit']))
define('FPDF_FONTPATH','font/');
{


//above line is import to define, otherwise it gives an error : Could not include font metric file



	require_once('fpdf.php');  
	require_once('fpdi.php');  
	 
	// initiate FPDI  
	$pdf =& new FPDI();  
	// add a page  
	$pdf->AddPage();  
	// set the sourcefile  
	$pdf->setSourceFile('SerbiavisaForm.pdf');  
	// import page 1  
	$tplIdx = $pdf->importPage(1);  
	// use the imported page and place it at point 10,10 with a width of 100 mm  
	//$pdf->useTemplate($tplIdx, 10, 10, 100);  
$pdf->useTemplate($tplIdx, 20, 20, 150); 
	 
	// now write some text above the imported page  
	$pdf->SetFont('Arial','B',8); 
	$pdf->SetXY(90, 76);  
	$pdf->Write(0, "$_POST[post1]");  

$pdf->SetXY(90, 83);  
	$pdf->Write(0, "$_POST[post2]");  

$pdf->SetXY(90, 90);  
	$pdf->Write(0, "$_POST[post3]");  

$pdf->SetXY(90, 96);  
	$pdf->Write(0, "$_POST[post4]");  

$pdf->SetXY(90, 103);  
	$pdf->Write(0, "$_POST[post5]");  

$pdf->SetXY(90, 115);  
	$pdf->Write(0, "$_POST[post6]");  

$pdf->SetXY(90, 124);  
	$pdf->Write(0, "$_POST[post7]");

$pdf->SetXY(90, 133);  
	$pdf->Write(0, "$_POST[post8]");

$pdf->SetXY(90, 143);  
	$pdf->Write(0, "$_POST[post9]");

$pdf->SetXY(90, 156);  
	$pdf->Write(0, "$_POST[post10]");

$pdf->SetXY(90, 166);  
	$pdf->Write(0, "$_POST[post11]");
	 
	$pdf->Output('newpdf.pdf', 'D'); 

}



else 

{

print "<form action='' method='post' name='form'>";

    print "Family Name:   <input type='text' name='post1' length='15'><br>";
  print "Father's/Mothers's name:   <input type='text' name='post2' length='15'><br>";
  print "Name:   <input type='text' name='post3' length='15'><br>";

 print "Country and date of Birth:   <input type='text' name='post4' length='15'><br>";

 print "Citizenship:   <input type='text' name='post5' length='15'><br>";

 print "Type Number,Expiration date and all:   <input type='text' name='post6' length='15'><br>";

print "Applicants Home address:   <input type='text' name='post7' length='15'><br>";

print "Occupation:   <input type='text' name='post8' length='15'><br>";

print "Details on previous visits to serbia:   <input type='text' name='post9' length='15'><br>";

print "Details of visit: fullname address and all:   <input type='text' name='post10' length='15'><br>";

print "Application referes this period from :   <input type='text' name='post11' length='15'><br>";


    print "<input type='submit' name='submit' value='Get it'>";
    print "</form>";


}

?>


