Control of image top margin

The snip of vb.net generating the image(s) are pretty simple:

'work with images
Dim image2 As Aspose.Pdf.Image = New Aspose.Pdf.Image(sec2)
sec2.Paragraphs.Add(image2)
If File.Exists(myFilePath & Me.UserId & "\" & dr("CategoryID").ToString & ".jpg") Then
picName = myFilePath & Me.UserId & "\" & dr("CategoryID").ToString & ".jpg"
image2.ImageInfo.File = picName
image2.ImageInfo.ImageFileType = ImageFileType.Jpeg
sec2.Paragraphs.Add(image2)
sec2.Paragraphs.Add(New Text(""))
End If

The problem is that the images have a top margin of around 2 inches. I've tried various types of settings to no effect.

Could somebody help me out on this?

Aren't the aspose forums supposed to be the preferred way of getting support? It's eerily quiet in here...

Hello Erixc,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

I'm extremely sorry for replying you so late.

You can set the Image top margin using image2.Margin.Top property. But I'm in recent version 4.1.0.0 it’s not working correctly. I have logged it in our issue tracking system as PDFNET-10805. We will investigate this issue in detail and will keep you updated on the status of a correction.

Please accept our modest apologies for the inconvenience that you have been facing in this regard.

PS, We check and provide support to our customers through forums on regular basis, but I'm afraid how I missed this issue. Once again I regret over this nuisance.

Thank you.

I wonder if there is a way for customers to track the issues as they make their way into a patch release?

Hello Erixc,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for considering Aspose.

I'm afraid you might not be able to have an access to our issue tracking system. Whereas concerning to your query, as soon as we've made progress regarding the resolution of reported issue, we'll update you with the status of correction with in this forum thread, and you will be automatically informed via an email through our notification system.

In case of any further query, please feel free to contact.

Hi,

Can you please try using the Image.Margin.Top property and specify the top margin value to accomplish your requirement.

Please try using the following code snippet and see if it works for you or not. During my test, I've been able to generate the output correctly. For your reference, the same output file is in attachment.

[VB.NET]

Dim pdf As Pdf = New Pdf()
Dim sec2 As Aspose.Pdf.Section = pdf.Sections.Add()

'work with images
Dim image2 As Aspose.Pdf.Image = New Aspose.Pdf.Image(sec2)
Dim picName As String = "d:/pdftest/Capture.PNG"
image2.ImageInfo.File = picName
image2.ImageInfo.ImageFileType = ImageFileType.Png\
image2.Margin.Top = -40
sec2.Paragraphs.Add(image2)
sec2.Paragraphs.Add(New Text(""))
'End If

pdf.Save("d:/pdftest/imagemarginissue.pdf")

Knowing it works got me back into the code where I noticed the problem - what I thought was an uncontrollable margin was actually "white space" created by the insertion of an empty image into the paragraph.

The following code works just fine. Thanks for hanging in there with the issue Aspose!

'work with images
Dim image2 As Aspose.Pdf.Image = New Aspose.Pdf.Image(sec2)
If File.Exists(myFilePath & Me.UserId & "\" & dr("CategoryID").ToString & ".jpg") Then
picName = myFilePath & Me.UserId & "\" & dr("CategoryID").ToString & ".jpg"
image2.ImageInfo.File = picName
image2.ImageInfo.ImageFileType = ImageFileType.Jpeg
image2.Margin.Top = 0
sec2.Paragraphs.Add(image2)
sec2.Paragraphs.Add(New Text(""))
End If

The issues you have found earlier (filed as 10805) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.