I am using IPXC_ContentCreator.ShowTextBlock to place text on the page. My setup is:
1. Language = C#
2. PDF Core API 7.0.323.3
Following is the code:
Code: Select all
contentCreator.ShowTextBlock(curZoneText, pRect, pRect, nFlags, nTextLen, pCharFmt, pParaFmt, pCallbacks, out pTextBounds);
Code: Select all
<ZoneText><![CDATA[<body><p style="font-family:'Arial'; font-size:12pt; line-height:normal;"><span style="color:#ff0000">This is html formatted text. <br/>Here is an ampersand &. <br/>Here is a greater than >. <br/>Here is a less than <.</span></p></body>]]></ZoneText>
Code: Select all
<body><p style="font-family:'Arial'; font-size:12pt; line-height:normal;"><span style="color:#ff0000">This is html formatted text. <br/>Here is an ampersand &. <br/>Here is a greater than >. <br/>Here is a less than <.</span></p></body>
If I try to Html Encode the string curZoneText then this is the string that I get:Message = "Exception from HRESULT: 0xC00CEE2C"
StackTrace = " at PDFXCoreAPI.IPXC_ContentCreator.ShowTextBlock(String pText, PXC_Rect& pRect, PXC_Rect& pClip, UInt32 nFlags, Int32 nTextLen, IPXC_CharFormat pCharFmt, IPXC_ParaFormat pParaFmt, IPXC_DrawTextCallbacks pCallbacks, PXC_Rect& pTextBounds)
at DS.DS.SD(Int32 iPageNumber) in C:\Projects\DS\DS\SD.cs:line 129"
and this is the exception that I get:<body><p style="font-family:'Arial'; font-size:12pt; line-height:normal;"><span style="color:#ff0000">This is html formatted text. <br/>Here is an ampersand &. <br/>Here is a greater than >. <br/>Here is a less than <.</span></p></body>
If I manually remove the 3 characters "&", "<" and ">" from the string it processes correctly.Message = "Exception from HRESULT: 0xC00CEE2D"
StackTrace = " at PDFXCoreAPI.IPXC_ContentCreator.ShowTextBlock(String pText, PXC_Rect& pRect, PXC_Rect& pClip, UInt32 nFlags, Int32 nTextLen, IPXC_CharFormat pCharFmt, IPXC_ParaFormat pParaFmt, IPXC_DrawTextCallbacks pCallbacks, PXC_Rect& pTextBounds)
at DS.DS.SD(Int32 iPageNumber) in C:\Projects\DS\DS\SD.cs:line 129"
If I manually encode the 3 characters "&", "<" and ">" in the string, it processes correctly.
Question: How do I get this to work properly?
Regards,
M