PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Mar 28, 2024 10:50 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Thu Sep 19, 2013 1:15 pm 
Offline

Joined: Thu Sep 19, 2013 12:55 pm
Posts: 1
Hi,

I have a PDF file with 35 Form Fields. All the elements are recognized by using the below code:

Code:
string template = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "PDF\\Muh.pdf");
PdfDocument document = PdfReader.Open(template, PdfDocumentOpenMode.Modify);
PdfAcroForm form = document.AcroForm;


However when I try to set the Text property like this:

Code:
foreach (string str in form.Fields.Names)
{
    PdfTextField fieldName = (PdfTextField)form.Fields[str];
    fieldName.Text = str;
}


two of the elements fail because they are of type PdfGenericField. Both of these fields are according to other programs named "A.1" and "A.2" however in the above elements list they are only recognized as "A" and "X".

I have downloaded the source and I assume the problem is in the method CreateAcroField in PdfAcroField.cs as this have a switch statement with the following:

Code:
case "/Tx":
    return new PdfTextField(dict);


Which I assume does not recognize a Form Field name with a "." in it.

The following PDF have Form Fields with the naming issue: http://www.klxml.dk/KLB/Blanket/Gaelder/ab505.pdf

Is there a work around to this (a way to convert PDFGenericFields to PDFTextFields or set the value of a PDFGenericField) or is it something that needs to be fixed in the source (and how?)

Best regards and thank you in advance
Andreas


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: Baidu [Spider] and 168 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group