Dear all:
I work for a project which will create pdf by inserting data(collected
from html forms) into precreated pdf templates. I use AcroFields to pass
data to the pdf template, it works and all the data could be shown in the
new generated pdf, which is good.
However, I also want to put an hidden htmllink within the data.
I know we could :
/ Anchor anchor = new Anchor(
"http://tutorials.jenkov.com/java-itext/index.html");
anchor.setReference(
"http://tutorials.jenkov.com/java-itext/index.html");
paragraph.add(anchor);
document.add(paragraph);/
if I create pdf without using pdf template.
Since I use Acrofields to pass data into pdf(Acrofields.SetProperty only
pass string) how could I pass the anchor into pdf with Acrofields?
My codes below:
*private MemoryStream GetForm2a(int formId)
{
DataSet ds = BLLForm.GetForm2aTablesById(formId);
string pdfPath = Server.MapPath(FORMPF_TEMPLATE_FOLDER +
"Form2a_new.pdf");
var reader = new PdfReader(pdfPath);
MemoryStream output = new MemoryStream();
var stamper = new PdfStamper(reader, output);
stamper.Writer.CloseStream = false;
AcroFields af = stamper.AcroFields;
DataTable exposures = ds.Tables["Exposures"];
foreach (DataRow row in exposures.Rows)
{
for (int j = 0; j < exposures.Columns.Count; j++)
{
af.SetField("form2a_exposures_m" + row["MonthNumber"] +
"_" + exposures.Columns[j].ColumnName,
Convert.ToString(row[exposures.Columns[j].ColumnName]));////!!Here I
////!want to pass anchor with the data!!!!!
}
DataTable turnover = ds.Tables["Turnover"];
foreach (DataRow row in turnover.Rows)
{
for (int j = 0; j < turnover.Columns.Count; j++)
{
af.SetField("form2a_turnover_m" + row["MonthNumber"] +
"_" + turnover.Columns[j].ColumnName,
Convert.ToString(row[turnover.Columns[j].ColumnName]));
}
}
DataTable countries = ds.Tables["Countries"];
foreach (DataRow row in countries.Rows)
{
for (int j = 0; j < countries.Columns.Count; j++)
{
af.SetField("form2a_countries_" +
countries.Columns[j].ColumnName,
Convert.ToString(row[countries.Columns[j].ColumnName]));
}
}
stamper.Close();
reader.Close();
return output;
*
Sorry for my messed English.
Thank you very much, any suggestions welcome.
--
View this message in context:
http://itext-general.2136553.n4.nabble.com/Pass-anchor-when-using-AcroFields-tp4655966.html
Sent from the iText - General mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php