Directly open File instead of file tree

Hi,

I am evaluating the annotation lib. I downloaded the annotation samples and tried to modify it according to our use case. When opening the sample no document is opened by default. We would need to open a specific document when the application is loaded.

How can I modify the sample do directly display a specific document?

Is it possible to hide the open file button?

Is it possible to store a pdf with the user annotations directly to our application database?

I also noticed a compile error in the servlet sample in line 160 in AnnotationServlet.java the method setCollaborationCallback does not exist. I have downloaded the 2.0 version of the annotation library. I also get strange behaviour when opening the servlet sample in my browser(Chrome), every ~2 reload the calls for GetJsHandler and/or getCssHandler fail with HTTP 500 (NPE). I run the samples on Java 7 64Bit and Tomcat 7.70 on a Windows 10 pc.


Regards,

Martin

Hello,

Thank you for your inquiry.

If you need to load any document by default , you should add the defaultFileName parameter to the application.properties file . Also if you need to hide the "Open file" button , you should set false for the showFileExplorer parameter in the application.properties file.
For how to store annotations in the DB , please investigate this documentation .

If you modified our servlet sample then please share the changes with us, because we can't reproduce your issues on our side.

We will wait for your details.

-----------

Best regards,
Evgen Efimov

http://groupdocs.com
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+

Hi Evgen,

Thank you for your help.

I get the HTTP 500 errors with the original sample without modifications. I need to refresh one or two times to get all JavaScript’s loaded properly. Sometimes all scripts fail to load and sometimes a few are loaded correctly. The compile error regarding AnnoationServlet occurs when I import the sample source code in eclipse and add the annotation 2.0 jar to the build path.

I was a bit unclear what I want to achieve with opening a file directly. We have an application were we want to give the user the possibility to annotate an uploaded document in a GWT web application, therefore I would need to set the filename dynamically for each request. At the moment I use the Script from the sample application.


var annotationWidget = $('#annotation-widget')
.groupdocsAnnotation(
{
localizedStrings : null,
thumbsImageBase64Encoded : undefined,
width : 1000,
height : 800,
fileId : '',
docViewerId : 'annotation-widget-doc-viewer',
quality : 100,
enableRightClickMenu : true,
showHeader : true,
showZoom : true,
showPaging : true,
showPrint : true,
showFileExplorer : true,
showThumbnails : true,
showToolbar : true,
openThumbnails : false,
zoomToFitWidth : true,
zoomToFitHeight : false,
initialZoom : 100,
preloadPagesCount : 0,
enableSidePanel : true,
scrollOnFocus : true,
strikeOutColor : '#00000c',
highlightColor : '#000017',
underlineColor : '#FF0000',
textFieldBackgroundColor : '#000041',
enabledTools : 8191,
connectorPosition : 0,
saveReplyOnFocusLoss : false,
clickableAnnotations : true,
disconnectUncommented : false,
enableStandardErrorHandling : true,
strikeoutMode : 1,
undoEnabled : true,
anyToolSelection : true,
tabNavigationEnabled : false,
minimumImageWidth : 0,
areaToolOptions : {
pen : {
width : 1,
color : -16711936,
dashStyle : 0
},
brush : {
color : -16711936
}
},
polylineToolOptions : {
pen : {
width : 1,
color : -65536,
dashStyle : 0
},
brush : {
color : -16776961
}
},
arrowToolOptions : {
pen : {
width : 1,
color : -65536,
dashStyle : 0
},
brush : {
color : -65281
}
},
distanceToolOptions : {
pen : {
color : -16776961
}
},
sideboarContainerSelector : 'div.comments_sidebar_wrapper',
usePageNumberInUrlHash : false,
textSelectionSynchronousCalculation : true,
variableHeightPageSupport : true,
useJavaScriptDocumentDescription : true,
isRightPanelEnabled : true,
createMarkup : true,
use_pdf : 'true',
_mode : 'annotatedDocument',
selectionContainerSelector : "[name='selection-content']",
graphicsContainerSelector : '.annotationsContainer',
userName : 'Anonymous',
userId : 'bc1a4493-521f-4c2c-94f7-540adfdf1805'
});
});

Is it possible to automatically generate a pdf with the current annotations after the user modified an annotation? What we want to do here is to immediately write back the modified document to our db table when a modification is made.

At the moment I am facing another problem. I have integrated the ViewDocument and LoadFileBrowserTreeServlet in our application, when I want to open a document via open file dialog, I get following stacktrace.

ionHandler|080-exec-7|15:19:07|ERROR| Annotation throws exception: null
com.groupdocs.annotation.exception.AnnotationException
at com.groupdocs.annotation.api.shared.CommonApi.viewDocument(Unknown Source)
at com.groupdocs.annotation.api.shared.WebApi.viewDocumentHandler(Unknown Source)
at com.groupdocs.annotation.handler.AnnotationHandler.viewDocumentHandler(Unknown Source)
at test.groupdocs.ViewDocumentServlet.doPost(ViewDocumentServlet.java:23)

Regards,
Martin
Hello,

We have managed to reproduce the issue with the bad loading of the js scripts and notified our product team about it. At the moment the team works on the new generation of the GroupDocs.Annotation library and this issue should be fixed in it. To avoid this issue you can update the web page via ctrl+f5 keyboard shortcut .

Regarding your question about automatically generating .pdf file : unfortunately at the moment in our library doesn't provides such method , but as workaround you can add this method (creating pdf with comments) after update or add annotation in to the document.To achieve this you should ping createAnnotationHandler that responds for creating the annotations.

About your integrated issue. Basically you should integrate all servlets from our demo example to your application, because each from them is respond for the required functional.

If you will have more questions please feel free to contact us.

----------

Best regards,
Evgen Efimov

http://groupdocs.com
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+

Hi,

I fixed the exception by setting the storageType to default, was json. Now the document gets shown. In the meantime I tried to set an initial file name via filePath parameter as stated here (http://www.groupdocs.com/docs/display/annotationjava/GroupDocs.Annotation+for+Java+-+Parameters). Unfortunately nothing happens, in the Chrome Developer Console, I cannot see a request to ViewDocumentServlet. This is my script code.


While testing I noticed that opening an exported pdf with comments via open file is not reading the comments (annotations) anymore. Only if I open the file via import annotations the comments are shown correctly.

Is there a way to initially open a pdf with comments?

Could you please give me where I have to add which method to export the pdf after annoations are modified?

When will the new version if the annotation lib will be released? Will the migration from the current version to the new one require much work on our site?

Thank you,
Regards,
Martin
Hello ,

We are sorry for misunderstanding, but at the moment you can't export document with annotations after the annotation changes .

Currently you can use only the import functional which is available from the CommonApi . You can call importAnnotations() in the IndexServlet as shown on this screenshot.

Unfortunately the filePath parameter also can not be used for the Annotation js widget , you should use fileId parameter . You can get it via this code

fileId = new EncodedPath('file path', annotationHandler.getConfiguration()).getPath()

If you will have more questions please feel free to contact us.

---------

Best regards,
Evgen Efimov

http://groupdocs.com
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+