Unable to convert PageOrientation for the documents

We are unable to convert the document from landscape to Portrait. We have using PdfConvertOptions for the same but unable see any difference.

1 Like

@arpitrai123

Please share following details and we’ll look into this matter:

  • Conversion API version
  • Conversion code that you are using
  • Source file and the output file that you are getting as a result

var licenseInfo = _configuration.GetValue(“GroupDocLic:license”).Replace(@"", string.Empty);
var root = Directory.GetCurrentDirectory();
string dirPath = Path.Combine(root, “GroupDocsFiles”);
Directory.CreateDirectory(dirPath);
string licensePath = Path.Combine(dirPath, “GroupDocs.lic”);
System.IO.File.WriteAllText(licensePath, licenseInfo);
using (FileStream fileStream = System.IO.File.OpenRead(licensePath))
{
License license = new License();
license.SetLicense(fileStream);
}
#endregion

string content = fileContent.key;
char separator = ‘,’;
int index = content.IndexOf(separator);
string result = index >= 0 ? content.Substring(index + 1) : content;
byte[] bytes = Convert.FromBase64String(result);

using (Converter converter = new Converter(() => new MemoryStream(bytes)))
{
var options = new PdfConvertOptions()
{

    PageOrientation = PageOrientation.Landscape
   
 };
 MemoryStream pdfStream = new MemoryStream();
 Func<Stream> func = () => pdfStream;

 converter.Convert(func, options);
 byte[] pdfBytes = pdfStream.ToArray();
 string pdfBase64String = Convert.ToBase64String(pdfBytes);

 return
     Ok(new MyResponse() { Sucess = true, PdfBase64String = pdfBase64String });

}

image.png (25.2 KB)

1 Like

The Result is :
image.png (56.1 KB)

image.png (3.6 KB)

API Version 24.3.0

1 Like

@arpitrai123
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): CONVERSIONNET-6818

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

@arpitrai123

Below is the temporary solution until we introduce a permanent fix in the API:

// Specify the source file name
const string source = "sample.xlsx";

// Create a Converter object and specify the source file and options
using (var converter = new Converter(source, () => new SpreadsheetLoadOptions
{
    // Configure the SpreadsheetLoadOptions
    // Load all columns in a single page per sheet
    AllColumnsInOnePagePerSheet = true
}))
{
    // Create PdfConvertOptions
    var options = new PdfConvertOptions();

    // Convert the source file to PDF
    converter.Convert("converted.pdf", options);
}

The issues you have found earlier (filed as CONVERSIONNET-6818) have been fixed in this update. This message was posted using Bugs notification tool by nikola.yankov