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

Free Support Forum - aspose.com

New version (15.5) incompatible with previous version (15.3)

Hi,


I’m currently running 15.3 in my environment
I wanted imported 15.5 and started to run my code tests which show incompatibility with version 15.3
I was using Aspose.Words to convert an image to PDF
The same code now produces the PDF with the image at less then 25% of the original size


Hi Dvir,

Can you please share your code and input document to reproduce the issue?

Best Regards,

var doc = new Document();

// Aspose License validation - no validation in Aspose.Words!

LicenseManager.GetAsposeWordLicense();

var builder = new DocumentBuilder(doc);

// Read the image from stream

using (var image = Image.FromStream(fileData.FileData))

{

// Find which dimension the frames in this image represent. For example

// the frames of a BMP or TIFF are "page dimension" whereas frames of a GIF image are "time dimension".

var dimension = new FrameDimension(image.FrameDimensionsList[0]);

// Get the number of frames in the image.

var framesCount = image.GetFrameCount(dimension);

// Loop through all frames.

for (var frameIdx = 0; frameIdx < framesCount; frameIdx++)

{

// Insert a section break before each new page, in case of a multi-frame TIFF.

if (frameIdx != 0)

builder.InsertBreak(BreakType.SectionBreakNewPage);

// Select active frame.

image.SelectActiveFrame(dimension, frameIdx);

// We want the size of the page to be the same as the size of the image.

// Convert pixels to points to size the page to the actual image size.

var ps = builder.PageSetup;

ps.PageWidth = ConvertUtil.PixelToPoint(image.Width, image.HorizontalResolution);

ps.PageHeight = ConvertUtil.PixelToPoint(image.Height, image.VerticalResolution);

// Insert the image into the document and position it at the top left corner of the page.

builder.InsertImage(

image,

RelativeHorizontalPosition.Page,

0,

RelativeVerticalPosition.Page,

0,

ps.PageWidth,

ps.PageHeight,

WrapType.None);

}

// Save the document to PDF.

var outputStream = new MemoryStream();

doc.Save(outputStream, SaveFormat.Pdf);

Hi Dvir,

I was able to see the difference in size between 15.3 and 15.5 but it is not that much as you mentioned. Can you please also attach the image you used to confirm we are on the same page?

Best Regards,

I can’t take out documents

but I notice a very significat reduction

Hi Dvir,

This issue has been logged into our issue tracking system as WORDSNET-12036. We will keep you updated on this issue in this thread.

Best Regards,

any progress with the issue?

Hi Dvir,

Thanks for your inquiry. Unfortunately, this issue is not resolved yet. Currently, it is pending for analysis and is in the queue. We will inform you via this thread as soon as it is resolved. Sorry for the inconvenience.

Best regards,

Hi,


still waitting for the fix

Hi Dvir,

This issue has been resolved as not a bug because 15.5.0 and later versions produce the correct output which is exactly the same as MS Word does.

You can update page setup related code like the following to get the same output with 15.5.0 and later versions as you were getting with 15.3.0.

var ps = builder.PageSetup;

ps.PageWidth = ConvertUtil.PixelToPoint(image.Width, image.HorizontalResolution);

ps.PageHeight = ConvertUtil.PixelToPoint(image.Height, image.VerticalResolution);

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

// We hava to set margins to zero.

ps.LeftMargin = 0;

ps.RightMargin = 0;

ps.TopMargin = 0;

ps.BottomMargin = 0;

Best Regards,