Parse supplier catalogs, enhance product images, and generate listing graphics — all in one automated flow.
Who this is for
Marketplace operators and e-commerce teams use this pipeline to process supplier catalogs end-to-end. Extract product data from a catalog PDF, optimize the product images, and generate listing cards with pricing — all automated in three API calls.
import{IterationLayer}from"iterationlayer";constclient=newIterationLayer({apiKey:"YOUR_API_KEY"});// Step 1: Extract catalog data from supplier PDFconstcatalogResult=awaitclient.extract({files:[{type:"url",name:"catalog.pdf",url:"https://example.com/supplier-catalog.pdf",},],schema:{fields:[{name:"products",type:"ARRAY",description:"List of products in the catalog",fields:[{name:"name",type:"TEXT",description:"Product name"},{name:"sku",type:"TEXT",description:"Product SKU"},{name:"price",type:"CURRENCY_AMOUNT",description:"Product price"},{name:"image_url",type:"TEXT",description:"URL of the product image"},]},],},});constfirstProduct=catalogResult.results[0].products[0];// Step 2: Optimize the product image (resize, enhance, convert to WebP)consttransformResult=awaitclient.transform({file:{type:"url",name:"product-photo.jpg",url:firstProduct.image_url,},operations:[{type:"resize",width_in_px:800,height_in_px:800,fit:"contain"},{type:"auto_contrast"},{type:"convert",format:"webp",quality:85},],});constoptimizedImageBase64=transformResult.data.buffer;// Step 3: Generate a listing card with the optimized photo and pricingconstcardResult=awaitclient.generateImage({dimensions:{width_in_px:800,height_in_px:1000},output_format:"png",layers:[{index:0,type:"solid-color-background",hex_color:"#FFFFFF",},{index:1,type:"static-image",buffer:optimizedImageBase64,position:{x_in_px:50,y_in_px:50},dimensions:{width_in_px:700,height_in_px:700},},{index:2,type:"rectangle",hex_color:"#E53935",position:{x_in_px:560,y_in_px:50},dimensions:{width_in_px:190,height_in_px:60},},{index:3,type:"text",text:`${firstProduct.price}`,font_name:"Roboto",font_size_in_px:32,text_color:"#FFFFFF",font_weight:"Bold",text_align:"center",position:{x_in_px:560,y_in_px:55},dimensions:{width_in_px:190,height_in_px:50},},{index:4,type:"text",text:firstProduct.name,font_name:"Inter",font_size_in_px:28,text_color:"#1a1a1a",font_weight:"Bold",text_align:"center",position:{x_in_px:50,y_in_px:800},dimensions:{width_in_px:700,height_in_px:50},},],});constlistingCardBuffer=Buffer.from(cardResult.data.buffer,"base64");
importbase64fromiterationlayerimportIterationLayerclient=IterationLayer(api_key="YOUR_API_KEY")# Step 1: Extract catalog data from supplier PDF
catalog_result=client.extract(files=[{"type":"url","name":"catalog.pdf","url":"https://example.com/supplier-catalog.pdf",}],schema={"fields":[{"name":"products","type":"ARRAY","description":"List of products in the catalog","fields":[{"name":"name","type":"TEXT","description":"Product name"},{"name":"sku","type":"TEXT","description":"Product SKU"},{"name":"price","type":"CURRENCY_AMOUNT","description":"Product price"},{"name":"image_url","type":"TEXT","description":"URL of the product image"},]},]},)first_product=catalog_result["results"][0]["products"][0]# Step 2: Optimize the product image (resize, enhance, convert to WebP)
transform_result=client.transform(file={"type":"url","name":"product-photo.jpg","url":first_product["image_url"],},operations=[{"type":"resize","width_in_px":800,"height_in_px":800,"fit":"contain"},{"type":"auto_contrast"},{"type":"convert","format":"webp","quality":85},],)optimized_image_base64=transform_result["data"]["buffer"]# Step 3: Generate a listing card with the optimized photo and pricing
card_result=client.generate_image(dimensions={"width_in_px":800,"height_in_px":1000},output_format="png",layers=[{"index":0,"type":"solid-color-background","hex_color":"#FFFFFF",},{"index":1,"type":"static-image","buffer":optimized_image_base64,"position":{"x_in_px":50,"y_in_px":50},"dimensions":{"width_in_px":700,"height_in_px":700},},{"index":2,"type":"rectangle","hex_color":"#E53935","position":{"x_in_px":560,"y_in_px":50},"dimensions":{"width_in_px":190,"height_in_px":60},},{"index":3,"type":"text","text":str(first_product["price"]),"font_name":"Roboto","font_size_in_px":32,"text_color":"#FFFFFF","font_weight":"Bold","text_align":"center","position":{"x_in_px":560,"y_in_px":55},"dimensions":{"width_in_px":190,"height_in_px":50},},{"index":4,"type":"text","text":first_product["name"],"font_name":"Inter","font_size_in_px":28,"text_color":"#1a1a1a","font_weight":"Bold","text_align":"center","position":{"x_in_px":50,"y_in_px":800},"dimensions":{"width_in_px":700,"height_in_px":50},},],)withopen("listing-card.png","wb")asf:f.write(base64.b64decode(card_result["data"]["buffer"]))
packagemainimportil"github.com/iterationlayer/sdk-go"client:=il.NewClient("YOUR_API_KEY")// Step 1: Extract catalog data from supplier PDF
catalogResult,err:=client.Extract(il.ExtractRequest{Files:[]il.FileInput{il.NewFileFromURL("catalog.pdf","https://example.com/supplier-catalog.pdf"),},Schema:il.ExtractionSchema{"products":il.NewArrayFieldConfig("products","List of products in the catalog",[]il.FieldConfig{il.NewTextFieldConfig("name","Product name"),il.NewTextFieldConfig("sku","Product SKU"),il.NewCurrencyAmountFieldConfig("price","Product price"),il.NewTextFieldConfig("image_url","URL of the product image"),}),},})// Step 2: Optimize the product image (resize, enhance, convert to WebP)
transformResult,err:=client.Transform(il.TransformRequest{File:il.NewFileFromURL("product-photo.jpg","https://example.com/products/photo-001.jpg"),Operations:[]il.TransformOperation{il.NewResizeOperation(800,800,"contain"),{Type:"auto_contrast"},il.NewConvertOperation("webp"),},})// Step 3: Generate a listing card with the optimized photo and pricing
cardResult,err:=client.GenerateImage(il.GenerateImageRequest{Dimensions:il.Dimensions{WidthInPx:800,HeightInPx:1000},OutputFormat:"png",Layers:[]il.Layer{il.NewSolidColorBackgroundLayer(0,"#FFFFFF"),il.NewStaticImageLayer(1,il.FileInput{Buffer:transformResult.Data.Buffer},il.Position{XInPx:50,YInPx:50},il.Dimensions{WidthInPx:700,HeightInPx:700}),il.NewRectangleLayer(2,"#E53935",il.Position{XInPx:560,YInPx:50},il.Dimensions{WidthInPx:190,HeightInPx:60}),il.NewTextLayer(3,"$29.99","Roboto",32,"#FFFFFF",il.Position{XInPx:560,YInPx:55},il.Dimensions{WidthInPx:190,HeightInPx:50}),il.NewTextLayer(4,"Ergonomic Wireless Mouse","Inter",28,"#1a1a1a",il.Position{XInPx:50,YInPx:800},il.Dimensions{WidthInPx:700,HeightInPx:50}),},})