BindHTML method

Ok, now I am getting really frustrated.

I am using the evalutation copy dll's and trying to make the following method call.

Pdf pdf = new Pdf()

pdf.BindHTML(@"Hello Jim");

but I get the following error

ArgumentOutOfRangeException was unhandled by user code

index and length must refer to a location within the string

parameter name: length

How could a method with such an easy signature not wor????

Please help.

Hi Jim,

Thanks for using our products and sharing the sample source code with us.

Kindly use the complete HTML Tags as mentioned below while using the BindHTML method or if you want to use a few HTML Tags within text, please visit How to convert HTML to PDF using the InLineHTML approach for more details and code snippets.

I tested the scenario with the below-mentioned source code using Aspose.Pdf for .NET v7.0 and was unable to find any exceptions. The resultant PDF document is attached for your reference. Kindly use the below code with the latest version of Aspose.Pdf for .NET v7.0 and check if it works fine for you.

[C#]

Pdf pdf1 = new Pdf();
pdf1.BindHTML(@"<html><body><b>Hello Jim</b></body></html>");
pdf1.Save(@"d:\pdffiles\HTMLToPDF.pdf");

Please feel free to contact support if you need any further assistance.

Thanks & Regards,

Thanks for that. That worked.

Brings me to another question now. Am I able to use css style sheets? I plan on using div's to create my content structure (in table manner) instead of using tables. I already have code to do this on screen, and it would be nice to be able to reuse the logic/styling that I have.

Hi Jim,

Thanks for your feedback.

Jimboyuk:

Am I able to use css style sheets?

Yes, you can use CSS style sheet while converting HTML to PDF. Kindly visit the same link as mentioned in my previous post How to convert HTML to PDF using InLineHTML approach for more details and code snippets as per your requirement.

Please feel free to contact support in case you need any further assistance.

Thanks & Regards,