Skip to content

Instantly share code, notes, and snippets.

@groupdocscloud
Last active January 15, 2019 07:33
Show Gist options
  • Save groupdocscloud/e86f05aeed57101c77e399f1c80b99b5 to your computer and use it in GitHub Desktop.
Save groupdocscloud/e86f05aeed57101c77e399f1c80b99b5 to your computer and use it in GitHub Desktop.
This Gist contains Java examples of GroupDocs.Viewer Cloud
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
HtmlCreateAttachmentPagesCacheRequest request = new HtmlCreateAttachmentPagesCacheRequest();
request.setFileName("with-attachment.msg");
HtmlOptions htmlOptions = new HtmlOptions();
htmlOptions.setAttachmentPassword("");
request.setHtmlOptions(htmlOptions);
request.setAttachmentName("TestAttachment-File.docx");
request.setFontsFolder("");
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
HtmlAttachmentPageCollection response = apiInstance.htmlCreateAttachmentPagesCache(request);
System.out.println("Cache Created");
System.out.println("Pages Count: " + response.getPages().size());
System.out.println("File Name: " + response.getFileName());
System.out.println("Attachment Name: " + response.getAttachmentName());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
ImageCreateAttachmentPagesCacheRequest request = new ImageCreateAttachmentPagesCacheRequest();
request.setFileName("with-attachment.msg");
ImageOptions imageOptions = new ImageOptions();
imageOptions.setAttachmentPassword("");
request.setImageOptions(imageOptions);
request.setAttachmentName("TestAttachment-File.docx");
request.setFontsFolder("");
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
ImageAttachmentPageCollection response = apiInstance.imageCreateAttachmentPagesCache(request);
System.out.println("Cache Created");
System.out.println("Pages Count: " + response.getPages().size());
System.out.println("File Name: " + response.getFileName());
System.out.println("Attachment Name: " + response.getAttachmentName());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
HtmlCreatePagesCacheRequest request = new HtmlCreatePagesCacheRequest();
request.setFileName("sample.DXF");
HtmlOptions htmlOptions = new HtmlOptions();
htmlOptions.setAttachmentPassword("");
htmlOptions.setEmbedResources(true);
CadOptions cadOptions = new CadOptions();
List<String> lstLayers = new ArrayList<String>();
lstLayers.add("SLD-0");
lstLayers.add("DEFAULT_3");
cadOptions.setLayers(lstLayers);
request.setHtmlOptions(htmlOptions);
request.setFolder("");
request.setStorage("MyStorage");
HtmlPageCollection response = apiInstance.htmlCreatePagesCache(request);
System.out.println("Cache Created");
System.out.println("Pages Count: " + response.getPages().size());
System.out.println("File Name: " + response.getFileName());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
ImageCreatePagesCacheRequest request = new ImageCreatePagesCacheRequest();
request.setFileName("sample.DXF");
CadOptions cadOptions = new CadOptions();
List<String> lstLayers = new ArrayList<String>();
lstLayers.add("SLD-0");
lstLayers.add("DEFAULT_3");
cadOptions.setLayers(lstLayers);
request.setFolder("");
request.setStorage("MyStorage");
ImagePageCollection response = apiInstance.imageCreatePagesCache(request);
System.out.println("Cache Created");
System.out.println("Pages Count: " + response.getPages().size());
System.out.println("File Name: " + response.getFileName());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
HtmlCreatePagesCacheRequest request = new HtmlCreatePagesCacheRequest();
request.setFileName("one-page.docx");
HtmlOptions htmlOptions = new HtmlOptions();
htmlOptions.setAttachmentPassword("");
htmlOptions.setEmbedResources(true);
request.setHtmlOptions(htmlOptions);
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
HtmlPageCollection response = apiInstance.htmlCreatePagesCache(request);
System.out.println("Cache Created");
System.out.println("Pages Count: " + response.getPages().size());
System.out.println("File Name: " + response.getFileName());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
ImageCreatePagesCacheRequest request = new ImageCreatePagesCacheRequest();
request.setFileName("one-page.docx");
ImageOptions imageOptions = new ImageOptions();
imageOptions.setAttachmentPassword("");
imageOptions.setFormat("jpg");
request.setImageOptions(imageOptions);
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
ImagePageCollection response = apiInstance.imageCreatePagesCache(request);
System.out.println("Cache Created");
System.out.println("Pages Count: " + response.getPages().size());
System.out.println("File Name: " + response.getFileName());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
HtmlCreatePagesCacheFromUrlRequest request = new HtmlCreatePagesCacheFromUrlRequest();
request.setUrl("https://www.dropbox.com/s/umokluz338w4ng7%2fone-page.docx");
request.setFileName("one-page.docx");
HtmlOptions htmlOptions = new HtmlOptions();
htmlOptions.setEmbedResources(false);
request.setHtmlOptions(htmlOptions);
request.setFolder("");
request.setStorage("MyStorage");
HtmlPageCollection response = apiInstance.htmlCreatePagesCacheFromUrl(request);
System.out.println("Cache Created");
System.out.println("Pages Count: " + response.getPages().size());
System.out.println("File Name: " + response.getFileName());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
ImageCreatePagesCacheFromUrlRequest request = new ImageCreatePagesCacheFromUrlRequest();
request.setUrl("https://www.dropbox.com/s/umokluz338w4ng7%2fone-page.docx");
request.setFileName("one-page.docx");
ImageOptions imageOptions = new ImageOptions();
imageOptions.setFormat("jpg");
request.setImageOptions(imageOptions);
request.setFolder("");
request.setStorage("MyStorage");
ImagePageCollection response = apiInstance.imageCreatePagesCacheFromUrl(request);
System.out.println("Cache Created");
System.out.println("Pages Count: " + response.getPages().size());
System.out.println("File Name: " + response.getFileName());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
HtmlCreatePagesCacheRequest request = new HtmlCreatePagesCacheRequest();
request.setFileName("one-page.docx");
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
HtmlOptions htmlOptions = new HtmlOptions();
htmlOptions.setEnableMinification(true);
htmlOptions.setEmbedResources(true);
request.setHtmlOptions(htmlOptions);
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
HtmlPageCollection response = apiInstance.htmlCreatePagesCache(request);
System.out.println("File Name: " + response.getFileName());
System.out.println("File Pages Count: " + response.getPages().size());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
Path filePath = Paths.get("D://one-page.docx");
File file = filePath.toFile();
Watermark watermark = new Watermark();
watermark.setText("GrouDocs Cloud API");
HtmlOptions htmlOptions = new HtmlOptions();
htmlOptions.setWatermark(watermark);
HtmlCreatePagesCacheFromContentRequest request = new HtmlCreatePagesCacheFromContentRequest();
request.setFile(file);
JSON json = new JSON();
String content = json.serialize(htmlOptions);
try {
File htmlOptionsfile = File.createTempFile("java", ".json");
FileWriter fileWriter = new FileWriter(htmlOptionsfile.getAbsoluteFile(), true);
fileWriter.write(content);
fileWriter.close();
request.setHtmlOptions(htmlOptionsfile);
} catch (IOException e) {
}
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
HtmlPageCollection response = apiInstance.htmlCreatePagesCacheFromContent(request);
System.out.println("File Name: " + response.getFileName());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
Path filePath = Paths.get("D://one-page.docx");
File file = filePath.toFile();
Watermark watermark = new Watermark();
watermark.setText("GrouDocs Cloud API");
ImageOptions imageOptions = new ImageOptions();
imageOptions.setWatermark(watermark);
imageOptions.setFormat("jpg");
ImageCreatePagesCacheFromContentRequest request = new ImageCreatePagesCacheFromContentRequest();
request.setFile(file);
JSON json = new JSON();
String content = json.serialize(imageOptions);
try {
File imageOptionsfile = File.createTempFile("java", ".json");
FileWriter fileWriter = new FileWriter(imageOptionsfile.getAbsoluteFile(), true);
fileWriter.write(content);
fileWriter.close();
request.setImageOptions(imageOptionsfile);
} catch (IOException e) {
}
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
ImagePageCollection response = apiInstance.imageCreatePagesCacheFromContent(request);
System.out.println("File Name: " + response.getFileName());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
HtmlCreatePdfFileFromUrlRequest request = new HtmlCreatePdfFileFromUrlRequest();
request.setUrl("https://www.dropbox.com/s/umokluz338w4ng7%2fone-page.docx");
request.setFileName("one-page.docx");
Watermark watermark = new Watermark();
watermark.setText("GrouDocs Cloud API");
PdfFileOptions pdfFileOptions = new PdfFileOptions();
pdfFileOptions.setWatermark(watermark);
request.setPdfFileOptions(pdfFileOptions);
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
PdfFileInfo response = apiInstance.htmlCreatePdfFileFromUrl(request);
System.out.println("File Name: " + response.getFileName());
System.out.println("folder: " + response.getFolder());
System.out.println("PDF File Name: " + response.getPdfFileName());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
ImageCreatePdfFileFromUrlRequest request = new ImageCreatePdfFileFromUrlRequest();
request.setUrl("https://www.dropbox.com/s/umokluz338w4ng7%2fone-page.docx");
request.setFileName("one-page.docx");
Watermark watermark = new Watermark();
watermark.setText("GrouDocs Cloud API");
PdfFileOptions pdfFileOptions = new PdfFileOptions();
pdfFileOptions.setWatermark(watermark);
request.setPdfFileOptions(pdfFileOptions);
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
PdfFileInfo response = apiInstance.imageCreatePdfFileFromUrl(request);
System.out.println("File Name: " + response.getFileName());
System.out.println("folder: " + response.getFolder());
System.out.println("PDF File Name: " + response.getPdfFileName());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
Path filePath = Paths.get("D://one-page.docx");
File file = filePath.toFile();
Watermark watermark = new Watermark();
watermark.setText("GrouDocs Cloud API");
PdfFileOptions pdfFileOptions = new PdfFileOptions();
pdfFileOptions.setWatermark(watermark);
HtmlCreatePdfFileFromContentRequest request = new HtmlCreatePdfFileFromContentRequest();
request.setFile(file);
JSON json = new JSON();
String content = json.serialize(pdfFileOptions);
try {
File pdfFileOptionsfile = File.createTempFile("java", ".json");
FileWriter fileWriter = new FileWriter(pdfFileOptionsfile.getAbsoluteFile(), true);
fileWriter.write(content);
fileWriter.close();
request.setPdfFileOptions(pdfFileOptionsfile);
} catch (IOException e) {
}
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
PdfFileInfo response = apiInstance.htmlCreatePdfFileFromContent(request);
System.out.println("File Name: " + response.getFileName());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
Path filePath = Paths.get("D://one-page.docx");
File file = filePath.toFile();
Watermark watermark = new Watermark();
watermark.setText("GrouDocs Cloud API");
PdfFileOptions pdfFileOptions = new PdfFileOptions();
pdfFileOptions.setWatermark(watermark);
ImageCreatePdfFileFromContentRequest request = new ImageCreatePdfFileFromContentRequest();
request.setFile(file);
JSON json = new JSON();
String content = json.serialize(pdfFileOptions);
try {
File pdfFileOptionsfile = File.createTempFile("java", ".json");
FileWriter fileWriter = new FileWriter(pdfFileOptionsfile.getAbsoluteFile(), true);
fileWriter.write(content);
fileWriter.close();
request.setPdfFileOptions(pdfFileOptionsfile);
} catch (IOException e) {
}
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
PdfFileInfo response = apiInstance.imageCreatePdfFileFromContent(request);
System.out.println("File Name: " + response.getFileName());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
HtmlCreatePagesCacheRequest request = new HtmlCreatePagesCacheRequest();
request.setFileName("sample2.mpp");
ProjectOptions projectOptions = new ProjectOptions();
projectOptions.setPageSize("A4");
projectOptions.setTimeUnit("Unknown");
HtmlOptions htmlOptions = new HtmlOptions();
htmlOptions.setAttachmentPassword("");
htmlOptions.setEmbedResources(true);
htmlOptions.setProjectOptions(projectOptions);
request.setHtmlOptions(htmlOptions);
request.setFolder("");
request.setStorage("MyStorage");
HtmlPageCollection response = apiInstance.htmlCreatePagesCache(request);
System.out.println("Cache Created");
System.out.println("Pages Count: " + response.getPages().size());
System.out.println("File Name: " + response.getFileName());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
ImageCreatePagesCacheRequest request = new ImageCreatePagesCacheRequest();
request.setFileName("sample2.mpp");
ProjectOptions projectOptions = new ProjectOptions();
projectOptions.setPageSize("A4");
projectOptions.setTimeUnit("Unknown");
ImageOptions imageOptions = new ImageOptions();
imageOptions.setAttachmentPassword("");
imageOptions.setFormat("jpg");
imageOptions.setQuality(100);
imageOptions.setProjectOptions(projectOptions);
request.setImageOptions(imageOptions);
request.setFolder("");
request.setStorage("MyStorage");
ImagePageCollection response = apiInstance.imageCreatePagesCache(request);
System.out.println("Cache Created");
System.out.println("Pages Count: " + response.getPages().size());
System.out.println("File Name: " + response.getFileName());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
HtmlDeleteAttachmentPagesCacheRequest request = new HtmlDeleteAttachmentPagesCacheRequest();
request.setFileName("with-attachment.msg");
request.setAttachmentName("TestAttachment-File.docx");
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
apiInstance.htmlDeleteAttachmentPagesCache(request);
System.out.println("Cache Deleted");
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
ImageDeleteAttachmentPagesCacheRequest request = new ImageDeleteAttachmentPagesCacheRequest();
request.setFileName("with-attachment.msg");
request.setAttachmentName("TestAttachment-File.docx");
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
apiInstance.imageDeleteAttachmentPagesCache(request);
System.out.println("Cache Deleted");
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
apiInstance.deleteFontsCache();
System.out.println("Cache Deleted");
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
HtmlGetPageRequest request = new HtmlGetPageRequest();
request.setFileName("one-page.docx");
request.setPassword("");
request.setRenderComments(false);
request.setRenderHiddenPages(true);
request.setPageNumber(1);
request.setDefaultFontName(null);
request.setFontsFolder(null);
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
File response = apiInstance.htmlGetPage(request);
System.out.println("File Size: " + response.length());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
ImageGetPageRequest request = new ImageGetPageRequest();
request.setFileName("one-page.docx");
request.setPassword("");
request.setRenderComments(false);
request.setRenderHiddenPages(true);
request.setPageNumber(1);
request.setDefaultFontName(null);
request.setFontsFolder(null);
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
File response = apiInstance.imageGetPage(request);
System.out.println("File Size: " + response.length());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
HtmlGetPagesRequest request = new HtmlGetPagesRequest();
request.setFileName("one-page.docx");
request.setPassword("");
request.setExcludeFonts(true);
request.setStartPageNumber(1);
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
HtmlPageCollection response = apiInstance.htmlGetPages(request);
System.out.println("Pages Count: " + response.getPages().size());
System.out.println("File Name: " + response.getFileName());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
FontCollection response = apiInstance.getFonts();
System.out.println("File Size: " + response.getFamilies().size());
for (FontFamily format : response.getFamilies()) {
System.out.println("Font Nname: " + format.getName());
}
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
FormatCollection response = apiInstance.getSupportedFileFormats();
if (response.getFormats().size() > 0) {
for (Format format : response.getFormats()) {
System.out.println("Format: " + format.toString());
}
}
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
HtmlGetAttachmentRequest request = new HtmlGetAttachmentRequest();
request.setFileName("with-attachment.msg");
request.setAttachmentName("TestAttachment-File.docx");
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
File response = apiInstance.htmlGetAttachment(request);
System.out.println("Attachment Size: " + response.length());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
ImageGetAttachmentRequest request = new ImageGetAttachmentRequest();
request.setFileName("with-attachment.msg");
request.setAttachmentName("TestAttachment-File.docx");
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
File response = apiInstance.imageGetAttachment(request);
System.out.println("Attachment Size: " + response.length());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
HtmlGetAttachmentInfoRequest request = new HtmlGetAttachmentInfoRequest();
request.setFileName("with-attachment.msg");
request.setPassword("");
request.setAttachmentName("TestAttachment-File.docx");
request.setAttachmentPassword("");
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
DocumentInfo response = apiInstance.htmlGetAttachmentInfo(request);
System.out.println("Attachment Name: " + response.getFileName());
System.out.println("Attachment Extension: " + response.getFileFormat());
System.out.println("Attachment Pages Count: " + response.getPages().size());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
ImageGetAttachmentInfoRequest request = new ImageGetAttachmentInfoRequest();
request.setFileName("with-attachment.msg");
request.setPassword("");
request.setAttachmentName("TestAttachment-File.docx");
request.setAttachmentPassword("");
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
DocumentInfo response = apiInstance.imageGetAttachmentInfo(request);
System.out.println("Attachment Name: " + response.getFileName());
System.out.println("Attachment Extension: " + response.getFileFormat());
System.out.println("Attachment Pages Count: " + response.getPages().size());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
HtmlGetAttachmentInfoWithOptionsRequest request = new HtmlGetAttachmentInfoWithOptionsRequest();
request.setFileName("with-attachment.msg");
DocumentInfoOptions documentInfoOptions = new DocumentInfoOptions();
documentInfoOptions.setAttachmentPassword("");
request.setDocumentInfoOptions(documentInfoOptions);
request.setAttachmentName("TestAttachment-File.docx");
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
DocumentInfo response = apiInstance.htmlGetAttachmentInfoWithOptions(request);
System.out.println("Attachment Name: " + response.getFileName());
System.out.println("Attachment Extension: " + response.getFileFormat());
System.out.println("Attachment Pages Count: " + response.getPages().size());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
ImageGetAttachmentInfoWithOptionsRequest request = new ImageGetAttachmentInfoWithOptionsRequest();
request.setFileName("with-attachment.msg");
DocumentInfoOptions documentInfoOptions = new DocumentInfoOptions();
documentInfoOptions.setAttachmentPassword("");
request.setDocumentInfoOptions(documentInfoOptions);
request.setAttachmentName("TestAttachment-File.docx");
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
DocumentInfo response = apiInstance.imageGetAttachmentInfoWithOptions(request);
System.out.println("Attachment Name: " + response.getFileName());
System.out.println("Attachment Extension: " + response.getFileFormat());
System.out.println("Attachment Pages Count: " + response.getPages().size());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
HtmlGetAttachmentPageRequest request = new HtmlGetAttachmentPageRequest();
request.setFileName("with-attachment.msg");
request.setPassword("");
request.setPageNumber(1);
request.setAttachmentName("TestAttachment-File.docx");
request.setAttachmentPassword("");
request.setResourcePath("");
request.setIgnoreResourcePathInResources(false);
request.setEmbedResources(true);
request.setRenderComments(false);
request.setRenderHiddenPages(true);
request.setDefaultFontName(null);
request.setFontsFolder("");
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
File response = apiInstance.htmlGetAttachmentPage(request);
System.out.println("File Name: " + response.getName());
System.out.println("File Size: " + response.length());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
ImageGetAttachmentPageRequest request = new ImageGetAttachmentPageRequest();
request.setFileName("with-attachment.msg");
request.setPassword("");
request.setPageNumber(1);
request.setAttachmentName("TestAttachment-File.docx");
request.setAttachmentPassword("");
request.setRenderComments(false);
request.setRenderHiddenPages(true);
request.setDefaultFontName(null);
request.setFontsFolder("");
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
File response = apiInstance.imageGetAttachmentPage(request);
System.out.println("File Name: " + response.getName());
System.out.println("File Size: " + response.length());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
HtmlGetAttachmentPageResourceRequest request = new HtmlGetAttachmentPageResourceRequest();
request.setFileName("with-attachment.msg");
request.setPageNumber(1);
request.setAttachmentName("TestAttachment-File.docx");
request.setResourceName("styles.css");
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
File response = apiInstance.htmlGetAttachmentPageResource(request);
System.out.println("Name: " + response.getName());
System.out.println("Size: " + response.length());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
HtmlGetAttachmentPagesRequest request = new HtmlGetAttachmentPagesRequest();
request.setFileName("with-attachment.msg");
request.setPassword("");
request.setAttachmentName("TestAttachment-File.docx");
request.setAttachmentPassword("");
request.setResourcePath("");
request.setIgnoreResourcePathInResources(false);
request.setEmbedResources(true);
request.setStartPageNumber(1);
request.setCountPages(null);
request.setRenderComments(false);
request.setRenderHiddenPages(true);
request.setDefaultFontName(null);
request.setFontsFolder("");
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
HtmlAttachmentPageCollection response = apiInstance.htmlGetAttachmentPages(request);
System.out.println("Pages Count: " + response.getPages().size());
System.out.println("File Name: " + response.getFileName());
System.out.println("Attachment Name: " + response.getAttachmentName());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
ImageGetAttachmentPagesRequest request = new ImageGetAttachmentPagesRequest();
request.setFileName("with-attachment.msg");
request.setPassword("");
request.setAttachmentName("TestAttachment-File.docx");
request.setAttachmentPassword("");
request.setStartPageNumber(1);
request.setCountPages(null);
request.setRenderComments(false);
request.setRenderHiddenPages(true);
request.setDefaultFontName(null);
request.setFontsFolder("");
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
ImageAttachmentPageCollection response = apiInstance.imageGetAttachmentPages(request);
System.out.println("Pages Count: " + response.getPages().size());
System.out.println("File Name: " + response.getFileName());
System.out.println("Attachment Name: " + response.getAttachmentName());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
HtmlGetZipWithAttachmentPagesRequest request = new HtmlGetZipWithAttachmentPagesRequest();
request.setFileName("with-attachment.msg");
request.setPassword("");
request.setAttachmentName("TestAttachment-File.docx");
request.setAttachmentPassword("");
request.setResourcePath("");
request.setIgnoreResourcePathInResources(false);
request.setEmbedResources(true);
request.setStartPageNumber(1);
request.setCountPages(null);
request.setRenderComments(false);
request.setRenderHiddenPages(true);
request.setDefaultFontName(null);
request.setFontsFolder("");
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
File response = apiInstance.htmlGetZipWithAttachmentPages(request);
System.out.println("File Name: " + response.getName());
System.out.println("File Size: " + response.length());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
ImageGetZipWithAttachmentPagesRequest request = new ImageGetZipWithAttachmentPagesRequest();
request.setFileName("with-attachment.msg");
request.setPassword("");
request.setAttachmentName("TestAttachment-File.docx");
request.setAttachmentPassword("");
request.setStartPageNumber(1);
request.setCountPages(null);
request.setRenderComments(false);
request.setRenderHiddenPages(true);
request.setDefaultFontName(null);
request.setFontsFolder("");
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
File response = apiInstance.imageGetZipWithAttachmentPages(request);
System.out.println("File Name: " + response.getName());
System.out.println("File Size: " + response.length());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
HtmlGetAttachmentsRequest request = new HtmlGetAttachmentsRequest();
request.setFileName("with-attachment.msg");
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
AttachmentCollection response = apiInstance.htmlGetAttachments(request);
System.out.println("Attachments: " + response.getAttachments().size());
System.out.println("First Attachment Name: " + response.getAttachments().get(0).getName());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
ImageGetAttachmentsRequest request = new ImageGetAttachmentsRequest();
request.setFileName("with-attachment.msg");
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
AttachmentCollection response = apiInstance.imageGetAttachments(request);
System.out.println("Attachments: " + response.getAttachments().size());
System.out.println("First Attachment Name: " + response.getAttachments().get(0).getName());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
HtmlGetDocumentInfoRequest request = new HtmlGetDocumentInfoRequest();
request.setFileName("sample.DXF");
request.setPassword("");
request.setRenderComments(false);
request.setRenderHiddenPages(true);
request.setFolder(null);
request.setStorage("MyStorage");
DocumentInfo response = apiInstance.htmlGetDocumentInfo(request);
System.out.println("Layers Count: " + response.getLayers().size());
System.out.println("File Name: " + response.getFileName());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
ImageGetDocumentInfoRequest request = new ImageGetDocumentInfoRequest();
request.setFileName("sample.DXF");
request.setPassword("");
request.setRenderComments(false);
request.setRenderHiddenPages(true);
request.setFolder(null);
request.setStorage("MyStorage");
DocumentInfo response = apiInstance.imageGetDocumentInfo(request);
System.out.println("Layers Count: " + response.getLayers().size());
System.out.println("File Name: " + response.getFileName());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
Path filePath = Paths.get("D://one-page.docx");
File file = filePath.toFile();
HtmlGetDocumentInfoFromContentRequest request = new HtmlGetDocumentInfoFromContentRequest();
request.setFile(file);
DocumentInfoOptions documentInfoOptions = new DocumentInfoOptions();
documentInfoOptions.setPassword("");
JSON json = new JSON();
String content = json.serialize(documentInfoOptions);
try {
File documentInfoOptionsfile = File.createTempFile("java", ".json");
FileWriter fileWriter = new FileWriter(documentInfoOptionsfile.getAbsoluteFile(), true);
fileWriter.write(content);
fileWriter.close();
request.setDocumentInfoOptions(documentInfoOptionsfile);
} catch (IOException e) {
}
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
DocumentInfo response = apiInstance.htmlGetDocumentInfoFromContent(request);
System.out.println("File Name: " + response.getFileName());
System.out.println("File Extension: " + response.getFileFormat());
System.out.println("File Pages Count: " + response.getPages().size());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
Path filePath = Paths.get("D://one-page.docx");
File file = filePath.toFile();
ImageGetDocumentInfoFromContentRequest request = new ImageGetDocumentInfoFromContentRequest();
request.setFile(file);
DocumentInfoOptions documentInfoOptions = new DocumentInfoOptions();
documentInfoOptions.setPassword("");
JSON json = new JSON();
String content = json.serialize(documentInfoOptions);
try {
File documentInfoOptionsfile = File.createTempFile("java", ".json");
FileWriter fileWriter = new FileWriter(documentInfoOptionsfile.getAbsoluteFile(), true);
fileWriter.write(content);
fileWriter.close();
request.setDocumentInfoOptions(documentInfoOptionsfile);
} catch (IOException e) {
}
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
DocumentInfo response = apiInstance.imageGetDocumentInfoFromContent(request);
System.out.println("File Name: " + response.getFileName());
System.out.println("File Extension: " + response.getFileFormat());
System.out.println("File Pages Count: " + response.getPages().size());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
HtmlGetDocumentInfoRequest request = new HtmlGetDocumentInfoRequest();
request.setFileName("one-page.docx");
request.setPassword("");
request.setRenderComments(false);
request.setRenderHiddenPages(true);
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
DocumentInfo response = apiInstance.htmlGetDocumentInfo(request);
System.out.println("Pages Count: " + response.getPages().size());
System.out.println("File Name: " + response.getFileName());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
ImageGetDocumentInfoRequest request = new ImageGetDocumentInfoRequest();
request.setFileName("one-page.docx");
request.setPassword("");
request.setRenderComments(false);
request.setRenderHiddenPages(true);
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
DocumentInfo response = apiInstance.imageGetDocumentInfo(request);
System.out.println("Pages Count: " + response.getPages().size());
System.out.println("File Name: " + response.getFileName());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
HtmlGetDocumentInfoFromUrlRequest request = new HtmlGetDocumentInfoFromUrlRequest();
request.setUrl("https://www.dropbox.com/s/j260ve4f90h1p41/one-page.docx?dl=1");
request.setFileName("one-page.docx");
request.setPassword("");
request.setRenderComments(false);
request.setRenderHiddenPages(true);
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
DocumentInfo response = apiInstance.htmlGetDocumentInfoFromUrl(request);
System.out.println("Pages Count: " + response.getPages().size());
System.out.println("File Name: " + response.getFileName());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
ImageGetDocumentInfoFromUrlRequest request = new ImageGetDocumentInfoFromUrlRequest();
request.setUrl("https://www.dropbox.com/s/j260ve4f90h1p41/one-page.docx?dl=1");
request.setFileName("one-page.docx");
request.setPassword("");
request.setRenderComments(false);
request.setRenderHiddenPages(true);
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
DocumentInfo response = apiInstance.imageGetDocumentInfoFromUrl(request);
System.out.println("Pages Count: " + response.getPages().size());
System.out.println("File Name: " + response.getFileName());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
HtmlGetDocumentInfoWithOptionsRequest request = new HtmlGetDocumentInfoWithOptionsRequest();
request.setFileName("one-page.docx");
DocumentInfoOptions documentInfoOptions = new DocumentInfoOptions();
documentInfoOptions.setPassword("");
request.setDocumentInfoOptions(documentInfoOptions);
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
DocumentInfo response = apiInstance.htmlGetDocumentInfoWithOptions(request);
System.out.println("File Name: " + response.getFileName());
System.out.println("File Extension: " + response.getFileFormat());
System.out.println("File Pages Count: " + response.getPages().size());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
ImageGetDocumentInfoWithOptionsRequest request = new ImageGetDocumentInfoWithOptionsRequest();
request.setFileName("one-page.docx");
DocumentInfoOptions documentInfoOptions = new DocumentInfoOptions();
documentInfoOptions.setPassword("");
request.setDocumentInfoOptions(documentInfoOptions);
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
DocumentInfo response = apiInstance.imageGetDocumentInfoWithOptions(request);
System.out.println("File Name: " + response.getFileName());
System.out.println("File Extension: " + response.getFileFormat());
System.out.println("File Pages Count: " + response.getPages().size());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
HtmlGetDocumentInfoFromUrlWithOptionsRequest request = new HtmlGetDocumentInfoFromUrlWithOptionsRequest();
request.setUrl("https://www.dropbox.com/s/j260ve4f90h1p41/one-page.docx?dl=1");
request.setFileName("one-pageurl.docx");
DocumentInfoOptions documentInfoOptions = new DocumentInfoOptions();
documentInfoOptions.setPassword("");
request.setDocumentInfoOptions(documentInfoOptions);
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
DocumentInfo response = apiInstance.htmlGetDocumentInfoFromUrlWithOptions(request);
System.out.println("File Name: " + response.getFileName());
System.out.println("File Extension: " + response.getFileFormat());
System.out.println("File Pages Count: " + response.getPages().size());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
ImageGetDocumentInfoFromUrlWithOptionsRequest request = new ImageGetDocumentInfoFromUrlWithOptionsRequest();
request.setUrl("https://www.dropbox.com/s/j260ve4f90h1p41/one-page.docx?dl=1");
request.setFileName("one-pageurl.docx");
DocumentInfoOptions documentInfoOptions = new DocumentInfoOptions();
documentInfoOptions.setPassword("");
request.setDocumentInfoOptions(documentInfoOptions);
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
DocumentInfo response = apiInstance.imageGetDocumentInfoFromUrlWithOptions(request);
System.out.println("File Name: " + response.getFileName());
System.out.println("File Extension: " + response.getFileFormat());
System.out.println("File Pages Count: " + response.getPages().size());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
HtmlGetPagesRequest request = new HtmlGetPagesRequest();
request.setFileName("one-page.docx");
request.setPassword("");
request.setRenderComments(false);
request.setRenderHiddenPages(true);
request.setResourcePath(null);
request.setIgnoreResourcePathInResources(null);
request.setEmbedResources(true);
request.setStartPageNumber(1);
request.setCountPages(null);
request.setDefaultFontName(null);
request.setFontsFolder(null);
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
HtmlPageCollection response = apiInstance.htmlGetPages(request);
System.out.println("Pages Count: " + response.getPages().size());
System.out.println("File Name: " + response.getFileName());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
ImageGetPagesRequest request = new ImageGetPagesRequest();
request.setFileName("one-page.docx");
request.setPassword("");
request.setRenderComments(false);
request.setRenderHiddenPages(true);
request.setHeight(null);
request.setQuality(null);
request.setStartPageNumber(1);
request.setCountPages(null);
request.setDefaultFontName(null);
request.setFontsFolder(null);
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
ImagePageCollection response = apiInstance.imageGetPages(request);
System.out.println("Pages Count: " + response.getPages().size());
System.out.println("File Name: " + response.getFileName());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
HtmlGetPagesFromUrlRequest request = new HtmlGetPagesFromUrlRequest();
request.setUrl("https://www.dropbox.com/s/r2eioe2atushqcf/with-notes.pptx?dl=1");
request.setFileName("one-page.docx");
request.setRenderComments(false);
request.setRenderHiddenPages(true);
request.setStartPageNumber(1);
request.setCountPages(null);
request.setDefaultFontName(null);
request.setFontsFolder(null);
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
HtmlPageCollection response = apiInstance.htmlGetPagesFromUrl(request);
System.out.println("Pages Count: " + response.getPages().size());
System.out.println("File Name: " + response.getFileName());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
ImageGetPagesFromUrlRequest request = new ImageGetPagesFromUrlRequest();
request.setUrl("https://www.dropbox.com/s/r2eioe2atushqcf/with-notes.pptx?dl=1");
request.setFileName("one-page.docx");
request.setRenderComments(false);
request.setRenderHiddenPages(true);
request.setStartPageNumber(1);
request.setCountPages(null);
request.setDefaultFontName(null);
request.setFontsFolder(null);
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
ImagePageCollection response = apiInstance.imageGetPagesFromUrl(request);
System.out.println("Pages Count: " + response.getPages().size());
System.out.println("File Name: " + response.getFileName());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
HtmlGetPdfFileFromUrlRequest request = new HtmlGetPdfFileFromUrlRequest();
request.setUrl("https://www.dropbox.com/s/umokluz338w4ng7%2fone-page.docx");
request.setFileName("one-page.docx");
request.setPassword("");
request.setRenderComments(false);
request.setRenderHiddenPages(true);
request.setDefaultFontName(null);
request.setFontsFolder(null);
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
File response = apiInstance.htmlGetPdfFileFromUrl(request);
System.out.println("File Size: " + response.length());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
ImageGetPdfFileFromUrlRequest request = new ImageGetPdfFileFromUrlRequest();
request.setUrl("https://www.dropbox.com/s/umokluz338w4ng7%2fone-page.docx");
request.setFileName("one-page.docx");
request.setPassword("");
request.setRenderComments(false);
request.setRenderHiddenPages(true);
request.setDefaultFontName(null);
request.setFontsFolder(null);
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
File response = apiInstance.imageGetPdfFileFromUrl(request);
System.out.println("File Size: " + response.length());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
HtmlGetPdfFileRequest request = new HtmlGetPdfFileRequest();
request.setFileName("one-page.docx");
request.setPassword("");
request.setRenderComments(false);
request.setRenderHiddenPages(true);
request.setDefaultFontName(null);
request.setFontsFolder(null);
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
File response = apiInstance.htmlGetPdfFile(request);
System.out.println("File Size: " + response.length());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
ImageGetPdfFileRequest request = new ImageGetPdfFileRequest();
request.setFileName("one-page.docx");
request.setPassword("");
request.setRenderComments(false);
request.setRenderHiddenPages(true);
request.setDefaultFontName(null);
request.setFontsFolder(null);
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
File response = apiInstance.imageGetPdfFile(request);
System.out.println("File Size: " + response.length());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
HtmlGetPageRequest request = new HtmlGetPageRequest();
request.setFileName("one-page.docx");
request.setPassword("");
request.setRenderComments(false);
request.setRenderHiddenPages(true);
request.setEnableResponsiveRendering(true);
request.setPageNumber(1);
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
File response = apiInstance.htmlGetPage(request);
System.out.println("File Size: " + response.length());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
HtmlCreatePdfFileRequest request = new HtmlCreatePdfFileRequest();
request.setFileName("one-page.docx");
Watermark watermark = new Watermark();
watermark.setText("GrouDocs Cloud API");
PdfFileOptions pdfFileOptions = new PdfFileOptions();
pdfFileOptions.setWatermark(watermark);
request.setPdfFileOptions(pdfFileOptions);
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
PdfFileInfo response = apiInstance.htmlCreatePdfFile(request);
System.out.println("File Name: " + response.getFileName());
System.out.println("folder: " + response.getFolder());
System.out.println("PDF File Name: " + response.getPdfFileName());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
ImageCreatePdfFileRequest request = new ImageCreatePdfFileRequest();
request.setFileName("one-page.docx");
Watermark watermark = new Watermark();
watermark.setText("GrouDocs Cloud API");
PdfFileOptions pdfFileOptions = new PdfFileOptions();
pdfFileOptions.setWatermark(watermark);
;
request.setPdfFileOptions(pdfFileOptions);
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
PdfFileInfo response = apiInstance.imageCreatePdfFile(request);
System.out.println("File Name: " + response.getFileName());
System.out.println("folder: " + response.getFolder());
System.out.println("PDF File Name: " + response.getPdfFileName());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
HtmlGetZipWithPagesRequest request = new HtmlGetZipWithPagesRequest();
request.setFileName("one-page.docx");
request.setRenderComments(false);
request.setRenderHiddenPages(true);
request.setStartPageNumber(1);
request.setCountPages(null);
request.setDefaultFontName(null);
request.setFontsFolder(null);
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
File response = apiInstance.htmlGetZipWithPages(request);
System.out.println("File Size: " + response.length());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
ImageGetZipWithPagesRequest request = new ImageGetZipWithPagesRequest();
request.setFileName("one-page.docx");
request.setRenderComments(false);
request.setRenderHiddenPages(true);
request.setStartPageNumber(1);
request.setCountPages(null);
request.setDefaultFontName(null);
request.setFontsFolder(null);
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
File response = apiInstance.imageGetZipWithPages(request);
System.out.println("File Size: " + response.length());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
HtmlGetPageResourceRequest request = new HtmlGetPageResourceRequest();
request.setFileName("one-page.docx");
request.setPageNumber(1);
request.setResourceName("styles.css");
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
File response = apiInstance.htmlGetPageResource(request);
System.out.println("File Size: " + response.length());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
ImageDeletePagesCacheRequest request = new ImageDeletePagesCacheRequest();
request.setFileName("one-page.docx");
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
apiInstance.imageDeletePagesCache(request);
System.out.println("Cache Deleted");
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
HtmlDeletePagesCacheRequest request = new HtmlDeletePagesCacheRequest();
request.setFileName("one-page.docx");
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
apiInstance.htmlDeletePagesCache(request);
System.out.println("Cache Deleted");
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
package Examples;
import com.groupdocs.cloud.viewer.client.*;
import com.groupdocs.cloud.viewer.model.*;
import com.groupdocs.cloud.viewer.model.requests.HtmlCreatePagesCacheRequest;
import com.groupdocs.cloud.viewer.api.ViewerApi;
import java.util.*;
public class Viewer_Java_Render_CAD_Tiles {
public static void main(String[] args) {
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free
// registration is required).
String appSid = "XXX-XXXXXXX-XXXX";
String appKey = "XXXXXXXXXXXXX";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
HtmlCreatePagesCacheRequest request = new HtmlCreatePagesCacheRequest();
request.setFileName("sample.DXF");
request.setStorage("MyStorage");
HtmlOptions htmlOptions = new HtmlOptions();
CadOptions cadOptions = new CadOptions();
ArrayList<Tile> lstTiles = new ArrayList<Tile>();
Tile tile = new Tile();
tile.setHeight(800);
tile.setWidth(1300);
tile.setStartPointX(0);
tile.setStartPointY(0);
lstTiles.add(tile);
tile.setHeight(800);
tile.setWidth(1300);
tile.setStartPointX(1300);
tile.setStartPointY(0);
lstTiles.add(tile);
tile.setHeight(800);
tile.setWidth(1300);
tile.setStartPointX(0);
tile.setStartPointY(800);
lstTiles.add(tile);
tile.setHeight(800);
tile.setWidth(1300);
tile.setStartPointX(1300);
tile.setStartPointY(800);
lstTiles.add(tile);
cadOptions.setTiles(lstTiles);
htmlOptions.setCadOptions(cadOptions);
request.setHtmlOptions(htmlOptions);
HtmlPageCollection response = apiInstance.htmlCreatePagesCache(request);
System.out.println("Cache Created");
System.out.println("Pages Count: " + response.getPages().size());
System.out.println("File Name: " + response.getFileName());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
}
}
package Examples;
import com.groupdocs.cloud.viewer.client.*;
import com.groupdocs.cloud.viewer.model.*;
import com.groupdocs.cloud.viewer.model.requests.HtmlCreatePagesCacheRequest;
import com.groupdocs.cloud.viewer.api.ViewerApi;
import java.util.*;
public class Viewer_Java_Render_Email_Header {
public static void main(String[] args) {
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free
// registration is required).
String appSid = "XXX-XXXXXXX-XXXX";
String appKey = "XXXXXXXXXXXXX";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
HtmlCreatePagesCacheRequest request = new HtmlCreatePagesCacheRequest();
request.setFileName("with-attachment.msg");
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
HtmlOptions htmlOptions = new HtmlOptions();
EmailOptions emailOptions = new EmailOptions();
ArrayList<FieldLabel> lstfieldLabels = new ArrayList<FieldLabel>();
FieldLabel fieldLabel = new FieldLabel();
fieldLabel.setField("From");
fieldLabel.setLabel("Sender");
lstfieldLabels.add(fieldLabel);
fieldLabel.setField("To");
fieldLabel.setLabel("Receiver");
lstfieldLabels.add(fieldLabel);
emailOptions.setFieldLabels(lstfieldLabels);
htmlOptions.setEmailOptions(emailOptions);
request.setHtmlOptions(htmlOptions);
HtmlPageCollection response = apiInstance.htmlCreatePagesCache(request);
System.out.println("Cache Created");
System.out.println("Pages Count: " + response.getPages().size());
System.out.println("File Name: " + response.getFileName());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
}
}
package Examples;
import com.groupdocs.cloud.viewer.client.*;
import com.groupdocs.cloud.viewer.model.*;
import com.groupdocs.cloud.viewer.model.requests.ImageCreatePagesCacheRequest;
import com.groupdocs.cloud.viewer.api.ViewerApi;
public class Viewer_Java_Render_Email_Image_PageSize {
public static void main(String[] args) {
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free
// registration is required).
String appSid = "XXX-XXXXXXX-XXXX";
String appKey = "XXXXXXXXXXXXX";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
ImageCreatePagesCacheRequest request = new ImageCreatePagesCacheRequest();
request.setFileName("with-attachment.msg");
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
ImageOptions imageOptions = new ImageOptions();
EmailOptions emailOptions = new EmailOptions();
emailOptions.setPageSize("A0");
imageOptions.setEmailOptions(emailOptions);
request.setImageOptions(imageOptions);
ImagePageCollection response = apiInstance.imageCreatePagesCache(request);
System.out.println("Cache Created");
System.out.println("Pages Count: " + response.getPages().size());
System.out.println("File Name: " + response.getFileName());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
}
}
package Examples;
import com.groupdocs.cloud.viewer.client.*;
import com.groupdocs.cloud.viewer.model.*;
import com.groupdocs.cloud.viewer.model.requests.ImageCreatePdfFileRequest;
import com.groupdocs.cloud.viewer.api.ViewerApi;
public class Viewer_Java_Render_Email_PDF {
public static void main(String[] args) {
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free
// registration is required).
String appSid = "XXX-XXXXXXX-XXXX";
String appKey = "XXXXXXXXXXXXX";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
ImageCreatePdfFileRequest request = new ImageCreatePdfFileRequest();
request.setFileName("with-attachment.msg");
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
PdfFileOptions pdfFileOptions = new PdfFileOptions();
EmailOptions emailOptions = new EmailOptions();
emailOptions.setPageSize("A0");
pdfFileOptions.setEmailOptions(emailOptions);
request.setPdfFileOptions(pdfFileOptions);
PdfFileInfo response = apiInstance.imageCreatePdfFile(request);
System.out.println("Cache Created");
System.out.println("File Name: " + response.getFileName());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
}
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
HtmlCreatePagesCacheRequest request = new HtmlCreatePagesCacheRequest();
request.setFileName("with-overflowed-text.xlsx");
request.setFolder("");
request.setStorage("MyStorage");
HtmlOptions htmlOptions = new HtmlOptions();
CellsOptions cellsOptions = new CellsOptions();
cellsOptions.setRenderHiddenRows(true);
htmlOptions.setCellsOptions(cellsOptions);
HtmlPageCollection response = apiInstance.htmlCreatePagesCache(request);
System.out.println("File Name: " + response.getFileName());
System.out.println("File Pages Count: " + response.getPages().size());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free
// registration is required).
String appSid = "XXX-XXXXXXX-XXXX";
String appKey = "XXXXXXXXXXXXX";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
String file = "data.pst";
HtmlOptions options = new HtmlOptions();
options.setEmbedResources(true);
OutlookOptions outlookOptions = new OutlookOptions();
outlookOptions.setMaxItemsInFolder(5);
options.setOutlookOptions(outlookOptions);
HtmlCreatePagesCacheRequest request = new HtmlCreatePagesCacheRequest();
request.setFileName(file);
request.setHtmlOptions(options);
request.setFontsFolder(null);
request.setFolder(null);
request.setStorage(null);
HtmlPageCollection response = apiInstance.htmlCreatePagesCache(request);
System.out.println("Cache Created");
System.out.println("Pages Count: " + response.getPages().size());
System.out.println("File Name: " + response.getFileName());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
package Examples;
import com.groupdocs.cloud.viewer.client.*;
import com.groupdocs.cloud.viewer.model.*;
import com.groupdocs.cloud.viewer.model.requests.ImageCreatePdfFileRequest;
import com.groupdocs.cloud.viewer.api.ViewerApi;
public class Viewer_Java_Render_PDF_DefaultFont {
public static void main(String[] args) {
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free
// registration is required).
String appSid = "XXX-XXXXXXX-XXXX";
String appKey = "XXXXXXXXXXXXX";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
ImageCreatePdfFileRequest request = new ImageCreatePdfFileRequest();
request.setFileName("sample2.pdf");
request.setStorage("MyStorage");
PdfFileOptions pdfFileOptions = new PdfFileOptions();
pdfFileOptions.setDefaultFontName("Arial");
request.setPdfFileOptions(pdfFileOptions);
PdfFileInfo response = apiInstance.imageCreatePdfFile(request);
System.out.println("Cache Created");
System.out.println("File Name: " + response.getFileName());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
}
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
HtmlCreatePagesCacheRequest request = new HtmlCreatePagesCacheRequest();
request.setFileName("with-overflowed-text.xlsx");
request.setFolder("");
request.setStorage("MyStorage");
HtmlOptions htmlOptions = new HtmlOptions();
CellsOptions cellsOptions = new CellsOptions();
cellsOptions.setRenderPrintAreaOnly(true);
cellsOptions.setRenderGridLines(true);
htmlOptions.setCellsOptions(cellsOptions);
HtmlPageCollection response = apiInstance.htmlCreatePagesCache(request);
System.out.println("File Name: " + response.getFileName());
System.out.println("File Pages Count: " + response.getPages().size());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
HtmlCreatePagesCacheRequest request = new HtmlCreatePagesCacheRequest();
request.setFileName("sample2.mpp");
ProjectOptions projectOptions = new ProjectOptions();
projectOptions.setTimeUnit("Days");
projectOptions.setStartDate(OffsetDateTime.parse("2008-07-01T00:00:00Z"));
projectOptions.setEndDate(OffsetDateTime.parse("2008-07-31T00:00:00Z"));
HtmlOptions htmlOptions = new HtmlOptions();
htmlOptions.setAttachmentPassword("");
htmlOptions.setEmbedResources(true);
htmlOptions.setProjectOptions(projectOptions);
request.setHtmlOptions(htmlOptions);
request.setFolder("");
request.setStorage("MyStorage");
HtmlPageCollection response = apiInstance.htmlCreatePagesCache(request);
System.out.println("Cache Created");
System.out.println("Pages Count: " + response.getPages().size());
System.out.println("File Name: " + response.getFileName());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
HtmlTransformPagesRequest request = new HtmlTransformPagesRequest();
request.setFileName("one-page.docx");
ReorderOptions reorderOptions = new ReorderOptions();
reorderOptions.setPageNumber(1);
reorderOptions.setNewPosition (2);
request.setTransformOptions(reorderOptions);
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
PageInfoCollection response = apiInstance.htmlTransformPages(request);
System.out.println("Pages Count: " + response.getPages().size());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
ImageTransformPagesRequest request = new ImageTransformPagesRequest();
request.setFileName("one-page.docx");
ReorderOptions reorderOptions = new ReorderOptions();
reorderOptions.setPageNumber(1);
reorderOptions.setNewPosition (2);
request.setTransformOptions(reorderOptions);
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
PageInfoCollection response = apiInstance.imageTransformPages(request);
System.out.println("Pages Count: " + response.getPages().size());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
HtmlTransformPagesRequest request = new HtmlTransformPagesRequest();
request.setFileName("one-page.docx");
RotateOptions rotateOptions = new RotateOptions();
rotateOptions.setPageNumber(1);
rotateOptions.setAngle(90);
request.setTransformOptions(rotateOptions);
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
PageInfoCollection response = apiInstance.htmlTransformPages(request);
System.out.println("Pages Count: " + response.getPages().size());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
ImageTransformPagesRequest request = new ImageTransformPagesRequest();
request.setFileName("one-page.docx");
RotateOptions rotateOptions = new RotateOptions();
rotateOptions.setPageNumber(1);
rotateOptions.setAngle(90);
request.setTransformOptions(rotateOptions);
request.setFolder("viewerdocs");
request.setStorage("MyStorage");
PageInfoCollection response = apiInstance.imageTransformPages(request);
System.out.println("Pages Count: " + response.getPages().size());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
HtmlCreatePagesCacheRequest request = new HtmlCreatePagesCacheRequest();
request.setFileName("sample2.pdf");
request.setFolder("");
request.setStorage("MyStorage");
HtmlOptions htmlOptions = new HtmlOptions();
PdfOptions pdfOptions = new PdfOptions();
pdfOptions.setImageQuality("High");
htmlOptions.setPdfOptions(pdfOptions);
HtmlPageCollection response = apiInstance.htmlCreatePagesCache(request);
System.out.println("File Name: " + response.getFileName());
System.out.println("File Pages Count: " + response.getPages().size());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
// TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
String appSid = "xxxx";
String appKey = "xxx-xx";
ViewerApi apiInstance = new ViewerApi(appSid, appKey);
try {
HtmlCreatePagesCacheRequest request = new HtmlCreatePagesCacheRequest();
request.setFileName("with-overflowed-text.xlsx");
request.setFolder("");
request.setStorage("MyStorage");
HtmlOptions htmlOptions = new HtmlOptions();
CellsOptions cellsOptions = new CellsOptions();
cellsOptions.setTextOverflowMode("AutoFitColumn");
htmlOptions.setCellsOptions(cellsOptions);
HtmlPageCollection response = apiInstance.htmlCreatePagesCache(request);
System.out.println("File Name: " + response.getFileName());
System.out.println("File Pages Count: " + response.getPages().size());
System.out.println("Executed Successfully");
} catch (ApiException e) {
System.err.println("Exception when calling ViewerApi");
e.printStackTrace();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment