Hi all,

I am a bit new to Itext, I would appreciate any help from you. I am trying to write to a PDf document using Java, below is my code, however I am not able to go pass the first step.

The need of the hour is that I write to an existing pdf and then open that pdf and display it to the user, I do not need to save the pdf on the server.

Can any one let me know what is wrong with this code.

Java Code:
import java.io.*;
import java.util.*;
import java.net.URL;
import javax.servlet.ServletContext;

import com.itextpdf.text.Document;
import com.itextpdf.text.pdf.AcroFields;
import com.itextpdf.text.pdf.PdfReader;
import com.itextpdf.text.pdf.PdfStamper;
import com.itextpdf.text.pdf.PdfWriter;

public class EmployeePDF {

	public void executePDF(HashMap data) throws Exception
	{
	try 
		{
			URL url = new URL("https://www.abc.com/networking/RepositoryPublicDocDownload?id=4cc4742b8c3a46de907063a0ede66570&cid=498990837&encode=application/pdf");
			PdfReader reader = new PdfReader(url);
			PdfStamper stamp = new PdfStamper(reader, new FileOutputStream("aNewPDF.pdf"));
			AcroFields form = stamp.getAcroFields();
		        form.setField("f1_46(0)","Hello");
			stamp.setFormFlattening(true);

	    	}
	 catch(Exception e)
	 {
		throw(e);
	 }   	

	}
}