HTML to PDF Conversion Issue after Binding FTP Storage

Helllo Everyone.
I have binded ftp storage wth my account. I have facing Error code 553 while trying to convert pdf to html. Here is the error details.

An unhandled exception of type ‘Aspose.Pdf.Cloud.Sdk.Client.ApiException’ occurred in Aspose.Pdf.Cloud.Sdk.dll

Additional information: Error calling PutPdfInRequestToHtml: {“RequestId”:“cfcd1d19-2fba-403c-8927-8f4e0cced241”,“Error”:{“Code”:“errorFtpStorage”,“Message”:“Ftp Storage exception: Status: ProtocolError Message: The remote server returned an error: (553) File name not allowed.”,“Description”:“Operation Failed. Ftp Storage Error.”,“DateTime”:“2023-05-08T10:40:55.974747Z”,“InnerError”:null}}

@adnanofpk

Please ensure that you have configured FTP storage correctly with aspose.cloud, as suggested in the following documentation. And can access your storage in aspose.cloud dashboard. Otherwise, please share your sample code along with your credentials for the investigation.

Ftp is connecting in filezilla client. I also verify it by clicking verify button in the storage and it told me that ftp is valid. here is my ftp configuration.

image.png (32.8 KB)

panel.freehosting.com
aopdffiles@advertoptimizerpdffiles.com
2Password33

Here is my sample code of conversion.

 public class CloudHelper {
   public string ClientId {
     get {
       return ConfigurationManager.AppSettings["AsposeClientId"];
     }
   }
   public string ClientSecret {
     get {
       return ConfigurationManager.AppSettings["AsposeCloudSecretKey"];
     }
   }

   PdfApi api = null;
   public CloudHelper() {
     api = new PdfApi(ClientSecret, ClientId);
   }

   public void PutPdfInStorageToHtml(string Inputfile) {
     //ExStart: PutPdfInStorageToDocExample
     using(Stream stream = System.IO.File.OpenRead(Path.Combine("", Inputfile))) {
       string resFileName = Code.Utility.Functions.GetBasePath() + "\\ConvertedFiles\\" + Inputfile.Replace(".pdf", ".html"); //Guid.NewGuid().ToString().Replace("-", "") + ".html";

       var response = api.PutPdfInRequestToHtml(resFileName, file: stream);
       Console.WriteLine(response);
     }
   }
 }

and this is how I am calling it…

var file = @"E:\Adnan-Projects\AdvertOptimizer\Ao.ConsoleApps.DCILicenses\exempt.pdf";
new CloudHelper().PutPdfInStorageToHtml(file);

@adnanofpk

Thanks for the additional information. We are looking into it and will guide you accordingly.

Any update regarding my issue?

@adnanofpk

Please note the PutPdfInStorageToHtml API expects input files from cloud storage. Please kindly ensure that your referenced PDF file is uploaded correctly to your cloud storage and you are passing the correct file path from cloud storage in the PutPdfInStorageToHtml API call. If the issue still persists, then please share your credentials via a private message. For private message, click on my user icon and use the message option for it.

Hello. Please guide me in case of ftp storage i.e. which method should I use when my cloud account is using ftp storage.

@adnanofpk

You need to use UploadFile to upload files to your cloud storage. If you are updating files to default storage, set in application in aspose.cloud dashboard, then you do not need to pass the storage name. Otherwise pass the storage name in the API call as well. Please check the following sample code for reference.

​PUT /pdf​/storage​/file​/{path} Upload file

String storageName = "Mystorage";

// Initialzie Aspose.PDF Cloud API
// Get Cilent ID and Client Secret from https://dashboard.aspose.cloud/
PdfApi pdfApi = new PdfApi(ClientSecret, ClientId);
// Upload source PDF file to aspose cloud storage
pdfApi.UploadFile(remoteFolder + "/" + fileName, System.IO.File.OpenRead("C:/Temp/02_pages.pdf"), storageName);

please also mention the method for converting the uploaded file to html.

Just asking because I am getting error “The operation has timed out” when I try to use the following function.

var response = api.GetPdfInStorageToHtml(“exempt.pdf”);

exempt.pdf is already uploaded to the storage.

@adnanofpk

Kindly share your input document with us. We will investigate the issue and guide you accordingly.

exempt.pdf (132.3 KB)
Input document is attached. Please review it.

@adnanofpk

Thanks for sharing your sample document. I am unable to notice any issues. Please see the sample code for reference.exempt.zip (77.6 KB)

public static async Task ConvertPDFtoHTMLStorage_PDF()
{
    // instantiate the PdfApi
    PdfApi pdfApi = new PdfApi(ClientSecret, ClientId);
    string name = "exempt.pdf";            
    string resultName = "exempt.zip";
    // Convert PDf from cloud storage to HTML
    var response =await pdfApi.PutPdfInStorageToHtmlAsync(name,resultName);
    Console.WriteLine(response);           
}

With me the same code takes too much time and at the end timeout occurs.
Here is my account ClientId and secret key.

@adnanofpk

I have tested the scenario with your shared credentials and am unable to notice the timeout issue. It might be a network issue on your end. Please try to test it on another machine/network.

// instantiate the PdfApi
PdfApi pdfApi = new PdfApi(ClientSecret, ClientId);
string name = "exempt.pdf";            
string TestDataFolder = "C:\\Users\\hp 840 g3\\Downloads";
string resultName = "exempt.zip";

// upload PDF file to cloud storage
using (var file = System.IO.File.OpenRead(Path.Combine(TestDataFolder, name)))
{
    var uploadResponse = pdfApi.UploadFileAsync(name, file);
    Console.WriteLine("uploaded...");
}
// Convert PDf from cloud storage to HTML
var response =await pdfApi.PutPdfInStorageToHtmlAsync(name,resultName);
Console.WriteLine(response);

If I convert the free account to paid account, will it remove the ip check also is there any daily limit of requests?

@adnanofpk

There is no daily limit on requests on either the free or paid plans. However, if required, you can set a daily limit in your Application from aspose.cloud dashboard.

I am afraid I did not get your point. Can you please share some details?

Actually when I try from my system, it got stunted. so don’t know what is the reason behind it. Even when i try it from demo page of aspose it is also failed from there. Regarding the network so I have 100 MB internet.

@adnanofpk

I have tested the conversion with your credentials and storage without any issue. You may try the conversion on another computer or network and share the results. You may also try the conversion using Aspose default storage and check the outcome; for this purpose, you need to pass the storage name in the API call.

A post was split to a new topic: PDF to HTML Conversion with SVG image in C#