We're sorry AsposeCloud doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.cloud

Replace a single image using multiple image ids in node.js?

Hi there,

My workflow requires that I combine multiple PDF modules per customer request. I need to replace images in each of these modules based on customer’s requirements. Replacing images in each module before combining them works but it wouldn’t be cost effective given the number of API calls it would require.

Since the images to be changed are exactly the same in each one of the PDF modules, I figured I could combine all modules and then simply replace the images in the combined PDF. However, even though each module had the exact same image id prior combination, after combining them they acquire new images id which makes it impossible to target them all at once using the same API call

PDF modules prior combination
ModuleA.pdf   Target image Id: 'GM5TIMBUGU3DWMRZHAWDKOBXFQZTCMBMGU4TS'
ModuleB.pdf   Target image Id: 'GM5TIMBUGU3DWMRZHAWDKOBXFQZTCMBMGU4TS'
ModuleC.pdf   Target image Id: 'GM5TIMBUGU3DWMRZHAWDKOBXFQZTCMBMGU4TS'

Once I combine the different modules using ‘putMergeDocuments’ the images change their id as follows (I used ‘getImages’ to find them):

Images id in CombinedModules.pdf
Target image id from module A: 'GM5TIMBUGU3DWMRZHAWDKOBXFQZTCMBMGU4TS' (stays the same)
Target image id from module B: 'GEYDAOZUGA2DKNR3GI4TQLBVHA3SYMZRGAWDKOJZ' (changed)
Target image id from module C: 'GE4TOOZUGA2DKNR3GI4TQLBVHA3SYMZRGAWDKOJZ' (changed)

Since the combined PDF module has the same image but with different ids, is there any way I can use ‘putReplaceImage’ to change a single image but to target multiple image ids so I can use a single API call? Are there alternative solutions?

The example I gave above is simplistic but serves to explain my point, in reality, replacing images per module prior combination would require 200 API calls per combined document. This wouldn’t work.

Thank you in advance for your help.

I am afraid that currently we do not support replacing multiple images with a single image. We have opened the following new ticket(s) for your requirement in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

  Issue ID(s): PDFCLOUD-3331

You can obtain Paid Support services if you need support on a priority basis, along with the direct access to our Paid Support management team.