Aspose.Pdf for .NET does not render HTML Paragraph tags properly

Hi,
I am evaluating the Aspose.PDF for .NET. It can’t render HTML Paragraph tags properly.

For instance, I have some HTML text which contains 4 paragraphs. When display it in a web browser, it was displayed properly. But when generate PDF file using Aspose.PDF for .NET, it only generated one big paragraph.

Is this a bug? I tested in Version 4.8 and 4.9. Both have the same problem.

Thanks in advance

Rose

Hello Rose,

Thanks for using our products.

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

codewarior:

Hello Rose,

Thanks for using our products.

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



Here is the example HTML text. There are two paragraphs. But in the generated PDF file, there is only one big paragraph which combined the two into one.


<p>This site encompasses Hudson Bay east of Cape Churchill. While there is little evidence suggesting that this particular part of Hudson Bay was used as an impact zone for 30mm rockets and up to 6 in practice bombs, there is evidence that such tests were conducted in the areas north of Fort Churchill. For a fuller account of rocket, missile, and artillery tests in the larger LMA encompassing the land around Fort Churchill, please refer to Site ID MB900-020. It is entirely possible that ordnance tested at this adjacent site (MB900-020) ended up in this site.</p>
<p>This part of Hudson Bay was used as an impact zone for several types of rockets and missiles beginning in 1956 (Ref. Churchill_57; Churchill_58).</p>

I came to the forums to report the same problem! :) Glad to see confirmation that someone else is affected. It seems the

tag is ignored. Confirming the issue in both 4.8 and 4.9

Dim texBody As Aspose.Pdf.Text = New Aspose.Pdf.Text(secPage, "

Paragraph1

Paragraph2

")

texBody.TextInfo.FontName = "Arial"

texBody.TextInfo.Color = New Aspose.Pdf.Color("Black")

texBody.TextInfo.FontSize = 9

texBody.TextInfo.LineSpacing = 3.5

texBody.TextInfo.CharSpace = 0

texBody.TextInfo.WordSpace = -0.4

texBody.IsHtmlTagSupported = True

texBody.Margin.Top = 10

texBody.Margin.Bottom = 5

secPage.Paragraphs.Add(texBody)

Cheers,

Mark

Hi,

I have tested the scenario and I am able to notice the same problem. For the sake of correction, I have logged this problem as PDFNET-23031 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.

We apologize for your inconvenience.

Hi Nayyer,

can you please add to the notes for this issue, or perhaps raise a new one, that any space after the closing

is ignored?

For example if you had "

hello

Nayyer" it would render as "helloNayyer".

We have also just noticed the same behaviour with the italics tag - so it does seem like a separate issue to that outlined in this thread.

Thanks :)

Mark

Hello Mark,

The space issue is occurring because paragraphs are not properly being rendered. Once that particular issue is resolved we hope this issue will also be resolved.

Concerning to italics tag, I have tested the scenario using following code snippet and as per my observations, the tag is properly being rendered. Can you please share the source HTML that you are using. We are sorry for your inconvenience.

[C#]

Pdf pdf1 = new Pdf();
pdf1.BindHTML("Emphasized text Strong text Definition term Computer code text Sample computer code text Keyboard text Variable Citation");
pdf1.Save(@"d:/pdftest/SampleResultantPDF.pdf");

Thanks Nayyer, I agree with your conclusion that the space is related to the

issue, but it also occurs for us with . Please see our 'Remaining issues...' thread; the has been fixed for fonts such as Arial, but when using Frutiger Light (our corporate font) and still do not work - they function apparently the same as

.

The attached VB project in that thread replicates the problem.

Thank you!
Mark

Hello Mark,

I am afraid I am unable to notice the project in attachment with last post. Can you please take a look over this matter. If possible, please share the issue ID that was logged against Frutiger Light not being included in the resultant PDF.

The issues you have found earlier (filed as 23031) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

Hello, I can not run the installer file - it seems corrupt; "This installation package could not be opened. Contact the application vendor to verify that this is a valid Windows Installer package." (Windows 7, 32 bit.) I tried to download with two browsers.

Hello Mark,

Can you please again download the package and try installing it. I hope the problem would be resolved. In case you still encounter any problem or you have any further query, please feel free to contact. We apologize for your inconvenience.

Hi Nayyer, just to advise the .msi is working now, thanks for the prompt fix.

Regards,
Mark

Hi again Nayyer,


This might be a follow-up to PDFNET-23031. The attached image is a screenshot taken from the PDFs posted today in our private thread. Note the word ‘Marking’ is in a

tag, and has what seems to be excessive whitespace above and below the paragraph.


Although modifying our markup is not really an option for us, out of curiosity I added the CSS property

and whilst this has some effect, it is negligible and does not change depending on the value set.


I also note that changing the (Aspose) paragraph objects linespacing property does not influence the whitespace above and below the paragraph. Again, it is not an option for us to change this property, but I wanted to test it.

I wonder whether there is a way to reduce the whitespace above and below

?


Thanks again, Nayyer.

Mark

Hello Mark,

I have tested the scenario with the following simple HTML and as per my observations, with Aspose.Pdf for .NET 5.0.0, the space above and below the paragraph tag is same as viewing the page in web browser (IE). Can you please share some more contents that can help us in reproducing this problem. We apologize for your inconvenience.

The resultant PDF is also in attachment. Please take a look.

[HTML]



Sample line new line after 2 line breaks


Second Sample line new line after 2 line breaks



I just noticed, with Aspose.Pdf for .NET 5.0.0, the
tag added extra space when there is a space in front of it.

Se the following text example:

When there is no space in front of the break tag, it works fine.

But when there is a space infront of the break tag, it adds extra white space.

Can you see the extra space?

Rose

Hello Rose,

Thanks for using our products.

I have tested the scenario and have observed that extra line break is being displayed for the last
tag inside

. As per my observations, the issue is not related space in front of
tag. For the sake of correction, I have logged this problem as PDFNET-24250 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. We apologize for your inconvenience.

Hi Nayyer,


Thanks for the reply; I can see that the whitepace for

in the PDF is consistent with IE, and it sounds like that is the intended behaviour. I have attached a screenshot to demonstrate this.


Can we add a feature request, to be able to adjust

whitespacing (ideally through code and not markup)?


Thanks for your analysis, Nayyer.

Mark

Hello Mark,

The request to Adjust whitespacing for 'paragraph' tag has been logged in our issue tacking system as PDFNET-24287 under New Features list. We will further look into the details of this requirement and see if we can support this feature or not. Please be patient and spare us little time. We are sorry for your inconvenience.

Thanks for contacting support and keep using our products.

The issues you have found earlier (filed as 24250) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.