Question: i'm using the AxAcroPDFLib.AxAcroPDF Tool from the toolbox and am having it a specific PDF when i click a button. I have a separate button (button2) and Textbox which i want to use to automatically move the PDF page to the page number entered into the TextBox when button2 is pressed.

The following code isn't working and i'm not sure what code to use to get it to work (and no i cannot just use the tools inside the PDF reader to do this as i need all the controls on monitor 1 and the PDF is displayed on Montior 2, i've sorted this part):

KEY: dsm = form2 | pdfview = the PDF reader inside form2

```
dsm.pdfview.setCurrentPage(TextBox1.Text);

```

This isn't working. i've also tried:

```
dsm.pdfview.setCurrentPage = TextBox1.Text;

```

Also not working. Any help would be great! Thanks.

Answer: 
For Spring Data with Reactive MongoDb:

My case was a bit different (I had closing connections - which throws "Caused by: java.lang.IllegalStateException: state should be: open")

But You can use this with your case.

**application.yml:**

```
spring.data.mongodb:
  host: localhost
  database: myDb
  port: 27017
  username: admin
  password: test

```

If Your implementation use **MongoReactiveAutoConfiguration** for bean creation, then You can configure it with this bean:

```
@Bean
public MongoClientSettings mongoClientSettings() {
    final MongoClientSettings clientSettings = MongoClientSettings.builder()
            .retryWrites(true)
            .applyToConnectionPoolSettings((ConnectionPoolSettings.Builder builder) -> {
                builder.maxSize(300) //connections count
                        .minSize(100)
                        .maxConnectionLifeTime(0, TimeUnit.MILLISECONDS)
                        .maxConnectionIdleTime(0, TimeUnit.MILLISECONDS)
                        .maxWaitTime(5000, TimeUnit.MILLISECONDS)
                        .maxWaitQueueSize(5000);
            })
            .applyToSocketSettings(builder -> {
                builder.connectTimeout(2000, TimeUnit.MILLISECONDS);
            })
            .applicationName("app")
            .build();

    return clientSettings;
}

```
The question was specifically for Spring boot. I am using the following approach which works well, please suggest if there is a way not to use new and use Spring for configuring it.

```
 import java.util.ArrayList;
 import java.util.List;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.data.mongodb.config.AbstractMongoConfiguration;
 import org.springframework.data.mongodb.core.mapping.MongoMappingContext;
 import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
 import com.mongodb.Mongo;
 import com.mongodb.MongoClient;
 import com.mongodb.MongoClientOptions;
 import com.mongodb.MongoCredential;
 import com.mongodb.ServerAddress;

 @Configuration
 @EnableMongoRepositories("com.myapp.repository")
 public class SpringMongoConfig extends AbstractMongoConfiguration {

@Value("${myapp.mongodb.host}")
private String host;

@Value("${myapp.mongodb.port}")
private int port;

@Value("${myapp.mongodb.database}")
private String mongoDB;

@Value("${myapp.mongodb.userName}")
private String userName;

@Value("${myapp.mongodb.password}")
private String password;

@Value("${myapp.mongodb.socketTimeoutMS}")
private int socketTimeout;

@Value("${myapp.mongodb.connectionTimeoutMS}")
private int connectionTimeout;

@Override
public MongoMappingContext mongoMappingContext() throws ClassNotFoundException {
return super.mongoMappingContext();
}

@Override
@Bean
public Mongo mongo() throws Exception {

List<ServerAddress> servers = new ArrayList<ServerAddress>();
servers.add(new ServerAddress(host, port));

List<MongoCredential> creds = new ArrayList<MongoCredential>();
creds.add(MongoCredential.createCredential(userName, mongoDB, password.toCharArray()));

MongoClientOptions builder = MongoClientOptions.builder().socketTimeout(socketTimeout).connectTimeout(connectionTimeout).build();

return new MongoClient(servers, creds, builder);
}

@Override
protected String getDatabaseName() {
return mongoDB;
}
}

```