Posted 4 years ago by James Zheng
Version: 16.1.0631
Avatar

Hi Actipro,

Is it possible to print the syntax editor content only for the selected text? Or only for user specified lines? (eg, line1, line 3, line 5).

Thanks and regards,

James Zheng

Comments (25)

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

Hi James,

In .NET 4.0 (which we still target), the WPF PrintDialog doesn't give us an option to allow the "selection" item to become enabled, so we don't currently support printing selected text or specified lines.  As a workaround, you could make a second SyntaxEditor instance with the content to print and use that to mimic what you're trying to do.


Actipro Software Support

Posted 4 years ago by James Zheng
Avatar

Hi Actipro,

I'm not using the WPF print dialog for print options and printing. And I believe there are users of the actipro library who use their own print dialog to customize their printing experience to fullfil the requirement of their target audience.

I understand that there are options in the editor print settings. But I'm thinking if it's possible to make use of collapsible regions to hide those lines not to be printed. Is it feasible to make it an option in the print settings?

In another word, is it possible to print ICollapsedRegionTag's text instead of the editor text where the tag resides?

Regards,

James Zheng

[Modified 4 years ago]

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

Hi James,

We will update the next build to allow custom ICollapsedRegionTag taggers to collapse text.  It still won't work with code outlining (which is a higher level implementation of collapsed regions), but it will work if you do things like the "Collapsed Regions" QuickStarts.

Note that you also would need to use a custom ITextViewTaggerProvider instead of the CodeDocumentTaggerProvider in those samples.  The custom tagger provider would need to only create a tagger for IPrinterView..


Actipro Software Support

Posted 4 years ago by James Zheng
Avatar

Thanks Actipro!

Posted 4 years ago by James Zheng
Avatar

Hi Actipro,

Is it possible that user provides the line Nos or seletion regions to be printed in the

PrintSettings and CreateFixedDocument(...) will create for us the desired pages? I need to preserve the line numbers as well.

I encountered an issue which I'm not sure if it's a bug. Steps to reproduce:

1. Open '..\\SampleBrowser\ProductSamples\SyntaxEditorSamples\QuickStart\PrintingOptions\MainControl.xaml.cs" in visual studio

2. Insert  "editor.FontSize = 48; editor.FontFamily = newFontFamily("Bauhaus 93");" @ line 85

3. Build and Run the sample projects

4. Navigate to "SyntaxEditor >> PrintingOptions"

5. You will find that the font face and font size in the print preview window are different from the ones in the syntax editor's window.

Is it a bug or I miss out something?

Thanks and regards,

James Zheng

[Modified 4 years ago]

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

Hi James,

The Font* properties on the SyntaxEditor control will only affect the UI and won't change the printouts.  You can change the plain text highlighing style instead to affect everything, like this:

AmbientHighlightingStyleRegistry.Instance[new DisplayItemClassificationTypeProvider().PlainText].FontFamilyName = "Bauhaus 93";
AmbientHighlightingStyleRegistry.Instance[new DisplayItemClassificationTypeProvider().PlainText].FontSize = 48;


Actipro Software Support

Posted 4 years ago by James Zheng
Avatar

Hi Actipro,

May I know when the next build will be out?

Thanks and regards,

James Zheng

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

Hi James,

It might be several weeks yet since we're working on new controls now.  But you can always write our support address to request a preview build of the next build if you need that functionality sooner.


Actipro Software Support

Posted 4 years ago by James Zheng
Avatar

Hi Actipro,

Another issue  is the ability to print colored background.

I did this by adding

AmbientHighlightingStyleRegistry.Instance[new DisplayItemClassificationTypeProvider().PlainText].Background 
 = new SolidColorBrush(Colors.Red);

 But no use. Is there a way to set it?

Thanks and regards,

James Zheng

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

Hi James,

Check out the "Print Options" topic in the documentation since that talks about an alternate print-only highlighting style registry that can be used.  That special registry won't affect the AmbientHighlightingStyleRegistry, and thus won't affect actual editor controls.  By doing what you're doing where you're chainging AmbientHighlightingStyleRegistry, that will affect all editor instances and printouts (assuming you didn't use the print-only highlighting style registry override).

That being said, I'm don't think we use the plain text background on printouts since it would be a big waste of ink for end users.  It's better on printouts to use a highlighting style registry that targets a light background and has appropriate highlighting style text colors for that.  By using the print-only highlighting style registry, you can still have a dark themed setup for your editors in AmbientHighlightingStyleRegistry.

I hope that helps!


Actipro Software Support

Posted 4 years ago by James Zheng
Avatar

Hi Actipro,

I'm actually using customer highlighting registery for printing in my project and setting the background of plain text for that registry to a dark color. But no use.

I agree with you that printing a dark theme wastes ink. However, this an option provided to my clients. In some cases, they will print it to e-papers, eg, pdf and xps files.

Regards,

James Zheng

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

Hi James,

Ok we will mark down the request to allow dark themes in printouts.  Right now the feature isn't supported though, so you will have to only allow light themes for printouts in the meantime.


Actipro Software Support

Posted 4 years ago by James Zheng
Avatar

Hi Actipro,

Thanks for the update.

Regards,

James Zheng

Posted 3 years ago by James Zheng
Avatar

Hi Actipro,

Thanks for your update in 16.1.0632.

I'm copying your reply above for easy reference.

**************************************************************************************

We will update the next build to allow custom ICollapsedRegionTag taggers to collapse text. It still won't work with code outlining (which is a higher level implementation of collapsed regions), but it will work if you do things like the "Collapsed Regions" QuickStarts.

Note that you also would need to use a custom ITextViewTaggerProvider instead of the CodeDocumentTaggerProvider in those samples. The custom tagger provider would need to only create a tagger for IPrinterView..

**************************************************************************************

When I implement it, I'm not able to get rid of line number '1'.

I send you the changed sample project code in a seperate Email titled 'Using Collapsible region in printing (Reference ID. 23379)'.

Below are the steps to the issue:

1. Run the sample project.

2. Navigate to '\\SyntaxEditor - General QuickStarts\Printing Options\'

3. Put the caret at line 1, Col 0

4. Drag your mouse until the caret is at line 3, Col 0.

5. Press the 'Collapse Selected Text' button.

6. Line number '3' is replaced with line number '1' in the line number margin.

Expected result:

Since I'm collapsing line 1 and line2, it's expected to hide lnie 1 and line 2, and the line number which is '3' for line 3 shouldn't be changed to '1'.

Thanks and regards,

James Zheng

[Modified 3 years ago]

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

Hi James,

Thanks for the sample.  We've improved this scenario for the next maintenance release with this change:

Updated line number display to adjust appropriately when the first characters in a line are completely collapsed without an intra-text adornment in their place.


Actipro Software Support

Posted 3 years ago by James Zheng
Avatar

Thanks!

Posted 3 years ago by James Zheng
Avatar

Hi Actipro,

When a squiggle line starts from a region to be collapsed and ends at a region not to be collapsed in the same text line, the squiggle line is not trimmed off when collapsing the region.

When a squiggle line starts from a region not to be collapsed and ends at a region to be collapsed in the same text line, the squiggle line is not drawn when collapsing the region.

Could this be fixed?

Note: The sqquiggle class is derived from TaggerBase<ISquiggleTag>

Regards,

James Zheng

[Modified 3 years ago]

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

Hi James,

Thank you for reporting this.  We've fixed it for the next maintenance release.  In the future, kindly start a new thread for new issues so that multiple separate issues have unique threads.  Thanks!


Actipro Software Support

Posted 3 years ago by James Zheng
Avatar

Noted and thanks. 

Posted 3 years ago by James Zheng
Avatar

Hi Actipro,

Thanks for the official update. Understand that this thread is getting longer. I'm sorry.

I've verified the squiggle line issues with a failure case. I copy the issues below for easy reference.

Issue 1:

When a squiggle line starts from a region to be collapsed and ends at a region not to be collapsed in the same text line, the squiggle line is not trimmed off when collapsing the region.  <<<<<<<<<<<< This is partially fixed.

If a squiggle line starts from the beggining of a line, the squiggle line is not trimmed (Not OK). Otherwise, it's trimmed (OK).

Issue 2:

When a squiggle line starts from a region not to be collapsed and ends at a region to be collapsed in the same text line, the squiggle line is not drawn when collapsing the region.   <<<<<<<<<< This is fixed.

Regards,

James Zheng

[Modified 3 years ago]

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

Hi James,

I was trying to repro #1 in the latest build per what you said but am having trouble.  If you open our SDI Editor and add some text to the first "using" statement in a C# document to make it an invalid keyword, then via the Outlining menu, stop automatic outlining and select a range and do Outlining / Hide Selection, can you tell me exactly what you do to repro the bad scenario?  Thanks!


Actipro Software Support

Posted 3 years ago by James Zheng
Avatar

Hi Actipro,

I've sent you an email titled 'RE: Print Setting' for reproducing the issue.

Regards,

James Zheng

Posted 3 years ago by James Zheng
Avatar

Hi Actipro,

Regarding the previous enquiry:

Ok we will mark down the request to allow dark themes in printouts. Right now the feature isn't supported though, so you will have to only allow light themes for printouts in the meantime.

May I know if this will be included in the next release?

Regards,

James Zheng

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

Hi James,

Sorry but no, we haven't implemented printing using dark themes.


Actipro Software Support

Posted 3 years ago by James Zheng
Avatar

Hi Actipro,

Ok. Please keep me informed when it's being implemented. Thanks.

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.