saveChanges method throw error when used with multiple image

Questions, comments and suggestions concerning VintaSoft Imaging .NET SDK.

Moderator: Alex

Post Reply
jwalit.katira
Posts: 31
Joined: Mon Sep 18, 2023 1:41 pm

saveChanges method throw error when used with multiple image

Post by jwalit.katira »

Hello ,

I have open multiple images in web document viewer using array below is the sample code

Code: Select all

let images = [
      "0.jpg",
      "1.jpg",
      "2.jpg",
    ];

imageViewer.get_Images().openFiles(images);
After that we have deleted 0.jpg and save that changes using below code

Code: Select all

let index = docViewer.getFocusedIndex();
    docViewer.removePage(index);
    docViewer.saveChanges();
The above code sent .Net core API request "MyVintasoftFileApi/SaveImageFile" to save the changes , below is the request

Code: Select all

{
  "fileId": "0.jpg",
  "createNewFile": false,
  "imageInfos": [
    {
      "fileInfo": {
        "id": "1.jpg"
      },
      "pageIndex": 0
    },
    {
      "fileInfo": {
        "id": "2.jpg"
      },
      "pageIndex": 0
    }
  ],
  "sessionId": "SessionID"
}
But it in response we are getting error of "Single-page encoder cannot be used because collection contains more than one image" , below is the response

Code: Select all

{
    "fileId": "0.jpg",
    "success": false,
    "blocked": false,
    "errorMessage": "Single-page encoder cannot be used because collection contains more than one image.\r\n",
    "requestId": null
}
Can you please share how can we resolve this error

Thanks
Jwalit Katira
Alex
Site Admin
Posts: 2319
Joined: Thu Jul 10, 2008 2:21 pm

Re: saveChanges method throw error when used with multiple image

Post by Alex »

Hello Jwalit,

You have error because WebDocumentViewerJS.saveChanges function cannot save 2 JPEG images to a JPEG file because JPEG file can store 1 image only.

Please use WebDocumentViewerJS.exportFile or WebDocumentViewerJS.exportAndDownloadFile functions and save 2 JPEG images to a TIFF or PDF file.

Best regards, Alexander
Post Reply