We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

HTML form or normal PDF to AcroForm problem

Hi again!

I have a question strictly connected with making AcroForms. Is there a possible way to read a html form(i have it at server) and convert it into an acroform?

Next one - is there a possibility to edit normal pdf to make it acroform? For example I have pdf in which the first page is with name, surname and age boxes, and then I want to make an interactive box from each of them. I am asking, because now I'm trying do do it, I have web service with html to pdf converter, I load a .pdf file (htmltoPdf) and then open it with PdfLoadedDocument. Is it possible in this way?

MJ


7 Replies

MJ Maciej Jedrzejewski July 10, 2012 10:21 AM UTC

And another thing - I've got an exception in:

 

PdfLoadedDocument loadedDoc = new PdfLoadedDocument(filename);         

loadedDoc.CreateForm();

PdfPageBase page = loadedDoc.Pages.Add();

HERE: (Object reference not set to an instance of an object.)

PdfButtonField bt = new PdfButtonField(page, "Submit");

bt.Bounds = new RectangleF(0, 0, 100, 100);

bt.Text = "Submit";

loadedDoc.Form.Fields.Add(bt);

 

What am I doing wrong?

 

MJ



MJ Maciej Jedrzejewski July 10, 2012 11:57 AM UTC

Here is a null exception:

PdfButtonField bt = new PdfButtonField(page2, "Submit");

Why?



MJ Maciej Jedrzejewski July 12, 2012 08:55 AM UTC

Ok, I have already managed to solve it. We have to create this PdfPageBase page, and then add PdfPage value to it.



GL George Livingston Syncfusion Team July 13, 2012 10:02 AM UTC

Hi Maciej,

Thank you for using Syncfusion products.

We have created a sample to convert the Html form to PDF form by using the web Browser control. At first we have to convert the Html file into PDF document, then load the PDF document and add the form fields in the respective co-ordinates taken from the html file using IHTMLInputElement. Please find the sample available in the link below,

HtmlFormToPDFForm.zip

Please let us know if you have any questions.

Regards,

George



MJ Maciej Jedrzejewski July 13, 2012 12:50 PM UTC

Ok, thanks.

Now I have a second problem connected with:

if (obj is IHTMLInputElement)

{

IHTMLInputElement element = obj as IHTMLInputElement;

IHTMLElement textElement = obj as IHTMLElement;

RectangleF linkBounds = new RectangleF();

linkBounds = GetBounds(textElement, false);

PdfTextBoxField newfield = new PdfTextBoxField(lDoc.Pages[0] as PdfPageBase, element.name);

newfield.Bounds = linkBounds;

lDoc.Form.Fields.Add(newfield);

}

 

I have a null exception in this line(only with my form, because with it works well with yours):

PdfTextBoxField newfield = new PdfTextBoxField(lDoc.Pages[0] as PdfPageBase, element.name);

Why is it null? I changed a path to my html form, in this form I have a lot of controls.

Second question - is it possible to add radioboxes and another controls, such as it is possible in normal form filling? 



MJ Maciej Jedrzejewski July 16, 2012 06:34 AM UTC

Ok, the problem has been solved



GL George Livingston Syncfusion Team July 18, 2012 09:36 AM UTC

Hi Maciej,

Thank you for your update.

We are glad to hear that the issue has been resolved.

Please let us know if you have any questions.

Regards,
George

Loader.
Live Chat Icon For mobile
Up arrow icon