Print without syntax hightlighting

SyntaxEditor for WPF Forum

Posted 3 years ago by James Zheng
Version: 16.1.0633
Avatar

Hi Actipro,

I would like to print editor's content without the syntax hightlighting by setting IsSyntaxHighlightingEnabled to false. It works out fine except for the squiggle lines. The squiggle lines are all printed in red. I would like to hide the squiggle lines during printing.

I did it by unregistering the squiggle tagger service. After printing, I register it back. The end result is good, but I can observe the disappearance of squiggle lines in the editor during printing.

I've tried to change the style in the registry for squiggle, but it seems it has no effect. The squiggle display is default to red.

Is there a better to achieve this? If we can do it in the print setting, it'll be better.

Regards,

James Zheng

[Modified 3 years ago]

Comments (6)

Answer - Posted 3 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi James,

You can register a different style for the SyntaxError classifiction type like this:

AmbientHighlightingStyleRegistry.Instance.Register(ClassificationTypes.SyntaxError, new HighlightingStyle(new SolidColorBrush(Colors.Gray)));

That will affect editors too.  Or you could alternatively supply a custom IHighlightingStyleRegistry via the editor.PrintSettings.HighlightingStyleRegistry, then you can use a custom SyntaxError style for that.  That would only affect printouts within that editor.


Actipro Software Support

Posted 3 years ago by James Zheng
Avatar

Hi Actipro,

As I mentioned earlier, I've tried changing the registry styles for squiggle lines.

If IsSyntaxHighlightingEnabled is false, the squiggle lines are printed in red. There is no way of changing it.

I've defaulted IsSyntaxHighlightingEnabled to true, and set all the styles in the registry to default color when I don't want to print with syntax color. This works.

That means I cannot use IsSyntaxHighlightingEnabled, but need to set to it to true, even I don't want to print syntax highlighting. It will confuse other developers in the future.

Regards,

James Zheng

[Modified 3 years ago]

Answer - Posted 3 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi James,

Thanks for letting us know.  For the next build, we will update the squiggle fallback color in printer views with syntax highlighting disabled to be gray instead of red.


Actipro Software Support

Posted 3 years ago by James Zheng
Avatar

Hi Actipro,

Could we have the option to not print warnings and errors. Some people don't like messy print-outs. :)

Regards,

James Zheng

[Modified 3 years ago]

Posted 3 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi James,

You can do that now if you make this tagger which has a view constructor:

public class ViewParseErrorTagger : ParseErrorTagger {
	public ViewParseErrorTagger(IEditorView view) : base(view.SyntaxEditor.Document) {}
}

Then do this to your language:

language.UnregisterService<CodeDocumentTaggerProvider<ParseErrorTagger>>();
language.RegisterService(new TextViewTaggerProvider<ViewParseErrorTagger>(typeof(ParseErrorTagger)));

That will effectively remove the document-based tagging and make it IEditorView only.


Actipro Software Support

Posted 3 years ago by James Zheng
Avatar

Hi Actipro,

Thanks for the info.

Regards,

James Zheng

The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.