Free Support Forum - aspose.com

Blank page in converted tiff from hidden characters

We have some documents with hidden characters at the end that cause a blank page when saving as tiff. Can you suggest a way to either trim the hidden characters from the Word doc prior to conversion or remove blank pages from the resulting tiff?

Hi

Thanks for your request. Could you please attach your input document here for testing? We will check the issue and provide you more information.

Best regards,

Attached example. You’ll need to remove “.txt” from the tiff file because you don’t allow tiff uploads.

Hi

Thank you for additional information. I managed to reproduce the problem on my side. Your request has been linked to the appropriate issue. You will be notified as soon as it is resolved.

As a temporary workaround, you can simply remove hidden text from the document before rendering:

[Test]

public void Test001()

{

Document doc = new Document(@"Test001\in.doc");

doc.Accept(new HiddenTextHelper());

doc.Save(@"Test001\out.tiff");

}

private class HiddenTextHelper : DocumentVisitor

{

///

/// Called when a FieldEnd node is encountered in the document.

///

public override VisitorAction VisitFieldEnd(FieldEnd fieldEnd)

{

if (fieldEnd.Font.Hidden)

fieldEnd.Remove();

return VisitorAction.Continue;

}

///

/// Called when a FieldSeparator node is encountered in the document.

///

public override VisitorAction VisitFieldSeparator(FieldSeparator fieldSeparator)

{

if (fieldSeparator.Font.Hidden)

fieldSeparator.Remove();

return VisitorAction.Continue;

}

///

/// Called when a FieldStart node is encountered in the document.

///

public override VisitorAction VisitFieldStart(FieldStart fieldStart)

{

if (fieldStart.Font.Hidden)

fieldStart.Remove();

return VisitorAction.Continue;

}

///

/// Called when a Footnote end is encountered in the document.

///

public override VisitorAction VisitFootnoteEnd(Footnote footnote)

{

if (footnote.Font.Hidden)

footnote.Remove();

return VisitorAction.Continue;

}

///

/// Called when a FormField node is encountered in the document.

///

public override VisitorAction VisitFormField(FormField formField)

{

if (formField.Font.Hidden)

formField.Remove();

return VisitorAction.Continue;

}

///

/// Called when a Paragraph end is encountered in the document.

///

public override VisitorAction VisitParagraphEnd(Paragraph paragraph)

{

if (paragraph.ParagraphBreakFont.Hidden)

paragraph.Remove();

return VisitorAction.Continue;

}

///

/// Called when a Run node is encountered in the document.

///

public override VisitorAction VisitRun(Run run)

{

if (run.Font.Hidden)

run.Remove();

return VisitorAction.Continue;

}

///

/// Called when a SpecialChar is encountered in the document.

///

public override VisitorAction VisitSpecialChar(SpecialChar specialChar)

{

if (specialChar.Font.Hidden)

specialChar.Remove();

return VisitorAction.Continue;

}

}

Hope this helps.

Best regards,

The issues you have found earlier (filed as WORDSNET-5507) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.