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

Free Support Forum - aspose.com

I don't want reduce length and height of the image when convert to pdf format

Hi

I am try to convert images to pdf format,like ccitt,gif,jpeg,jpg,png,tif,tiff,bmp,emf,exif,icon,wmf to pdf
and i use following code get form http://www.aspose.com/docs/display/pdfnet/Convert+an+Image+to+PDF

’ instantiate Document Object
Dim doc As Document = New Document()
’ add a page to pages collection of document
Dim page As Page = doc.Pages.Add()
’ load the source image file to Stream object
Dim fs As FileStream = New FileStream(“c:/pdftest/1.tiff”, FileMode.Open,
 FileAccess.Read)
Dim tmpBytes(fs.Length) As Byte
fs.Read(tmpBytes, 0, Convert.ToInt32(fs.Length))

Dim mystream As MemoryStream = New MemoryStream(tmpBytes)
’ instantiate BitMap object with loaded image stream
Dim b As Bitmap = New Bitmap(mystream)

’ Set margins so image will fit, etc.
page.PageInfo.Margin.Bottom = 0
page.PageInfo.Margin.Top = 0
page.PageInfo.Margin.Left = 0
page.PageInfo.Margin.Right = 0

page.CropBox = New Aspose.Pdf.Rectangle(0, 0, b.Width, b.Height)
'Create an image object
Dim image1 As Aspose.Pdf.Image = New Aspose.Pdf.Image()
'Add the image into paragraphs collection of the section
page.Paragraphs.Add(image1)
’ set the image file stream
image1.ImageStream = mystream
’ save resultant PDF file
doc.Save(“c:/pdftest/1.pdf”)

'close memoryStream object
mystream.Close()


Here i attach tiff file and output file also,pls check the output files.i don’t want
crop the files,if i remove margin and crop lines ,still it reduce the length of image 
in pdf.






Hi Aravind,


Thanks for your inquiry. Please use Height and Width property of PageInfo method for setting page dimensions as following. It will help you accomplish the task.

page.PageInfo.Height = b.Height<o:p></o:p>

page.PageInfo.Width = b.Width

'page.CropBox = new Aspose.Pdf.Rectangle(0, 0, b.Width, b.Height)



Please feel free to contact us for any further assistance.


Best Regards,