PDF Viewer Component - ApplyLayoutMode

Function: boolean ApplyLayoutMode (BSTR layoutMode);
Description: Sets the layout mode for a page view according to the specified string.
Params:
Possible values: “DontCare”: use the current user preference “SinglePage”: use single page mode (as it would have appeared in pre-Acrobat 3.0 viewers) “OneColumn”: use one-column continuous mode “TwoColumnLeft”: use two-column continuous mode with the first page on the left “TwoColumnRight”: use two-column continuous mode with the first page on the right.

PDF Viewer Component - PrintWithDialog

Function: boolean PrintWithDialog ();
Description: Prints the document according to the options selected in a user dialog box. The options include embedded printing (printing within a bounding rectangle on a given page), as well as interactive printing to a specified printer. This method returns immediately, even if the printing has not completed. NOTE: If security settings do not allow printing, this method will be ignored.

PDF Viewer Component - ApplyZoom

Function: boolean ApplyZoom (float percent);
Description: Set the zoom factor for document page view.
Params: Specify the zoom factor in %.

PDF Viewer Component - ApplyZoomScroll

Function: boolean ApplyZoomScroll (float percent, float left, float top);
Description: Sets the zoom and scroll factors, using float or integer values. For example, a scale value of 100 indicates a zoom value of 100%.
Scroll values left and top are in a coordinate system where 0,0 represents the top left corner of the visible page, regardless of document rotation.

PDF Viewer Component - ApplyView

Function: boolean ApplyView (BSTR viewMode);
Description: Sets the view of a page according to the specified string.
Params: Possible values: “Fit”: fits the entire page within the window both vertically and horizontally. “FitH”: fits the entire width of the page within the window. “FitV”: fits the entire height of the page within the window. “FitB”: fits the bounding box within the window both vertically and horizontally. “FitBH”: fits the entire width of the bounding box within the window. “FitBV”: fits the entire height of the bounding box within the window.

Properties in the PDF Viewer Component

1. File Path
Property: BSTR Path
Description: The property will save the open file path.
You can use the property to decide whether the component opened a PDF file.
If PDFViewer1.Path != “” Then
PDFViewer1. ApplyZoom 0.75
End If

2. Show or hide the toolbars
Property: boolean Toolbars
Description: Show/Hide whether toolbars should be displayed.
You can open a PDF document without toolbars as follow:
If OA1.GetToolbars = True Then
OA1.oolbars False
Else
OA1.Toolbars True
End If

3. Show or hide the navigation panes
Property: boolean NavPanes
Description: Show/Hide whether navigation panels should be displayed.

4. Show or hide the messages
Property: boolean Messages
Description: Show/Hide whether messages should be displayed.

5. Show or hide the scrollbar
Property: boolean Scrollbar
Description: Show/Hide whether scrollbar should be displayed.

6. Show or hide the statusbar
Property: boolean Statusbar
Description: Show/Hide whether statusbar should be displayed.

7. Set the Parameters for the Open Document.
Property: BSTR NamedDest;
  BSTR Page;
  BSTR Comment;
  BSTR Zoom;
  BSTR View;
  BSTR ViewRect;
  BSTR PageMode;
  BSTR Search;
  BSTR Highlight;
Description: These properties have the same function with the above methods. If you special the Zoom as 75, the component will open any PDF document with the default 75% view zoom. If you special the Search as “Flowchart”, the component will highlight the Flowchart word when it opens a PDF document.

8. Modify the Border Style
Property: short BorderStyle;
Description: Set the caption of the titlebar.
The property allows the developer to modify the border style. It can be the follow value:
typedef enum BorderStyle
 {
  BorderNone = 0,
  BorderFlat,
  Border3D,
  Border3DThin
 } BorderStyle;
<object classid=”clsid:053AFEBA-D968-435F-B557-19FF76372B1B” id=”EDrawOfficeViewer1″ width=”657″ height=”452″>
 <param name=”BorderStyle” value=”2″>
</object>

9. Set the Color Scheme
Properties:
OLE_COLOR BorderColor;
OLE_COLOR BackColor;
OLE_COLOR ForeColor;
OLE_COLOR TitlebarColor;
OLE_COLOR TitlebarTextColor;
Description: Set the color scheme for the component.
<object classid=”clsid:053AFEBA-D968-435F-B557-19FF76372B1B” id=”EDrawOfficeViewer1″ width=”657″ height=”452″>
 <param name=”BorderColor” value=”-2147483632″>
 <param name=”BackColor” value=”-2147483643″>
 <param name=”ForeColor” value=”-2147483640″>
 <param name=”TitlebarColor” value=”-2147483635″>
 <param name=”TitlebarTextColor” value=”-2147483634″>
</object>

10. Modify the TitlebarText
Property: BSTR TitlebarText;
Description: Set the caption of the titlebar.
The property allows the developer to modify the caption in the titlebar.
<object classid=”clsid: 44A8091F-8F01-43B7-8CF7-4BBA71E61E04″ id=”PDFViewer1″ width=”657″ height=”452″>
 <param name=” TitlebarText ” value=”PDF Viewer Component”>
</object>

11. Set the Color Scheme
Property: BSTR LicenseName
Description: Gets/Sets the license name.

12. License Key
Property: BSTR LicenseKey
Description: Gets/Sets the license key.

Edraw and VSTO 2005.

I have an templated created by using the “Word Template” project in VSTO 2005.

When i open either a document  based on my VSTO 2005 template or the template directly using the Edraw Office OADemo.exe the StartUp Event (ThisDocument_StartUp) is never called.

Is this a bug or am i missing something? 

Lars.

Solved the “Click to activate and user the control”

Users cannot directly interact with ActiveX controls loaded by the APPLET, EMBED, or OBJECT elements. Users can interact with such controls after activating their user interfaces. This topic describes how Microsoft Internet Explorer handles ActiveX controls, shows how to load ActiveX controls so their interfaces are activated, and describes the impact of this behavior on accessibility tools and applications hosting the WebBrowser Control.

To activate an interactive control, either click it or use the TAB key to set focus on it and then press the SPACEBAR or the ENTER key. Interactive controls loaded from external script files immediately respond to user interaction and do not need to be activated.

To create Web pages that load interactive controls that respond immediately to user input, use Microsoft JScript to load controls from external script files. You cannot write script elements inline with the main HTML page to load your control externally. If the script is written inline programmatically, for example with the writeln function, the loaded control will behave as if it was loaded by the HTML document itself and will require activation. To ensure a control is interactive when it is loaded, use one of the following techniques to load your control from an external file.

We have provide a solution to activate the Office Viewer Component automatically when loading a page.

OADemo.php

<object classid=”clsid:6BA21C22-53A5-463F-BBE8-5CF7FFA0132B” id=”OA1″ width=”674″ height=”500″ ….
</object>
<script language=”JavaScript” type=”text/javascript” src=”NoIEActivate.js”></script>

NoIEActivate.js

n=navigator.userAgent;
 w=n.indexOf(”MSIE”);
 if((w>0)&&(parseInt(n.charAt(w+5))>5)){
 T=["object","embed","applet"];
 for(j=0;j<2;j++){
 E=document.getElementsByTagName(T[j]);
 for(i=0;i<E.length;i++){
 P=E[i].parentNode;
 H=P.innerHTML;
 P.removeChild(E[i]);
 P.innerHTML=H;
 }}}

Fixed the vulnerable functions of Office Viewer Component

New version has removed the ”DeleteLocalFile” method to avoid the attack. Now the component will delete the temporary files when it exits.

We improved the HTTP download file too and provide a securer download method in the version 5.

The follow article is the vulnerable description about the 4.0 version. 

Multiple vulnerabilities have been identified in EDraw Office Viewer Component v4.0, which could be exploited by remote attackers to delete arbitrary files or take complete control of an affected system.

The first issue is caused by a design error in the “DeleteLocalFile()” method within the “edrawofficeviewer.ocx” ActiveX control, which could be exploited by attackers to delete arbitrary files from a vulnerable system by tricking a user into visiting a specially crafted web page.

The second vulnerability is caused by a buffer overflow error in the “edrawofficeviewer.ocx” ActiveX control when processing malformed arguments passed to the “HttpDownloadFile()” method, which could be exploited by remote attackers to execute arbitrary code via a malicious web page.

Host multiple office viewer components in a form

You can host multiple office component in a form or you can open multiple office instance in your internet explore with EDraw Office Viewer Component version 5.

Note: you need set the Frame hook policy as SetOnFirstOpen and Component activation policy as KeepUIActiveOnAppDeactive.

Frame hook policy
To correctly handle activation when the host gains or loses foreground status, the ActiveX control uses a frame hook. By default, the hook is set when the control is created. In some situations, especially when the control is used from a multi-threaded UI host or when the control is nested in a container control like a Tab page in a .NET WinForm application, the parent of the control at create time may not be the correct window for the control to hook when it is running. In these situations, you can use the FrameHookPolicy property to reset the hook at a more suitable time. For example, if you build a .NET WinForm solution, set the FrameHookPolicy property to SetOnFirstOpen in the Properties window.
 

Component activation policy
The sample control can support more than one instance of itself in a given host application. However, only one control can be active at a given time. This is a requirement of ActiveX Document hosting. To handle multiple instances in a single host, the control registers itself with a component manager. This lets the component manager keep track of the active control. Use the ActivationPolicy property to control how the embedded object is handled during component changes. The ActivationPolicy property can be set to one or more of the bit flags that are defined by the ActivationPolicy enumeration.