Thanks for the confirmation. Do you mean the post about the unnecessary iFrame? A fix for this would be awesome since it produces a vertical scrollbar in my layout.
I have an update on this issue. It seems that all you need to do to fix it is to create a VirtualDisplayMode when switching between modes. For example:
The takeaway point here is that if your UI currently has virtual displays enabled, then you need to set another virtual display when switching between display modes.
In our UI we do the following:
const displayMode = (displayModeManager.isVirtualDisplayEnabled())
? new window.Core.VirtualDisplayMode(documentViewer, mode)
: new window.Core.DisplayMode(documentViewer, mode);
What you are seeing is basically adding a non-virtual display mode on top of the virtual display mode, instead of replacing it.
Let me know if this works out for you.
Best Regards,
Armando Bollain
Software Developer
PDFTron Systems, Inc.
Hey Armando,
this is in line with my observations. When I call my setDisplayMode method after loading a document, the error no longer occurs. I wasn’t sure if this was a page effect, but your explanation makes sense!
Thanks for pointing out new window.Core.VirtualDisplayMode(documentViewer, mode). My method uses new window.Core.DisplayMode(documentViewer, mode) like this:
Core.VirtualDisplayMode() does not exist in Core namespace:
TS2339: Property 'VirtualDisplayMode' does not exist on type 'typeof Core'.
By the way: In your types.d.tsCore.DisplayModes is defined as an object:
var DisplayModes: {
/**
* Displays one page at a time.
*/
Single: string;
/**
* Displays all the pages in a scrolling view in one column.
*/
Continuous: string;
/**
* Displays up to two pages at a time, side by side.
*/
Facing: string;
/**
* Displays all pages in a scrolling view in two columns.
*/
FacingContinuous: string;
/**
* Displays all pages in a scrolling view in two columns. The first row has a single page in the second column.
*/
Cover: string;
/**
* Same as the Cover display mode except that it is not a scrolling view.
*/
CoverFacing: string;
/**
* Any custom display mode.
*/
Custom: string;
};
Looking at the code, I can confirm that even though VirtualDisplayMode does exist in the Core namespace, it does not have the correct documentation for it to show up in the types file. This is why you are getting this TS error. I will update this so it shows up in the types, but in the meantime you should be able to suppress the warning, The constructor matches the parameters of the DisplayMode .
I’ll also change that object to an enum, thanks for pointing this out. Behind the scenes the Core is still developed in plain JS, and we generate the types based on JSDOC.
I’ll let you know through this ticket when I make the changes, it won’t make the December release but I can put it in a nightly build if you need it sooner rather than later.
Best Regards,
Armando Bollain
Software Developer
PDFTron Systems, Inc.
I was able to make the change for the types - I’m attaching an updated types file for you to test. This file is only for testing purposes only as it may include APIs that are not out yet/are experimental. (I changed the extension to be a txt or it would not let me upload it).
Let me know if this works out for you - in the meantime I’ll proceed with getting this merged to our main prod branch.
sorry for the late response! After adding the export statements I could use your file in the pdftron node module and it works. VirtualDisplayMode’s constructor expects “mode” to be type of string. I think this should be type of Core.DisplayModes once it is declared as enum.
I’ll keep an eye on the Changelog