none
Cloud Converter api issue from word to pdf of bytes RRS feed

  • Question

  • Hi,

    I am using the cloudConverter api to convert the word to pdf file.

    But there is one issue in conversion that index number have repeated value.

    Means it should be 3 not 33 and 4 not 44.

    Monday, June 17, 2019 6:03 PM

All replies

  • Hi Chandra,

    Thank you for posting here.

    Based on your description, you want to solve the issue that index number have repeated value.

    I could not reproduce your problem, it works well.

    I used the following code from this link.

                string fullpath = @"D:\test.docx";
    
                //Loads an existing Word document
                WordDocument wordDocument = new WordDocument(fullpath, FormatType.Docx);
    
                //Creates an instance of the DocToPDFConverter
                DocToPDFConverter converter = new DocToPDFConverter();
    
                //Converts Word document into PDF document
                PdfDocument pdfDocument = converter.ConvertToPDF(wordDocument);
    
                //Releases all resources used by DocToPDFConverter
                converter.Dispose();
    
                //Closes the instance of document objects
                wordDocument.Close();
    
                //Saves the PDF file 
                pdfDocument.Save(@"D:\DocToPDF.pdf");
    
                //Closes the instance of document objects
                pdfDocument.Close(true);

    Result:

    Note:This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    Best Regards,

    Jack


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, June 18, 2019 2:53 AM
    Moderator
  • Hi Jack,

    Thanks for response.

    But I am using the following api to convert the word to pdf taking the response value from api then converting into bytes and the saving to azure blob.

    Actually right now I am unable to share the issue image.

    https://api.cloudconvert.com/process

    using following code

    public async Task<ConvertResponse> ConvertAsync(ConvertRequest request, string convertUrl)
            {
                if (request == null)
                {
                    throw new ArgumentNullException("request");
                }
    
                if (String.IsNullOrWhiteSpace(convertUrl))
                {
                    throw new ArgumentNullException("convertUrl");
                }
    
                var serialised = this.Serialise(request);
                ConvertResponse retValue = new ConvertResponse();
    
                using (var client = new HttpClient())
                using (var content = new StringContent(serialised, Encoding.UTF8, "application/json"))
                using (var response = await client.PostAsync(convertUrl, content).ConfigureAwait(false))
                {
                    var result = await response.Content.ReadAsStreamAsync().ConfigureAwait(false);
    
                    retValue.Code = (int)response.StatusCode;
                    if (response.StatusCode != HttpStatusCode.OK)
                    {
                        retValue.Error = response.ToString();;
                    }
    
                    using (var memoryStream = new MemoryStream())
                    {
                        result.CopyTo(memoryStream);
                        retValue.ResponseString = Convert.ToBase64String(memoryStream.ToArray());
                    }
                }
                return retValue;
            }
    Regards,

    Chandra

    Tuesday, June 18, 2019 6:34 AM
  • Hi Chandra,

    Thanks for the feedback.

    >>But I am using the following api to convert the word to pdf taking the response value from api then converting into bytes and the saving to azure blob.

    If you want to save it to azure blob, I suggest that you could post in the following forum.

    https://social.msdn.microsoft.com/Forums/azure/en-US/home?forum=windowsazuredata

    The Visual C# forum discusses and asks questions about the C# programming language, IDE, libraries, samples, and tools.

    Best Regards,

    Jack


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, June 18, 2019 6:41 AM
    Moderator
  • CloudConverter? Is this a third party API. If so then you'll need to post in their forums. This specific forum is for C#-specific questions only. The MSDN forums is for MS products only.

    Michael Taylor http://www.michaeltaylorp3.net

    Tuesday, June 18, 2019 1:45 PM
    Moderator