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

Free Support Forum - aspose.com

HTML into a pdf

I am trying to add an HTML segment into a table short of fonts the simplest format option is to center some text. If I use or

it does not seam to work. What other options do I have? The HTML editor will let me save a PDF. Is it possible to insert a pdf into a table cell. We have both pdf and pdf kit.

Thanks Mike

Hi Mike,

Are you trying to add HTML while creating a new PDF file? Or you’re trying to add HTML in an existing PDF file? Please share the scenario so we would be able to help you out accordingly.

We’re sorry for the inconvenience.

while we are createing the PDF

The senario is we have a web baseed HTML editor a user can put a "simple" (center,bold,fonts etc.) message in that will go in a table cell formated correctly. The first HTML format I tried happend to be centering and have not been able to get past that.

I attaced a simple sample of test code I have been using and the 2 PDFs it creates.

The code tries to insert centered html into a table cell. One uses the tag (A) and the other uses

The A pdf loos OK it is just not centered and the B pdf is a really messed up.

The bottom line is that I fear what else is lurking if I am having issues with basic HTML tags of

and . That is why I asked about the ability to insert some other way.


Hi Mike,

As this issue is related to Aspose.Pdf, I’m moving this thread to the relevant forum so that the concerned representative would be able to help you out.

If you have any further questions, please do let us know.

Hello Mike,

Thanks for using our products.

In order to display the contents as center aligned, you can simply specify the text alignment value as center for the table cell containing HTML string. For that reason, simply specify the value of Alignment property of Cell object as Center and use the following simple HTML string
Your Postcard

. As per your code, you can use the following code line

xcell.Alignment = Aspose.Pdf.AlignmentType.Center

In order to specify the HTML text as Bold or Italic, you can specify this information in HTML text or even you can use IsTrueTypeFontBold or IsTrueTypeFontItalic properties of TextInfo class to accomplish your requirement. In case I have not properly understood your requirement or you have any further query, please feel free to contact.

We apologize for your inconvenience.

PS, I have attached the sample PDF document with text contents as center aligned, that I have generated during my testing.

The problem with that is that the HTML content from the real application is coming from and HTML editor so centered is control by the user and one line might be and one might not.

So while that would fix the sample not does not address the 2 real issues..

1. That either HTML center option is ignored

2. that the

TestB.pdf results in vert strage behavoir even though I would consider this to be simple HTML.



Hello Mike,

I have tested the scenario and I am able to reproduce the same problem. For the sake of correction, I have logged it in our issue tracking system as 17971. We will investigate this issue in details and will keep you updated on the status of a correction. <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

We apologize for your inconvenience.