pdfsharp and inner pairs
Asked Answered
R

1

7

I am trying to fill the fields of pdf form and have the following code:

string filePath = @"c:\test.pdf";
string newPath = @"E\Result";

if(File.Exists(filePath))
{
  PdfDocument document = PdfReader.Open(filePath, PdfDocumentOpenMode.Modify);
  // Get the root object of all interactive form fields
  PdfAcroForm form = document.AcroForm;
  // Get all form fields of the whole document
  PdfAcroField.PdfAcroFieldCollection fields = document.AcroForm.Fields; //"/Fields"
  string[] names = fields.Names;
  names = fields.DescendantNames;
}

The problem is that it give error "A PDF name must start with a slash (/)".

I discovered that document.AcroForm has 4 pairs, one of them has key "/Fields". How do I reach it?

Raster answered 27/5, 2013 at 9:47 Comment(6)
It looks as if you took code from the working AcroForms sample that comes with PDFsharp. Maybe the problem is with the PDF file you are using.Besides
I used the same file and successfuly filled it with itextsharperRaster
The PDFsharp sample code works with our sample PDF file. It seems it does not work with your PDF file. A bounty is a strong incentive, but without your PDF file I cannot investigate this problem simply because I cannot replicate this problem.Besides
ok u can find the form in this link myfloridacfo.com/wc/provider/sample-ub-04.pdfRaster
@AMH: The file you posted uses features of Adobe 6 and cannot be processed with current versions of PDFsharp. Save the PDF files in a format that is compatible with Adobe 5.0 to process them with PDFsharp.Besides
The methods described here worked for me: #65726887Frieze
B
0

We cannot replicate the error "A PDF name must start with a slash (/)." with the sample file you provided.

The sample file you provided uses PDF features that are not (yet) supported by PDFsharp. This file cannot be used with PDFsharp.

Not the answer you are looking for. This answer is not really helpful, but we cannot help you without appropriate sample file.

Besides answered 5/6, 2013 at 8:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.