Good day
I recently upgraded to the latest PDF v.19.x from my existing v.17.x and have noted a huge delay when converting from TIF to PDF. The same code is used between both versions, however when using v.19.x it can take 5 min to add three pages and 1 second when using v.17.x?? It seems to hang on “doc.Save(dstFile)”
' Instantiate Document Object
Dim doc As Aspose.Pdf.Document = New Aspose.Pdf.Document()
Dim mystream As IO.MemoryStream
For Each f As String In fileNames
Dim page As Aspose.Pdf.Page = doc.Pages.Add()
' Load the source image file to Stream object
Using fs As New IO.FileStream(f, IO.FileMode.Open, IO.FileAccess.Read)
Dim tmpBytes(fs.Length) As Byte
fs.Read(tmpBytes, 0, Convert.ToInt32(fs.Length))
mystream = New IO.MemoryStream(tmpBytes)
' Instantiate BitMap object with loaded image stream
Using 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)
page.SetPageSize(b.Width, b.Height)
' Create an image object
Dim image1 As Aspose.Pdf.Image = New Aspose.Pdf.Image()
If IO.Path.GetExtension(f).ToLower = ".tif" Then
image1.IsBlackWhite = True
End If
' Add the image into paragraphs collection of the section
page.Paragraphs.Add(image1)
' Set the image file stream
image1.ImageStream = mystream
End Using
End Using
Next
dstFile = dstFile.Replace("\\", "\")
doc.Save(dstFile)
' Close memoryStream object
mystream.Dispose()