@Test public void testCreateImage() throws IOException { String presentationId = this.createTestPresentation(); String pageId = this.createTestSlide(presentationId); BatchUpdatePresentationResponse response = this.snippets.createImage( presentationId, pageId, this.credential); assertEquals(1, response.getReplies().size()); String imageId = response.getReplies().get(0).getCreateImage().getObjectId(); assertNotNull(imageId); }
public BatchUpdatePresentationResponse createImage(String presentationId, String slideId, GoogleCredential credential) throws IOException { Slides slidesService = this.service; String imageUrl = "https: List<Request> requests = new ArrayList<>(); String imageId = "MyImageId_01"; Dimension emu4M = new Dimension().setMagnitude(4000000.0).setUnit("EMU"); requests.add(new Request() .setCreateImage(new CreateImageRequest() .setObjectId(imageId) .setUrl(imageUrl) .setElementProperties(new PageElementProperties() .setPageObjectId(slideId) .setSize(new Size() .setHeight(emu4M) .setWidth(emu4M)) .setTransform(new AffineTransform() .setScaleX(1.0) .setScaleY(1.0) .setTranslateX(100000.0) .setTranslateY(100000.0) .setUnit("EMU"))))); BatchUpdatePresentationRequest body = new BatchUpdatePresentationRequest().setRequests(requests); BatchUpdatePresentationResponse response = slidesService.presentations().batchUpdate(presentationId, body).execute(); CreateImageResponse createImageResponse = response.getReplies().get(0).getCreateImage(); System.out.println("Created image with ID: " + createImageResponse.getObjectId()); return response; }
Snippets { public BatchUpdatePresentationResponse createImage(String presentationId, String slideId, GoogleCredential credential) throws IOException { Slides slidesService = this.service; String imageUrl = "https: List<Request> requests = new ArrayList<>(); String imageId = "MyImageId_01"; Dimension emu4M = new Dimension().setMagnitude(4000000.0).setUnit("EMU"); requests.add(new Request() .setCreateImage(new CreateImageRequest() .setObjectId(imageId) .setUrl(imageUrl) .setElementProperties(new PageElementProperties() .setPageObjectId(slideId) .setSize(new Size() .setHeight(emu4M) .setWidth(emu4M)) .setTransform(new AffineTransform() .setScaleX(1.0) .setScaleY(1.0) .setTranslateX(100000.0) .setTranslateY(100000.0) .setUnit("EMU"))))); BatchUpdatePresentationRequest body = new BatchUpdatePresentationRequest().setRequests(requests); BatchUpdatePresentationResponse response = slidesService.presentations().batchUpdate(presentationId, body).execute(); CreateImageResponse createImageResponse = response.getReplies().get(0).getCreateImage(); System.out.println("Created image with ID: " + createImageResponse.getObjectId()); return response; } }
Snippets { public BatchUpdatePresentationResponse createImage(String presentationId, String slideId, GoogleCredential credential) throws IOException { Slides slidesService = this.service; String imageUrl = "https: List<Request> requests = new ArrayList<>(); String imageId = "MyImageId_01"; Dimension emu4M = new Dimension().setMagnitude(4000000.0).setUnit("EMU"); requests.add(new Request() .setCreateImage(new CreateImageRequest() .setObjectId(imageId) .setUrl(imageUrl) .setElementProperties(new PageElementProperties() .setPageObjectId(slideId) .setSize(new Size() .setHeight(emu4M) .setWidth(emu4M)) .setTransform(new AffineTransform() .setScaleX(1.0) .setScaleY(1.0) .setTranslateX(100000.0) .setTranslateY(100000.0) .setUnit("EMU"))))); BatchUpdatePresentationRequest body = new BatchUpdatePresentationRequest().setRequests(requests); BatchUpdatePresentationResponse response = slidesService.presentations().batchUpdate(presentationId, body).execute(); CreateImageResponse createImageResponse = response.getReplies().get(0).getCreateImage(); System.out.println("Created image with ID: " + createImageResponse.getObjectId()); return response; } Snippets(Slides service, Drive driveService, Sheets sheetsService); }
Snippets { public BatchUpdatePresentationResponse createImage(String presentationId, String slideId, GoogleCredential credential) throws IOException { Slides slidesService = this.service; String imageUrl = "https: List<Request> requests = new ArrayList<>(); String imageId = "MyImageId_01"; Dimension emu4M = new Dimension().setMagnitude(4000000.0).setUnit("EMU"); requests.add(new Request() .setCreateImage(new CreateImageRequest() .setObjectId(imageId) .setUrl(imageUrl) .setElementProperties(new PageElementProperties() .setPageObjectId(slideId) .setSize(new Size() .setHeight(emu4M) .setWidth(emu4M)) .setTransform(new AffineTransform() .setScaleX(1.0) .setScaleY(1.0) .setTranslateX(100000.0) .setTranslateY(100000.0) .setUnit("EMU"))))); BatchUpdatePresentationRequest body = new BatchUpdatePresentationRequest().setRequests(requests); BatchUpdatePresentationResponse response = slidesService.presentations().batchUpdate(presentationId, body).execute(); CreateImageResponse createImageResponse = response.getReplies().get(0).getCreateImage(); System.out.println("Created image with ID: " + createImageResponse.getObjectId()); return response; } Snippets(Slides service, Drive driveService, Sheets sheetsService); String createPresentation(String title); String copyPresentation(String presentationId, String copyTitle); BatchUpdatePresentationResponse createSlide(String presentationId); BatchUpdatePresentationResponse createTextBoxWithText(
            String presentationId, String slideId); BatchUpdatePresentationResponse createImage(String presentationId,
                                                       String slideId,
                                                       GoogleCredential credential); List<BatchUpdatePresentationResponse> textMerging(
            String templatePresentationId, String dataSpreadsheetId); BatchUpdatePresentationResponse imageMerging(String templatePresentationId,
                                                        String imageUrl,
                                                        String customerName); BatchUpdatePresentationResponse simpleTextReplace(
            String presentationId, String shapeId, String replacementText); BatchUpdatePresentationResponse textStyleUpdate(String presentationId, String shapeId); BatchUpdatePresentationResponse createBulletedText(String presentationId,
                                                              String shapeId); BatchUpdatePresentationResponse createSheetsChart(
            String presentationId, String pageId, String spreadsheetId, Integer sheetChartId); BatchUpdatePresentationResponse refreshSheetsChart(
            String presentationId, String presentationChartId); }
Snippets { public BatchUpdatePresentationResponse createImage(String presentationId, String slideId, GoogleCredential credential) throws IOException { Slides slidesService = this.service; String imageUrl = "https: List<Request> requests = new ArrayList<>(); String imageId = "MyImageId_01"; Dimension emu4M = new Dimension().setMagnitude(4000000.0).setUnit("EMU"); requests.add(new Request() .setCreateImage(new CreateImageRequest() .setObjectId(imageId) .setUrl(imageUrl) .setElementProperties(new PageElementProperties() .setPageObjectId(slideId) .setSize(new Size() .setHeight(emu4M) .setWidth(emu4M)) .setTransform(new AffineTransform() .setScaleX(1.0) .setScaleY(1.0) .setTranslateX(100000.0) .setTranslateY(100000.0) .setUnit("EMU"))))); BatchUpdatePresentationRequest body = new BatchUpdatePresentationRequest().setRequests(requests); BatchUpdatePresentationResponse response = slidesService.presentations().batchUpdate(presentationId, body).execute(); CreateImageResponse createImageResponse = response.getReplies().get(0).getCreateImage(); System.out.println("Created image with ID: " + createImageResponse.getObjectId()); return response; } Snippets(Slides service, Drive driveService, Sheets sheetsService); String createPresentation(String title); String copyPresentation(String presentationId, String copyTitle); BatchUpdatePresentationResponse createSlide(String presentationId); BatchUpdatePresentationResponse createTextBoxWithText(
            String presentationId, String slideId); BatchUpdatePresentationResponse createImage(String presentationId,
                                                       String slideId,
                                                       GoogleCredential credential); List<BatchUpdatePresentationResponse> textMerging(
            String templatePresentationId, String dataSpreadsheetId); BatchUpdatePresentationResponse imageMerging(String templatePresentationId,
                                                        String imageUrl,
                                                        String customerName); BatchUpdatePresentationResponse simpleTextReplace(
            String presentationId, String shapeId, String replacementText); BatchUpdatePresentationResponse textStyleUpdate(String presentationId, String shapeId); BatchUpdatePresentationResponse createBulletedText(String presentationId,
                                                              String shapeId); BatchUpdatePresentationResponse createSheetsChart(
            String presentationId, String pageId, String spreadsheetId, Integer sheetChartId); BatchUpdatePresentationResponse refreshSheetsChart(
            String presentationId, String presentationChartId);  }