Hello,
i’m trying to replace a field with a table.
I have a source PDF with fields, and i need to fullfill a field with a table.
I mark the field as hidden, creat a table, and set its top-left.
The X positioning (left) is fine. But the Y (top) is shifted down.
Am i missing something?
Here’s my code. I’ve also attached the “source” PDF.
Thank you.
public byte[] GeneraDocumentoPDF()
{
byte[] result;
using (Document documentoPdf = new Document(@"c:\temp\TemplateDocTest_Mid.pdf"))
{
var paginaCompila = documentoPdf.Pages.First();
var fieldCompila = paginaCompila.FieldsInTabOrder.ToList().Find(campo => campo.FullName.Equals("CampoTable1"));
fieldCompila.Flags = Aspose.Pdf.Annotations.AnnotationFlags.Hidden;
Table tabellaTesto = new Table();
paginaCompila.Paragraphs.Add(tabellaTesto);
tabellaTesto.Left = Convert.ToSingle(Math.Min(fieldCompila.Rect.LLX, fieldCompila.Rect.URX));
tabellaTesto.Top = Convert.ToSingle(paginaCompila.PageInfo.Height - Math.Max(fieldCompila.Rect.LLY, fieldCompila.Rect.URY));
tabellaTesto.Rows.Add().Cells.Add("pippo");
using (var myStream = new MemoryStream())
{
documentoPdf.Save(myStream);
myStream.Position = 0;
result = myStream.ToArray();
}
}
return result;
}
We are checking it. However, just for a clearer understanding, instead of filling form fields, why do you want to place a table on the fields? Can you please share a little bit more of your requirements?
Well… the source pdf i sent you is just a “test”.
In real case we have some pdf documents (with images, logos, rich text formatting, etc…).
We need to fill these pdfs with a set of variable fields, and a dataset containg a list of elements, just like a kind of master-detail “report”. In the list of elements we also need to render barcodes/QRs…
Dataset has always the same structure, but we need to change the source template, based on certain fields.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.