Property IsDisabled

I’ve found a paragraph property named IsDisabled in documentation for Aspose.Pdf (http://www.aspose.com/Products/Aspose.Pdf/Api/Aspose.Pdf.ParagraphMembers.html), but using the trial version I can’t access it.
My question is - is this property implemented already? All I want is to include some options (text paragraphs) in my XML template, set IsDisabled property to true and programatically show only one of them (setting it’s IsDisabled property to false).

Dear mac,

Thanks for your consideration.

The IsDisabled property is newly added. Please download the latest hot fix.

Thanks Tommy,

I replaced the DLL with the new one - it’s possible to use IsDisabled property now, but I’m getting unexpected error by pdf.Save method:

// Save the PDF
if (pdfDoc != null)
pdfDoc.Save(“TestPDF.pdf”, SaveType.OpenInBrowser, context.Response);

And the error is:
System.NullReferenceException: Object reference not set to an instance of an object.

Stack trace:
[NullReferenceException: Object reference not set to an instance of an object.]
e0.d(String A_0) +21
e0.a(String A_0, String A_1, Boolean A_2, Boolean A_3, Byte[] A_4, Byte[] A_5) +56
eb.a(e6 A_0, String A_1, Int32 A_2, Boolean A_3, Boolean A_4, String A_5, Boolean A_6) +366
eb.a(e6 A_0, String A_1, String A_2, Int32 A_3, Int32 A_4, Boolean A_5, Boolean A_6, Boolean A_7, String A_8, Boolean A_9) +358
m.a(e6 A_0, Int32 A_1, String A_2, Int32 A_3, String A_4, Int32 A_5, Boolean A_6, Boolean A_7, String A_8, Boolean A_9) +55
c6.a(e6 A_0, String A_1, String A_2, Int32 A_3, Boolean A_4, Boolean A_5, String A_6, Boolean A_7) +1722
e6.a(String A_0, String A_1, Int32 A_2, Boolean A_3, Boolean A_4, String A_5, Boolean A_6) +418
ef.a(Pdf A_0, Section A_1, Table A_2, Row A_3, Cell A_4, Text A_5, String A_6, a A_7, ey A_8) +972
b7.a(Pdf A_0, Section A_1, Table A_2, Row A_3, Cell A_4, Text A_5, a A_6, ey A_7, Boolean A_8) +2858
bj.a(Pdf A_0, Section A_1, Table A_2, Row A_3, Cell A_4, a A_5) +746
dl.a(Pdf A_0, Section A_1, Table A_2, Row A_3, a A_4) +301
bh.a(Pdf A_0, Section A_1, Table A_2, a A_3, Boolean A_4) +1060
b2.a(Pdf A_0, Section A_1, a A_2) +1098
bg.a(Pdf A_0) +427
aj.a(at A_0, Pdf A_1) +107
Aspose.Pdf.Pdf.Save(String fileName, SaveType saveType, HttpResponse response) +86


As I turn back to the original DLL, everything’s OK, except the fact I can’t use IsDisabled property. What could cause this error?

Dear mac,

Thanks for your consideration.

Would you please send me your code which can reproduce this error?

Dear mac,

Thanks for your consideration.

If you used unicode, please make sure you have set the TruetypeFontFileName. I will change my code to throw a exception if this property is not set when using unicode.

Hi Tommy,

to answer your question - yes, I’m using Unicode, but TruetypeFontFileName is set as well:



For some headings I’m using Bold, so different Font name is used (the XML and my code is
too complex to put it in this reply, that’s why only this scrap of code):


HEADING 1



Most of the paragraphs are created based on the XML template, but some are embedded dynamically. When pdf.Save(…) is called, there’s about 70 paragraphs in my document. I suppose I don’t have to set the IsUnicode property for all of them, they inherit it from parent Section, arent’t they?

Is it possible that you have changed in hotfix DLL something that differ from the previous version, that could cause the problem with Save method? By my opinion, when my code works with the older version, there could be problem in your hotfix…

And one another suggestion - would be possible to group paragraphs in some “container”, which allows to set property IsDisabled (among others) for all the paragraphs in this container? I thought that Section is the right class, but new section brings new page and I want to show/hide some paragraphs on the same page (for example: some Headings and Texts should be included in document and some should not - based on user input).

Dear mac,

Thanks for your consideartion.

I am sorry for the inconvenience you have experienced.

I have fixed a bug about truetype font in the pervious version which may cause this error. But I still can’t reproduce the error you reported. Would you please send your code to pdf@aspose.com to help me reproduce this error?

Dear mac,

Thanks for your consideration.

According to our document object model, the Section should be the “container” you want. If I add a property “IsNewPage” to Section class which will make it possible for a section don’t start a new page, will that meet your requirement?

That’s exactly what I want - Section will be container, I embed some paragraphs in it and setting Section’s property IsDisabled to true will cause that the embedded paragraphs will be not rendered - without needing to set IsDisabled for each of the paragraphs.

Dear mac,

Thanks for your consideration.

That’s OK. I will add support for this feature in the next hot fix.

OK, Tommy, when will be the next HotFix ready for launch?

Dear mac,

Thanks for your consideration.

I need 2 or 3 days to fix the bug and add the new feature.

Dear mac,

Thanks for your consideration.

  1. I have found the code which cause the exception in your code. In the PDFUtils.CreateTable() method, the following code:
// Font
Aspose.Pdf.TextInfo pdfTextInfo = new TextInfo();
pdfTextInfo.FontSize = 10;
pdfTextInfo.IsUnicode = true;
pdfTable.DefaultCellTextInfo = pdfTextInfo;

sets the IsUnicode to true but the font is default Times-Roman. So you should remove the pdfTextInfo.IsUnicode = true or add TruetypeFontFileName. The previous version can work because it has a bug which don’t use the font you set.

  1. I have add support for Section.IsNewPage.

Please download the latest hot fix here.