Issue in rendering DOC to PDF after PageCount() call

Hi Support.

You have a sample project called HelloWorld demonstrating Words (this will be the quickest way for you to replicate this) after: builder.Writeln(“Hello World!”);

If you have this code:

doc.Range.Replace("Hello", "Hello" + "aaa", false, false);
var a = doc.PageCount;
doc.Range.Replace("Hello", "Hello" + "bbb", false, false);

Then try to save as Pdf, the second replacement is not saved. The PageCount call seems to interfere with the document somehow. Although saving to docx for example there is no problem.

Can you please look into it and fix asap.

Thanks.

This message was posted using Email2Forum by Tilal Ahmad Sana.

Hi Robert,

Thanks for your inquiry. Please use the following code to get the desired output.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.Writeln("Hello World!");
doc.Range.Replace("Hello", "Hello" + "aaa", false, false);
var a = doc.PageCount;
doc.Range.Replace("Hello", "Hello" + "bbb", false, false);
doc.UpdatePageLayout();
doc.Save(MyDir + @"out.pdf");

I hope, this helps.

Best regards,