We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Is it possible to achieve such functionality using this component

I am having a web page and I want to generate the pdf from this page with some form field, or should I create the pdf form from scratch?


Thanks

Hi,

Thanks for your interest in our products.

In case you need to convert an HTML page into PDF format, please try using the code snippet specified over HTML to PDF using InLineHTML. If the source HTML file contains form fields, they will be placed over the resultant PDF.

In case you need to create a PDF document from scratch containing form fields, please visit the following link for information on Manipulating Form Fields

However once the HTML page is converted into PDF format and you need to place form fields inside it, you need to open the existing PDF file and place required form fields over it. For the reason you need to try using Aspose.Pdf.Kit. For more information, please visit Fill PDF Form and Form Fields

In case I have not properly understood your requirements or you have any further query, please feel free to contact.

does it mean I need to purchase two separate components?

Hi,

At the moment we have two separate products i.e. Aspose.Pdf for .NET and Aspose.Pdf.Kit for .NET and both products have separate license. However, we are going to publish a Merged product with combined features of both components. So you will have a single component with the capabilities to create PDF documents from scratch as well as, you can use it to manipulate the existing PDF documents. Please be patient as we expect to roll out this product shortly and once the new version is released, we would be more than happy to update you with the status of availability.

In the event of any further query, please feel free to contact.

PS, If you buy the license for Aspose.Pdf for .NET, you will be entitled to use the new Merged API.

I tried the first solution you provide, but it doesn’t work. it only generate the empty pdf with aspose watermark on it

Hi,

Thanks for sharing the information.

Can you please share the source HTML file so that we can test the scenario at our end. We apologize for your inconvenience.

I just copy the exactly same code in the sample (the one convert from wiki website to pdf), it doesn’t work at all

Hello Vincent,

Thanks for your interest in our products.

Aspose.Pdf for .NET can produce adequate results when converting convert offline web pages into PDF format. However it's causing some issues when converting live web pages into PDF format (depending upon the complexity of source file). For the sake of correction, I have logged it as PDFNET-28875 in our issue tracking system. We will further look into the details of this problem and will keep you updated on the status of correction.

Can you please try converting offline web pages into PDF format and in case you encounter any problem or you have any further query, please feel free to contact. Please visit the following link for information on supported HTML tags. HTML Tags in Text

We apologize for your inconvenience.

Hi codewarior


Thanks for your reply. I tried the offline page either, it doesn’t work either. We need to make decision to make a purchase, but that’s the core functionality we need. Can you provide any working solution for me?

see my below sample code

here is my html page which need to be export as pdf with form fields


Product Name
Quantity
ABC123
DEF567
GHI8910

Here is my code behind code (which I copy the same code from the online sample you provided me in your first reply)

void cmdRender_Click(object sender, EventArgs e) {
//Test();
using (StreamReader sr = File.OpenText(Server.MapPath("~/OrderForm.htm"))) {

// Instantiate an object PDF class
Pdf pdf = new Pdf();
// add the section to PDF document sections collection
Aspose.Pdf.Section section = pdf.Sections.Add();
string test = sr.ReadToEnd();
Aspose.Pdf.Text text2 = new Aspose.Pdf.Text(section, sr.ReadToEnd());

// enable the property to display HTML contents within their own formatting
text2.IsHtmlTagSupported = true;
//Add the text paragraphs containing HTML text to the section
// Set the Font of Section as “Verdana”
text2.TextInfo.FontName = “Verdana”;
// Set the font size of the section as 9
text2.TextInfo.FontSize = 9;
// If you need to display all the text in Olive Color
text2.TextInfo.Color = new Aspose.Pdf.Color(“Olive”);
// Add the text object containing HTML contents to PD Sections
section.Paragraphs.Add(text2);
//Save the pdf document
pdf.Save(Server.MapPath(“Test.pdf”));
}
}

Hi,

Thanks for sharing the details.

I have tested the scenario using Aspose.Pdf for .Net 5.3.0 and as per my observations, the HTML file is properly being converted into PDF format. Please take a look over the attached resultant PDF that I have generated.

[C#]

// Instantiate an object PDF class
Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();
// add the section to PDF document sections collection
Aspose.Pdf.Section section = pdf.Sections.Add();

// Read the contents of HTML file into StreamReader object
StreamReader r = File.OpenText(@"D:/pdftest/Sample.html");
//Create text paragraphs containing HTML text
Aspose.Pdf.Text text2 = new Aspose.Pdf.Text(section, r.ReadToEnd());
// enable the property to display HTML contents within their own formatting
text2.IsHtmlTagSupported = true;
//Add the text paragraphs containing HTML text to the section
section.Paragraphs.Add(text2);
//save the resultant PDF
pdf.Save(@"d:/pdftest/HTML_Test.pdf");

Please observe that the text fields in PDF document are editable and they are not appearing as static images. Can you please share which version of Aspose.Pdf for .NET you are using ? We apologize for your inconvenience.

I am using the .net 4.0 version


The dll version number is 5.3.0.0

I think I’ve figured out the problem. see the difference between your cs code and my cs code. I am using the “using” keyword to dispose the streamreader once it’s finished. Somehow, it’s also clear out the pdf content. Is the default behaviour of this product?


Also I noticed the text box has been convert to the form field that’s great and what I need, however once I clicked the textbox, it also display up/down arrow next to the textbox, but when I enter a number and use that to increase and decrease, it doesn’t work. I’d like to know is it possible to remove that? coz if it doesn’t work, it will confuse the user. Thanks

javafun:
I think I’ve figured out the problem. see the difference between your cs code and my cs code. I am using the “using” keyword to dispose the streamreader once it’s finished. Somehow, it’s also clear out the pdf content. Is the default behaviour of this product?
Hi,
I have again tested the scenario using following code snippet and I am unable to notice any problem. The resultant PDF is properly being generated.
[C#]

using (StreamReader sr = File.OpenText(@"D:/pdftest/Sample.html"))
{
// Instantiate an object PDF class
Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();
// add the section to PDF document sections collection
Aspose.Pdf.Section section = pdf.Sections.Add();
// Read the contents of HTML file into StreamReader object
// StreamReader r = File.OpenText(@"D:/pdftest/Sample.html");
//Create text paragraphs containing HTML text
Aspose.Pdf.Text text2 = new Aspose.Pdf.Text(section, sr.ReadToEnd());
// enable the property to display HTML contents within their own formatting
text2.IsHtmlTagSupported = true;
//Add the text paragraphs containing HTML text to the section
section.Paragraphs.Add(text2);
//save the resultant PDF
pdf.Save(@"d:/pdftest/BottomLeft_Test.pdf");
}

javafun:
Also I noticed the text box has been convert to the form field that's great and what I need, however once I clicked the textbox, it also display up/down arrow next to the textbox, but when I enter a number and use that to increase and decrease, it doesn't work. I'd like to know is it possible to remove that? coz if it doesn't work, it will confuse the user. Thanks

As per my observations, I am able to see the Up/Down scroll controls when I have entered Characters or Numerical values inside the field. Can you please share some more details regarding the issue that you are facing. I am viewing the resultant PDF in Adobe Reader 7.0.0. We are really sorry for your inconvenience.

Hi codewarior

Thanks for your fast response.

I am sorry, you are right. I forget to comment our one line of my code for debugging purpose, which I assign the streamreader value to a variable, that's why I always receive the empty pdf file.

But the up/down scroll controlls doesn't work in my adobe reader which is Adobe reader X. I am not sure aspose pdf component is compatible with all version of adobe reader or not? I don't mind if there is a way to disable or remove up/down scroll control without causing the customer confusion.


Hi,

Thanks for sharing the details and I am pleased to hear that your first problem is resolved.

Regarding second issue, I will further test the scenario with Adobe Reader X and will update you with my findings. More along as per your request, I have logged the requirement to "disable Up/Down scroll controls beside Text field in resultant PDF" as PDFNET-28886 in our issue tracking system under New Features list. We will further look into the details of this requirement and will keep you updated on the status of correction. Please be patient and spare us little time.

We apologize for your inconvenience.

Hi codewarior


I’d like to know when that bug “up/down scroll control” can be fixed? otherwise I have to create pdf form from scratch

Hi,

As we just have logged this requirement so it's pretty difficult to estimate the timelines by which the requirement will be implemented. However, I have requested the development team to share the ETA regarding its resolution. Please be patient and spare us little time. Your patience and comprehension is greatly appreciated in this regard.

Hi,

I am pleased to share that the first version of Merged Aspose.Pdf for .NET containing combined features of Aspose.Pdf for .NET and Aspose.Pdf.Kit for .NET has been published. Please check out following blog post for further details.

Hi codewarior

I’m facing another problem, I am trying to convert a html page to pdf, somehow aspose.pdf keep throwing the exception.

Here is the error details

#fff url(‘http://haemophilia.local/common/images/bg-cal-date.gif’) no-repeat center -80px is not a valid value for Int32.

Here is my css in the html page

.year-cal td.cal td.order-date { background: #FFF url(’/Common/Images/bg-cal-date.gif’) no-repeat center 0; }

Hi,

The HTML and CSS files that you are using for conversion, are they different from one's that you have already shared in this thread ? In case you are facing issues while converting some other files, please share the resource files so that we can test the scenario at our end. Also please share the version of product that you are using. We are really sorry for this inconvenience.

More along, I have further tried viewing the PDF document containing text form field over Adobe Reader X and I am unable to notice any problem. Please take a look over the attached image file showing the behavior.