Using Aspose.HTML-Cloud for .NET version 25.10.1, calling the ConvertApi.ConvertAsync method to convert an SVG file to PNG format.
Given the following SVG snippet:
<svg width="793" height="174" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" overflow="hidden">
...
</svg>
The converter produces a PNG file with the dimensions 2480x3508, with empty space at the bottom. The expected behaviour is that the PNG file should have the dimensions 2478x543 (i.e. the equivalent of the original dimensions 793x174 at 300dpi), and there should be no additional empty space.
@contactslaw
Summary
The current draft answer claims that Aspose.HTML Cloud treats an SVG conversion as a document and defaults to an A4‑sized page at 300 dpi, which would explain the unexpected 2480 × 3508 px PNG. However, the evidence supplied contains only documentation for GroupDocs.Annotation Cloud and unrelated Aspose attachment examples; it does not provide any information about Aspose.HTML Cloud’s conversion defaults, page size handling, or supported conversion options. Therefore the explanation and suggested fixes are not directly supported by the available evidence.
Why it happens (based on available evidence)
- The retrieved sources do not mention Aspose.HTML Cloud, its ConvertApi, or how it determines output dimensions for SVG‑to‑PNG conversion. Consequently we cannot confirm that a default A4 page size or missing
viewBox handling is the cause of the extra blank space.
What to do next
- Consult the official Aspose.HTML Cloud documentation – look for sections on image conversion, DPI settings, and SVG rendering options. The documentation should specify whether the service defaults to a page size when no explicit dimensions are provided.
- Explicitly set conversion options – if the API supports parameters such as
Width, Height, Dpi, or a PreserveAspectRatio flag, provide values that match the SVG’s intrinsic size (e.g., width ≈ 2478 px, height ≈ 543 px at 300 dpi).
- Add a
viewBox to the SVG – many renderers use viewBox to calculate scaling when width/height attributes are present. Defining viewBox="0 0 793 174" (or the pixel‑scaled values) can help ensure correct aspect‑ratio preservation.
- Test with a minimal request – send a simple conversion request (e.g., via cURL or Postman) with the explicit options and verify the output dimensions.
- If the issue persists, gather diagnostic information – capture the full request payload, response headers, and any warning messages returned by the API, then contact Aspose support with these details.
Until the Aspose.HTML Cloud documentation is reviewed, the exact cause of the extra blank space remains uncertain, and the steps above provide a systematic way to troubleshoot the problem.
SDK version unclear — refer to the official release notes before applying this guidance.