After groupdocs.convertion updation in 25.2.1 xml,xlsx file is not converted to pdf

it thorugh error like this
Unhandled exception thrown while processing 26356a6d-4d91-431e-9537-37e54f06d5d8. Original exception message: Invalid left or right margin, Left margin in inch: 0.7875, Right margin in inch: 0.7875, exception: Aspose.Cells.CellsException: Invalid left or right margin, Left margin in inch: 0.7875, Right margin in inch: 0.7875

if i set default morgin value as 0 its converted but after conversion it show only empty page ?

Hello @ananth97 ,

We sincerely apologize for the situation. In order to assist you with this issue, we need more information. Could you please provide us with the code sample you are using, a test file for conversion, and specify the version of GroupDocs.Conversion you are working with?

native files.zip (335.1 KB)

i used groupdocs.conversion 25.2.1,

public async Task ConvertAsync(Document document)
{
_logger.LogInformation($“{nameof(ConvertAsync)} started for document {{DocumentName}}.”, document.Name);

    TargetConversion? conversion = document.GetConversionToPdf();
    MagickFormatInfo? imageFormat = document.GetImageFormat();
    (int? Width, int? Height) size = document.GetImageSize();

    ImageResizer resizer = new ImageResizerBuilder()
        .WithConversion(conversion)
        .WithDocument(document)
        .WithImageFormatInfo(imageFormat)
        .WithImageSize(size.Width, size.Height)
        .Build();

    if ((conversion == null) && (imageFormat == null))
    {
        throw new IncompatibleForPdfConversionException(document.Name);
    }

    PdfConvertOptions? pdfConvertOptions = null;

    AdjustedDocument? adjustedDocument = await resizer.GetAdjustedDocument();

    pdfConvertOptions = adjustedDocument.GetPdfConvertOptions();

    adjustedDocument.Content.Seek(0, SeekOrigin.Begin);

    using var outputPdfStream = new MemoryStream();
    using var converter = new Converter(() => adjustedDocument.Content);

    _logger.LogInformation($"Conversion for document {{DocumentName}} started.", document.Name);

    converter.Convert(() => outputPdfStream, pdfConvertOptions);

    _logger.LogInformation($"Conversion for document {{DocumentName}} finished.", document.Name);

    var outputStream = new MemoryStream(outputPdfStream.ToArray());

    outputStream.Seek(0, SeekOrigin.Begin);

    _logger.LogInformation($"{nameof(ConvertAsync)} finished for document {{DocumentName}}.", document.Name);

    return outputStream;
}

public static class DocumentConverterExtensions
{
public static PdfConvertOptions? GetPdfConvertOptions(this Document document)
{
TargetConversion? conversion = GetConversionToPdf(document);

    var conversionConvertOptions = conversion?.ConvertOptions as PdfConvertOptions;

    if ((conversionConvertOptions != null) && document is AdjustedDocument adjustedDocument)
    {
        conversionConvertOptions.Dpi = 300;
        conversionConvertOptions.PageWidth = adjustedDocument.Width ?? conversionConvertOptions.PageWidth;
        conversionConvertOptions.PageHeight = adjustedDocument.Height ?? conversionConvertOptions.PageHeight;
    }

    return conversionConvertOptions;
}

public static TargetConversion? GetConversionToPdf(this Document document)
{
    PossibleConversions? conversions = GroupDocs.Conversion.Converter.GetPossibleConversions(document.Extension);

    return conversions[FileType.FromExtension(Constants.PdfExtension)];
}

public static MagickFormatInfo? GetImageFormat(this Document document)
{
    return MagickNET.SupportedFormats
        .FirstOrDefault(x =>
            x.IsReadable && ("." + x.Format).Equals(document.Extension, StringComparison.OrdinalIgnoreCase));
}

public static (int? Width, int? Height) GetImageSize(this Document document)
{
    try
    {
        // should handle sgi files
        (int? Width, int? Height) rgbDimensions = GetRgbDimensions(document);

        // if not sgi try to use MagickImageInfo
        if (rgbDimensions.Height is null && rgbDimensions.Width is null)
        {
            var magickImageInfo = new MagickImageInfo(document.Content);
            return (magickImageInfo.Width, magickImageInfo.Height);
        }

        return (rgbDimensions.Width, rgbDimensions.Height);
        
    }
    catch (MagickException e)
    {
        // size cannot be detected
        return (null, null);
    }
}

/// <summary>
///     MagickImage requires width and height to open MagickFormat.Rgb images.
///     The method reads ResizedWidth and ResizedHeight for Sgi/Rgb files from its header.
///     https://en.wikipedia.org/wiki/Silicon_Graphics_Image
///     Field number	Hex offset	Length	Field name	Description
///     1	0x00	2 byte      File signature/magic number For show document is SGI document. Should equal 0x01 0xda for SGI
///     document.
///     2	0x02	1 byte      Compression	        0 = uncompressed, 1 = RLE compressed
///     3	0x03	1 byte      Bytes per pixel	    1 = 8 bit, 2 = 16 bit
///     4	0x04	2 bytes     Dimension           Image dimension, equal 3 for RGBA image
///     5	0x06	2 bytes     X size              Image width
///     6	0x08	2 bytes     Y size              Image height
///     7	0x0A	2 bytes     Number of channels  Number channel in image, equal 4 for RGBA image
///     8	0x0C	4 bytes     Minimum pixel value Smallest pixel value in image
///     9	0x10	4 bytes     Maximum pixel value Largest pixel value in image
///     10	0x14	4 bytes     Reserved            No use, ignore
///     11	0x18	80 bytes    Image name          C string name have last byte equal 0x00
///     12	0x68	4 bytes     Color map ID        Only for color map image
///     13	0x6C	404 bytes   Dummy               For make head 512 bytes long. Ignore
/// </summary>
/// <param name="stream">File stream to read.</param>
/// <returns>Returns ResizedWidth and ResizedHeight as a tuple. Returns (null, null) for non sgi files.</returns>
private static (int? Width, int? Height) GetRgbDimensions(Document document)
{
    if (document.Content.Length < 10)
    {
        return (null, null);
    }

    var buffer = new byte[10];
    document.Content.Read(buffer, 0, 10);
    document.Content.Position = 0;

    bool isSgi = (buffer[0] == 0x01) && (buffer[1] == 0xda);

    return (
        isSgi ? buffer[6] * 256 + buffer[7] : null,
        isSgi ? buffer[8] * 256 + buffer[9] : null);
}

}

this is my code used for all type of files docx and ppt file is convert successfully but excel files have a issue
input.docx (108.7 KB)

@ananth97 .

Thank you for providing the information. We have registered this issue in our system under the number CONVERSIONNET-7566. We will get back to you with the results after further investigation.

@ananth97 ,

After reviewing your usage example, we are not entirely sure what page dimensions you are trying to set for PageWidth and PageHeight. Do you have specific requirements for page size, margins, etc., or are the default values sufficient for you? You could simply use PageSize = PageSize.A4, for example, if that works for you.

We noticed that you are calculating page dimensions before conversion, and it’s possible that the values passed to PageWidth and PageHeight are too small. This issue occurs when setting dimensions to 150px or less. If this is required by your use case, please clarify your requirements.

We look forward to your response.