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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

HTML form or normal PDF to AcroForm problem

Thread ID:

Created:

Updated:

Platform:

Replies:

104312 Jul 10,2012 09:04 AM UTC Jul 18,2012 09:36 AM UTC ASP.NET Web Forms (Classic) 7
loading
Tags: PDF
Maciej Jedrzejewski
Asked On July 10, 2012 09:04 AM UTC

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


Maciej Jedrzejewski
Replied On 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


Maciej Jedrzejewski
Replied On July 10, 2012 11:57 AM UTC

Here is a null exception:

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

Why?


Maciej Jedrzejewski
Replied On 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.


George Livingston [Syncfusion]
Replied On 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


Maciej Jedrzejewski
Replied On 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? 


Maciej Jedrzejewski
Replied On July 16, 2012 06:34 AM UTC

Ok, the problem has been solved


George Livingston [Syncfusion]
Replied On 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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;