Image not being resized in new pdf

Hi all.

I am trying to create a new pdf with embedded images. As the images are too big I have tried to size them down but any size changes I make seems to have no effect. Below is the function I am using to resize the image.

Private Sub ScaleImage(ByRef pdfimg As Aspose.Pdf.Image)

If pdfimg.ImageWidth > 200 Then
Dim ImgMultiplier As Double = 0
ImgMultiplier = (pdfimg.ImageWidth / 200)
pdfimg.ImageWidth = 200
pdfimg.ImageHeight = (pdfimg.ImageHeight / ImgMultiplier)
End If

End Sub


Any help would be much appreciated.

Hi,


Thanks for contacting support.

I have tested the scenario using Aspose.Pdf for .NET 9.1.0 while using the following code snippet and I am unable to notice any problem. As per my observations, the width and height information is properly being applied to image file. Can you please try using the latest release and in case you still encounter the same issue, please share the source Image file so that we can test the scenario at our end. We are sorry for this inconvenience.

[VB.NET]

Dim
doc As Document
= New Aspose.Pdf.Document()<o:p></o:p>

doc.Pages.Add()

Dim image As Aspose.Pdf.Image = New Aspose.Pdf.Image()

image.File = "c:/pdftest/PdfStampingWebApi.png"

image.FixHeight = 150

image.FixWidth = 150

doc.Pages(1).Paragraphs.Add(image)

doc.Save(“c:/pdftest/DocumentWithImage.pdf”)