PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Force calculation of calculated field
https://forum.pdfsharp.net/viewtopic.php?f=2&t=2531
Page 1 of 1

Author:  maxime [ Thu Jul 25, 2013 8:52 pm ]
Post subject:  Force calculation of calculated field

Hello,

Can anyone tell me if it's possible to ensure that calculated fields are correctly calculated after setting the value of a field with PDFSharp?
I read on the internet that it's not possible or really difficult to achieve.
I just want to be sure.

When I set the value of a field, calculated field have the same value as they did before setting the value.
If I set the value using adobe reader, then calculated are updated with new values.
Is it possible to have the same behavior when setting the value with PDFSharp?
Here is my code.
using PdfSharp.Pdf;
using PdfSharp;
using PdfSharp.Pdf.IO;
using PdfSharp.Pdf.AcroForms;

private void button1_Click(object sender, EventArgs e)
{
string fileN4 ="C:\test.PDF";
PdfDocument document = PdfReader.Open(fileN4, PdfDocumentOpenMode.Modify);

PdfTextField currentField = (PdfTextField)(document.AcroForm.Fields["TopPos_X"]);
PdfString caseNamePdfStr = new PdfString("68,96");
//set the value of this field
currentField.Text = "68,96";// caseNamePdfStr;
//currentField.Value = caseNamePdfStr;

// Save the document...
document.Save(fileN4);
}

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/