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

Free Support Forum - aspose.com

HTML format problems

Hi

When I have some text with no html formatting the displayed text is fine, as below:

Could you save as much as the Jones family? By following the
advice of Which? over the last 6 months, the Jones family
saved over £545#. We’re confident we could help you save
too.

But when I apply some html formatting (eg, ) the text then loses all its original styling, as below:

Could you save as much as the Jones family? By following the
advice of Which? over the last 6 months, the Jones family
saved over £545#. We’re confident we could help you save
too.

Here's the code I'm using:

<Text MarginBottom="10" IsHtmlTagSupported="True" FontName="Proxima Nova" FontSize="9">

<Segment><b>Could you</b> save as much as the Jones family? By following the advice of Which? over the last 6 months, the Jones family saved over œ545#. We’re confident we could help you save too. <font size="7"> #After switching energy providers, they’re paying œ150 less on their annual bill. They saved over œ60 by opting for a Best Buy loan to buy a car – and are earning an extra œ270 on their savings with a Best Buy ISA. What’s more, their new energy efficient tumble dryer will cut their electricity bills by œ65 a year.</font></Segment>

</Text>

Any ideas? Cheers

Andy


This message was posted using Page2Forum from Text Class - Aspose.Pdf for .NET and Java

Hello Andy,

Thanks for considering Aspose.

I have tested the issue and I am unable to reproduce the problem. Please make sure you are using latest version of Aspose.pdf. The resultant file that I have generated is in attachment.

Hi - Thanks for your reply

The problem is that I want to use 'Proxima Nova' font which is specified in the xml text tag. If I put no html formatting in the text, everything looks OK. But when I add just one html tag to the paragraph all text after the tag defaults to Times New Roman!

Would it be that if I put a single HTML tag in the paragraph, all other xml based formatting tags are lost, eg font name, size etc. and these have to be specified explicitly in the paragraph text as HTML tags instead? Please advise.

Will post code in a minute - Thanks in advance.

Here's the code:

XSL:
<Text MarginBottom="10" IsHtmlTagSupported="True" FontName="Proxima Nova" FontSize="9">
<Segment>
<xsl:if test="para05[.!='']">
<xsl:value-of select="para05" />
</xsl:if>
</Segment>
</Text>

para05 text (from database):
Could you save as much as the Jones family? By following the advice of Which? over the last 6 months, the Jones family saved over £545#. We’re confident we could help you save too. #After switching energy providers, they’re paying £150 less on their annual bill. They saved over £60 by opting for a Best Buy loan to buy a car – and are earning an extra £270 on their savings with a Best Buy ISA. What’s more, their new energy efficient tumble dryer will cut their electricity bills by £65 a year.

Output pdf:

Could you save as much as the Jones family? By following the
advice of Which? over the last 6 months, the Jones family
saved over £545#. We’re confident we could help you save
too. #After switching energy providers, they’re paying £150 less on their annual bill. They saved
over £60 by opting for a Best Buy loan to buy a car – and are earning an extra £270 on their savings with
a Best Buy ISA. What’s more, their new energy efficient tumble dryer will cut their electricity bills by
£65 a year.

As you can see, all is good until the tag, when the font defaults to Times and the size to 14 (?). Font then continues till the size is changed but the font family continues!

I am using the latest release of Aspose.Pdf.

Hope this helps.

Back to Basics!

Have tried the following:

Full XSL test page:

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="order">
<Pdf xmlns="Aspose.Pdf">
<Section ID="FirstPage" PageWidth="21cm" PageHeight="29.7cm">
<Text MarginBottom="10" IsHtmlTagSupported="True" Fontname="Proxima Nova">
<Segment>
Normal <b>bold</b> <font size="7">smaller</font>
</Segment>
</Text>
</Section>
</Pdf>
</xsl:template>
</xsl:stylesheet>

Output PDF:

Normal bold smaller


Proxima Font disappears at the first sign of an html tag! See attachment.
Thanks


Hello Andy,

I have tested the issue and I’m able to reproduce the same problem. I have logged it in our issue tracking system as PDFNET-5942. We will investigate this issue in detail and will keep you updated on the status of a correction. We apologize for your inconvenience.

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

We have tested the cases you provided above and find that it works well with the latest version of Aspose.Pdf , that is Aspose.Pdf_3.8.0.0. So please try again with the new version. If there is still problems, inform us the font which does not work. We are available anytime. By the way, the font "Proxima Nova" you mentioned above is not the one Windows Supports defaultly. You must install it in advance.

Hi

Thanks for your reply. I have fixed this by making sure that every single 'text' entity has 'IsEmbedded = true' and does NOT have 'IsUnicode=true'. This works OK for a single PDF but.....

I was trying to loop through a record set and create single pdfs, and then add all their sections to a batch pdf. Is seems that at this point it loses all the text references.

Code:

Pdf singlePDF;
Pdf BatchPDF = new Pdf();
foreach (blah.....)
{
singlePDF = new Pdf();
singlePDF.BindXml(XmlDoc); (formatting OK here)
foreach (Section s in singlePDF.Sections)
{
BatchPDF.Sections.Add(s); (formatting lost here)
}
}

Any ideas?
Cheers

Hi,

Basically we don't support the mode in your code. Please consider merging the XML first and then binding the final XML.

However if you can provide a runnable example of your project we will investigate if it is possible to support the mode in your code.