Free Support Forum - aspose.com

Why Does Aspose.Pdf omits certain strings of text?

I have the following text that I pass into a Aspose.Pdf.Text object:

Rate 1 AUTO PARTS AND SUPPLIES
Load Port: Port of Palm Beach Seaport
Discharge Port: John Alfred Dock Seaport (Nassau)
Equipment Type: Equipment Size: Rate Basis: M
Service Type:
Ocean Charge (M): $1.56
Assessorial Charge(s):
Documentation (M): $95.00; Documentation (W): $95.00; Bunker Surcharge (M): $0.07; Surcharges (M): $0.10; Surcharges (W): $4.85; Landing (M): $0.85


Rate 2 GROCERIES
Load Port: Port of Palm Beach Seaport
Discharge Port: John Alfred Dock Seaport (Nassau)
Equipment Type: DB Equipment Size: 20 Ft Container Rate Basis: PC
Ocean Charge: $724.00
Assessorial Charge(s):
Surcharges: $104.85; Handling: $25.00; Landing: $655.98; Documentation: $95.00; Bunker Surcharge: $60.00


Rate 3 CHEMICALS
Load Port: Port of Palm Beach Seaport
Discharge Port: John Alfred Dock Seaport (Nassau)
Equipment Type: FR Equipment Size: 40 Ft Container Rate Basis: PC
Ocean Charge: $1,032.00
Assessorial Charge(s):
Surcharges: $204.85; Landing: $923.23; Handling: $50.00; Documentation: $95.00; Bunker Surcharge: $120.00

And the PDF outputs this:

ADDENDUM A

Rate 1 AUTO PARTS AND SUPPLIES

Load Port: Port of Palm Beach Seaport

Discharge Port: John Alfred Dock Seaport (Nassau)

Equipment Type: Equipment Size: Rate Basis: M

Service Type:

1.56

Assessorial Charge(s):

0.85

Rate 2 GROCERIES

Load Port: Port of Palm Beach Seaport

Discharge Port: John Alfred Dock Seaport (Nassau)

Equipment Type: DB Equipment Size: 20 Ft Container Rate Basis: PC

724.00

Assessorial Charge(s):

60.00

Rate 3 CHEMICALS

Load Port: Port of Palm Beach Seaport

Discharge Port: John Alfred Dock Seaport (Nassau)

Equipment Type: FR Equipment Size: 40 Ft Container Rate Basis: PC

1,032.00

Assessorial Charge(s):

120.00

WHY??

I even verified that the text is being passed in by doing this:

String myContent = AddendumAText.Segments[0].Content;

I see all of the Text but it doesn't want to appear on the PDF!

Here's the code that generates the Pdf:

public Pdf CreateServiceContract(Hashtable htSections)
{
Pdf pdf = new Pdf();

if (htSections == null)
throw new Exception("Error: Tropical.Pricing20.SvcContract.Bus.PDF.AsposePdf.CreateServiceContract() found the Hashtable with the list of template sections null");

if(htSections.Count == 0)
throw new Exception("Error: Tropical.Pricing20.SvcContract.Bus.PDF.AsposePdf.CreateServiceContract() found the Hashtable with the list of template sections empty (count = 0)");

HeaderFooter myHeader = new HeaderFooter();
Text HeaderText;

HeaderFooter myFooter = new HeaderFooter();
Text FooterText;

Section FirstPageSection = new Section();
Text FirstPageText;

Section AddendumASection = new Section();
Text AddendumAText;

Section AddendumBSection = new Section();
Text AddendumBText;

Section AddendumCSection = new Section();
Text AddendumCText;

Section AddendumDSection = new Section();
Text AddendumDText;


foreach (DictionaryEntry de in htSections)
{
String mySectionName = de.Key.ToString().ToUpper();
String mySectionText = de.Value.ToString();
if (mySectionName.Contains("HEADER"))
{
myHeader.DistanceFromEdge = 20;
Aspose.Pdf.Image imgTSLogo = new Aspose.Pdf.Image(myHeader);//(sec);
imgTSLogo.ImageInfo.File = @"~/Images/WOS_TSlogo_Mod.jpg";
imgTSLogo.ImageInfo.ImageFileType = ImageFileType.Jpeg;
imgTSLogo.ImageWidth = 150;
imgTSLogo.ImageHeight = 57;

HeaderText = new Text(mySectionText);
TextInfo HdrTxtInfo1 = new TextInfo();
HdrTxtInfo1.FontName = "Arial";
HdrTxtInfo1.FontSize = 14;
HdrTxtInfo1.IsTrueTypeFontBold = true;
HdrTxtInfo1.Alignment = Aspose.Pdf.AlignmentType.Center;
HeaderText.TextInfo = HdrTxtInfo1;

Text txtSpacer = CreateSpacer();

myHeader.Paragraphs.Add(imgTSLogo);
myHeader.Paragraphs.Add(txtSpacer);

myHeader.Paragraphs.Add(txtSpacer);
myHeader.Paragraphs.Add(HeaderText);
myHeader.Paragraphs.Add(txtSpacer);

//let's define the footer as well...
FooterText = CreateFooterText();
myFooter.Paragraphs.Add(FooterText);


}
if (mySectionName.Contains("OPENING AND MIDDLE"))
{
FirstPageText = new Text(mySectionText);
FirstPageSection.Paragraphs.Add(FirstPageText);

}
if (mySectionName.Contains("ADDENDUM A"))
{

AddendumASection.IsNewPage = true;
AddendumAText = new Text(mySectionText);
String myContent = AddendumAText.Segments[0].Content;
Text AddendumAPageTitleText = new Text(mySectionName);
Text txtSpacer = CreateSpacer();
AddendumASection.Paragraphs.Add(AddendumAPageTitleText);
AddendumASection.Paragraphs.Add(txtSpacer);
AddendumASection.Paragraphs.Add(AddendumAText);

}
if (mySectionName.Contains("ADDENDUM B"))
{
AddendumBSection.IsNewPage = true;
AddendumBText = new Text(mySectionText);
AddendumBSection.Paragraphs.Add(AddendumBText);


}
if (mySectionName.Contains("ADDENDUM C"))
{
AddendumCSection.IsNewPage = true;
AddendumCText = new Text(mySectionText);
AddendumCSection.Paragraphs.Add(AddendumCText);

}
if (mySectionName.Contains("ADDENDUM D"))
{
AddendumDSection.IsNewPage = true;
AddendumDText = new Text(mySectionText);
AddendumDSection.Paragraphs.Add(AddendumDText);
}

}

//now let's create this.....
FirstPageSection.OddHeader = myHeader;
FirstPageSection.EvenHeader = myHeader;
FirstPageSection.OddFooter = myFooter;
FirstPageSection.EvenFooter = myFooter;
pdf.Sections.Add(FirstPageSection);

AddendumASection.OddHeader = myHeader;
AddendumASection.EvenHeader = myHeader;
AddendumASection.OddFooter = myFooter;
AddendumASection.EvenFooter = myFooter;
pdf.Sections.Add(AddendumASection);

AddendumBSection.OddHeader = myHeader;
AddendumBSection.EvenHeader = myHeader;
AddendumBSection.OddFooter = myFooter;
AddendumBSection.EvenFooter = myFooter;
pdf.Sections.Add(AddendumBSection);

AddendumCSection.OddHeader = myHeader;
AddendumCSection.EvenHeader = myHeader;
AddendumCSection.OddFooter = myFooter;
AddendumCSection.EvenFooter = myFooter;
pdf.Sections.Add(AddendumCSection);

if (htSections.Contains("Addendum D"))
{
AddendumDSection.OddHeader = myHeader;
AddendumDSection.EvenHeader = myHeader;
AddendumDSection.OddFooter = myFooter;
AddendumDSection.EvenFooter = myFooter;
pdf.Sections.Add(AddendumDSection);
}

return pdf;

}


This message was posted using Aspose.Live 2 Forum

I SOLVED IT MYSELF!

DON'T USE DOLLAR SIGNS ($) IN YOUR TEXT AS IT WILL CONFUSE IT WITH A PAGE NUMBER.

When I generate the string to pass in to the Text object, I would format the amounts to currency format: string.Format("{0:c}", myDecimalValue)

Hi,

Thanks for your interest in our product.

I'm pleased to inform you that the issue reported earlier has been resolved in the latest hotfix for Aspose.Pdf for .NET 4.1.2 which can be accessed from here. Please try using it and in case you still face any problem or you've any further query, please feel free to contact.

We apologize for your inconvenience.