Image is getting shrink automatically in single page

hello,

We have one image with dimension 2048x12473 we are trying to include that image in our PDF using below code but some how it gets fitted in single page(content is not readable from image) but we want it in multiple pages for a better quality(so user can read content). One more thing we need to keep the alternative text as it is for the Accessibility purpose.

Aspose.Pdf.Document doc = new Aspose.Pdf.Document();
ITaggedContent taggedContent = doc.TaggedContent;
StructureElement rootElement = taggedContent.RootElement;
string imgFile = “wwwroot//img//forrester-long-image.jpg”;
FigureElement figure5 = taggedContent.CreateFigureElement();
figure5.SetImage(imgFile);
figure5.AlternativeText = “image alternative text”;
rootElement.AppendChild(figure5);
doc.Save(“wwwroot//PDFs//test.pdf” , SaveFormat.Pdf);

Can you please check and let us know it is possible or not? with any approach.

Thanks & Regards

@siriussynoptek

Could you please share the sample image for our reference as well. We will test the scenario in our environment and address it accordingly.

Hello,

I’m attaching an image.Long Image.jpg (1.1 MB)

Thanks & Regards

@siriussynoptek

We tried adding the image using below code snippet but, the result was not good. The page height was a lot more than image:

Aspose.Pdf.Document doc = new Aspose.Pdf.Document();
System.Drawing.Image img = new Bitmap(dataDir + "Long Image.jpg");
doc.PageInfo.Margin = new MarginInfo(0, 0, 0, 0);
doc.PageInfo.Height = img.Height;
doc.PageInfo.Width = img.Width;
ITaggedContent taggedContent = doc.TaggedContent;
StructureElement rootElement = taggedContent.RootElement;
string imgFile = dataDir + "Long Image.jpg";
FigureElement figure5 = taggedContent.CreateFigureElement();
figure5.SetImage(imgFile);
figure5.AlternativeText = "image alternative text";
rootElement.AppendChild(figure5);
doc.Save(dataDir + "test.pdf" , SaveFormat.Pdf);

We have logged an investigation ticket as PDFNET-49574 in our issue tracking system for this case i.e. set page dimensions according to source image. We will further look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.

Hello,

We want to keep the page size as it is, and we want to divide the long image in multiple pages. That’s what we are focusing on. Please do let us know it’s possible or not.

Thanks & Regards

@siriussynoptek

We are afraid that splitting the image to multiple pages would not be possible using Aspose.PDF for .NET. We will however investigate that how page dimensions can be according to image while creating tagged content and share our feedback with you once the ticket is resolved.

We apologize for the inconvenience.