 |
HyperDoc Online Publishing API at a glance |
HyperDoc Online Publishing API (HOPA) is a set of Web Services that allows you to access data stored in the HyperDoc database from external web application. Main functions are implemented in the following ASP pages:
- HOPAGetView4Object.asp - to produce dynamic view of desired object with given parameters;
- HOPAGetPrint4Object.asp - to open new window with image prepared in printer resolution and size ready to print;
- HOPAGetPreview4Object.asp - to produce preview of printout before printing and control printing parameters (this function is under implementation).
Other functions may be helpful for advanced access to HyperDoc Online functionality:
- HOPAGetOptionsXML.asp - to retrieve HyperDoc Online configuration parameters;
- HOPATranslateIDXML.asp - to retrieve ObjID from supplied class and id of object;
- HOPATranslateObjIDXML.asp - to retrieve class and id of object identified by ObjID;
- HOPAGetPrint4ObjectEx.asp - to start print / print preview in interactive mode;
- HOPAStartUI.asp - to start HyperDoc Online with full user interface.
General syntax of HOPA call is as follows:
<HOPA-serverURL>/<HOPA-function>?<Params>
where:
- <HOPA-serverURL> - URL of HIS server with HOPA feature enabled;
- <HOPA-function> - any of functions listed above;
- <Params> - a list of pairs <ParName>=<ParValue> separated with "&" e.g <ParName1>=<ParValue1>&<ParName2>=<ParValue2>
Below there are several HTML snippets. They should give a rough idea of using HyperDoc Online Publishing API. Please note that for the sake of legibility, lines containing HOPA calls are broken to contain one parameter in one line - in reality they should be written in one line. The name of HOPA-serverURL has been omitted for the same reasons. Using images prepared by HOPA
The HOPAGetView4Object function allows put image prepared by HOPA on the HTML page.
Parameters of the HOPAGetView4Object function allows you control:
- width and height of the image,
- part of the original document used to prepare the image,
- mask unnecessary parts of the document,
- display documents with additional information generated by dynamic presentation.
The HOPA user has full control over positioning images on the HTML page. It is possible of course to compose multi-image HTML layout with any other graphical elements composed as desired. Example 1:
...
|
<img
|
name=
|
"Pic1"
|
|
|
src=
|
"HOPAGetView4Object.asp? ObjClass=Rooms& ID=Room002& Width=400& Height=300"
|
|
|
width=
|
"400"
|
|
|
height=
|
"300">
|
...
This example shows simplest use of the API. The <img …> tag placed somewhere on a HTML page will contain view of the default document linked to object with HyperDoc class name "Rooms" and key value "Room001". HyperDoc object class name is defined in default hierarchy definition for this database (i.e. in table "HDocHierarchyDefinition" column "ObjectClass" - please note that it is NOT "DisplayName"). There is no document linked to object "Room001" in the database, so the document for its spot is used.
Example 2:
...
|
<img
|
name=
|
"Pic2"
|
|
|
src=
|
"HOPAGetView4Object.asp? ObjClass=Floors& ID=Floor001& FitMode=3& Height=300& ID=Floor001& FitMode=3& UseView=0& Present=Room%20Status"
|
|
|
height=
|
"300">
|
...
Next example shows document linked to object with class name "Floors" and key value "Floor001"). Returned image will be generated from full drawing and will be 300 pixels tall - width will be adequate to preserve aspect ratio of image. Presentation called "Room status" will be applied. Please note that spaces characters are quoted ("%20").
Example 3:
...
|
<img
|
name=
|
"Pic3"
|
|
|
src=
|
"HOPAGetView4Object.asp? ObjClass=Floors& ID=Floor001& FitMode=2& Width=300& SpotMarginPercent=150"
|
|
|
height=
|
"300">
|
...
Next example shows how to obtain view of document containing spot for the same object (object class name "Floors" and key value "Floor001"). View has 50% margin surrounding spot - defining this parameter forces Document for Spot mode. Returned image will be 400 pixels wide - height will be adequate to preserve aspect ratio of image.
Printing documents using HOPA
The HOPAGetPrint4Object function prepares printout image in separate window. The image is presented in 100% scale, but is prepared in full printer resolution.
Parameters of the HOPAGetPrint4Object function allows you control:
- page setup and print layout by choosing desired print template,
- automatic or user-defined choice of document scale,
- part of the original document used to prepare image,
- mask unnecessary parts of the document,
- contents of user-definable macros;
- multi-image printouts with several images composed on a single page.
Example 4:
...
|
<script Language="JScript"> function printMyImage() {
|
|
|
window.open ("
|
HOPAGetPrint4Object.asp? ObjClass=Floors& ID=Floor001& Scale=500& UseView=0& PrintTemplate=PRINT-A4& Orientation=L");
|
|
|
{ </script> ... <button onclick="printMyImage()"> Print </button> ...
|
This example shows how to perform printing. There is a button ("Print") on a page. Clicking it causes new browser window to open. This window will contain page with full drawing (UseView=0) in scale 1:500 (Scale=500) ready for printing. Printing will be performed using "PRINT-A4" template in landscape orientation.
Example 5:
...
|
<script Language="JScript"> function printMyImage() {
|
|
|
window.open ("
|
HOPAGetPrint4Object.asp? PrintTemplate=PRINT3-A4& Orientation=L& Define_CompanyName=Web2Web%20Inc& ObjClass1=Rooms& ID1=Room002& Scale1=100& MaskMode1=2& SpotMarginPercent1=120& ObjClass2=Rooms& ID2=Room002& UseView2=0& Scale2=1000& ObjClass3=Floors& ID3=Floor001& ScaleMode3=1& SpotMarginPercent3=120");
|
|
|
{ </script> ... <button onclick="printMyImage()"> Print </button> ...
|
This advanced example shows how to print using multiple viewports. Printing will be performed using "PRINT3-A4" template that contains three viewports. This template contains macro with dynamic text "!CompanyName" that will be expanded to text "Web2Web Inc". (Other macros are internally resolved to room name, floor name and building name). Parameters specific for individual viewports are indexed with "1", "2" and "3", respectively.
In first viewport, described with text "Consultants room", object "Room002" from class "Rooms" is displayed in scale 1:100 with view defined for spot linked to that room and with spot margin percent 20% using masking derived from spot shape ("MaskMode1=2").
In second viewport, the same document is displayed but with full view ("UseView2=0") and with scale 1:1000, giving overall view on the whole floor with room under interest displayed in yellow color.
In third viewport, document for spot linked to the object "Floor001" is displayed with spot margin percent 20% and scale calculated to fit spot view in viewport ("ScaleMode3=1").
|