iText7 ViewerPreferences: Should display Bookmarks by default - itext7

I create a PDF with iText7, which should not show the toolbar. But it should display the area with the bookmarks/outlines.
PdfViewerPreferences pref = new PdfViewerPreferences();
pref.SetHideToolbar(true); // works
pref.SetNonFullScreenPageMode(PdfViewerPreferences.PdfViewerPreferencesConstants.USE_OUTLINES); // doesn't work
pdfDocument.GetCatalog().SetViewerPreferences(pref);
Acrobat Reader should display it this way:

Documentation of SetNonFullScreenPageMode clearly says the following:
This entry is meaningful only if the value of the PageMode entry in the Catalog dictionary is FullScreen
Thus you need to also add the following line in order for your configuration to become active:
pdfDocument.GetCatalog().SetPageMode(PdfName.FullScreen);
However, this will make Acrobat ask you to enter full screen mode on opening the PDF and in full screen mode nothing is shown but the page content.
What you are really looking for is setting PageMode to UseOutlines:
pdfDocument.GetCatalog().SetPageMode(PdfName.UseOutlines);
Full code:
PdfViewerPreferences pref = new PdfViewerPreferences();
pref.SetHideToolbar(true);
pdfDocument.GetCatalog().SetViewerPreferences(pref);
pdfDocument.GetCatalog().SetPageMode(PdfName.UseOutlines);

Related

Some Elements not being identified by Flaui while is shown in Inspect tool and the value property is not being read as in application

Trying to automate my windows application with FlaUI and noticed some components are not recognized.
Launch application immediately opens a window which has a Grid Pane.
The opened window has an item to be selected from the grid (from the list of items) to proceed further.
However UIA3 and UIA2 finds it difficult to get the element and its Value. (see below)
enter image description here
In the above screenshot the Value is supposed to be “Item to be selected from the list” but instead it is [#30093]. Q: How to get the actual value from application??
While verifying in inspect.exe I noticed that the components are displayed but the same is not shown in FlauInspect.exe (screens below)
SSC window has 7 subitems shown by Inspect while in Flauinspect.exe it shows only a button.
Inspect.exe
enter image description here
Flauinspect.exe
enter image description here

Can I set tab text color or icon to indicate validation errors on the page in Xamarin TabbedPage (iOS and Android)?

I want users entering data across multiple tabs to be able to see at a glance whether and where they have validation errors / fields not populated. I can indicate errors for the selected form in the form body, but for unselected tabs I want to use red color and/or a red icon in the tab to indicate if it is failing validation.
I see various posts explaining how to use a custom renderer or effect to set tab text color for all tabs or selected/unselected tabs (e.g. here, here, here modifying the framework itself and here). However, the posts I've seen do not show a way to change the color of a SPECIFIC tab. In this case I want to either change the color or add/remove an error icon that would show beside the Title in the tab header based on the validation results for the page accessed via the tab. Is that possible?
Update:
I also found this - seemed more promising because it does seem to change tabs based on their positions or title rather than just on whether they were selected or not, but it seems to be dependent on using bottom tabs, which I'm not doing.
I also have found this, and element.Children[i] does get me the ContentPage from which I can determine what color I want the tab's test to be, and it's possible that the tab variable that's returned by activity.ActionBar.GetTabAt(i) somehow gives me access to update the tab's text color, but I'm not seeing any method or property that seems promising - basically I still don't see how to get access to the UITabBarItem so I can call SetTitleAndAttributes on it to set its text color. (Also, if I declare the tab variable by its type of Android.App.ActionBar.Tab instead of using var, I get a note saying that type has been deprecated. It seems upon investigation that the whole ActionBar class has been deprecated. But how can that be when it still exists as a property of Android.App.Activity, which is not deprecated?)
Many thanks for your assistance!

Lotus Notes: view opened from outline in new tab on web

I have an outline which contains some outline entries.
Every entry contains a view and in the outline entry properties at Content there is the name of the frame. Also, every view in its properties at Auto Frame (web only), there is the name of the frame.
Even so, when I click another view to open it, it will b open in a new tab of the browser.
I appreciate your time and help!
PS: I observed this problem after I put the suggestion code ( which it works ): Lotus Domino: View pagination on web .
If I remove the code from OnLoad it works quite well, with no openings in new tab. Is there any chance to have the code on OnLoad event and the views to be open in same frame?
By changing the value of window.name, the pagination code is affecting the name of the frame in which the content appears. So when you click a link in the outline, the browser goes to look for the window/frame with the name specified by the outline, and it can't find such a one -- so it opens a new window with the specified name.
For the pagination code to not interfere with your navigation, you would have to change it to not rename the window -- it would have to store its window-identifier elsewhere. For instance, if you know the view will appear in a frameset, you could set a property of top instead of window. Since the top window of the frameset doesn't change when you load new pages within a frame, you can even just keep track of the last Start= parameter there, and not bother with cookies.
I encourage you to look into using XPages for your web design -- this is usually simpler.

QTP How to save images from webpages

I would like to know if it's possible to simulate the process: Right click on an image -> Click on "Save image as.." on the popup menu -> save the image in local.
I tried CaptureBitmap() function, but the result is just a screenshot taken by QTP, not the same image file obtained as the procedure above.
Are there other ways? Many thanks in advance.
Allen
I suppose it depends what you want to do. If you want to compare the bitmap then the CaptureBitmap options should work. If you want to compare the path to the image you can use Image("x").GetROProperty("src").
If you really want to save the src image file then unfortunately QTP doesn't supply a way to interact with the browser's context menu. You can try to use some third-party mechanism to download the image from the src URL (e.g. wget).
Edit: I just had another thought, I'm not at work so I can't verify that it will work but I'm pretty sure it will.
First cause the context menu to appear, in order to do this you have to change the replay mode to device and run a RightClick operation.
replayType = Setting.WebPackage("ReplayType") ' Store old replay mode
Setting.WebPackage("ReplayType") = 2 ' change to device replay mode
Browser("b").Page("p").Image("I").RightClick
Setting.WebPackage("ReplayType") = replayType ' Revert to old mode
Then send the letter v to the browser which will select the Save menu item (on both IE and Firefox) by using the device replay object
Set deviceReplay = CreateObject( “Mercury.DeviceReplay” )
deviceReplay.SendString "v"
Now interact with the save dialog as a usual Win32 control.
Moral: Never underestimate what QTP will let you do if you try hard enough

How to set the defaults for an NSFontPanel?

I'm setting up the preferences window for my cool app, which displays some text. In preferences I've set up a button that opens an NSFontPanel. My app stores the user's preferred text color and font, and always opens with those settings so that the user never has to see text displayed in a color or font they don't prefer.
The problem is, while my app is able to remember these preferences, the NSFontPanel has trouble. When I first open the font panel, the default values for all the fields are reset. After fiddling with them, closing the panel, and then reopening it, the correct values are retained. The problem only occurs when I first open the panel.
I don't understand why this is happening!
I've been careful to set the font and color for the panel when my app starts, as you can see from this snippet:
def show_entry_font_menu(sender)
font_manager = NSFontManager.sharedFontManager
color_panel = NSColorPanel.sharedColorPanel
font_manager.setDelegate self
color_panel.setDelegate self
font_manager.setSelectedFont(preferences.entry_font, isMultiple:false)
font_panel = font_manager.fontPanel(true)
font_panel.makeKeyAndOrderFront(sender)
attributes = preferences.entry_font_attributes
color = preferences.entry_font_color
font_manager.setSelectedAttributes(attributes, isMultiple:false)
color_panel.setColor(color) if preferences.entry_font_color
self.did_open_font_panel = true
end
There is an oddness in initializing the sharedFontPanel. If you set the font before creating it the first time, that works fine, but setting attributes does not.
What you have to do is makeKeyAndOrderFront first, and then set the attributes. Once the panel has been thus created the first time it will properly reflect setSelectedAttributes.
font_panel.makeKeyAndOrderFront(sender)
font_manager.setSelectedAttributes(attributes, isMultiple:false)

Resources