Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Fri Jun 09, 2023 12:05 pm

Hi

I am using .net core -5 app and free spire pdf(8.6.0) and deployed on azure

When i am trying to convert Html to pdf using qt pluging (32-bit) there is no exception given but on the destination path .pdf file is not generated where as its work fine on locally

so i got file not found exception while load file on azure because of html to pdf conversion not genrating pdf file

Is there any special configuration required for qt plugin and spire pdf for azure?

Here is my code

var renderSignaturePageView = await _viewRenderService.RenderToStringAsync("Shared/Signature.cshtml", signatureRequest.SignatureRecipients);

HtmlConverter.Convert(renderSignaturePageView, signatureFileFullPath, true, 30000, new Size(816, 1056), margin, LoadHtmlType.SourceCode);

after execution above code there is no exception is give but file also not generated

Here my file is not generated on signatureFileFullPath ("/wwwroot/SignatureRequestDocuments/0ebc3271-74b6-49da-aaf2-0a943828bccb/generatedfile.pdf")

jenishItact
 
Posts: 18
Joined: Tue Mar 21, 2023 5:34 am

Mon Jun 12, 2023 5:13 am

Is there any update on above issue?

jenishItact
 
Posts: 18
Joined: Tue Mar 21, 2023 5:34 am

Mon Jun 12, 2023 7:34 am

Hello,

Sorry for the late reply due to the weekend.
Yes, I did reproduce the issue you mentioned and I have logged the issue into our tracking system with the ticket SPIREPDF-6053. Our development team will investigate and fix it. Once it is resolved, I will inform you in time. Sorry for the inconvenience caused.

Best Regards,
Swain
E-iceblue support team
User avatar

Swain.Wang
 
Posts: 34
Joined: Thu Jun 01, 2023 3:55 am

Mon Jun 12, 2023 11:56 am

Hi,

Thanks for your reply

Can you tell us approx how much time it will take to get solution for ticket SPIREPDF-6053? because we need to tell us our client for that

Thanks

jenishItact
 
Posts: 18
Joined: Tue Mar 21, 2023 5:34 am

Tue Jun 13, 2023 6:55 am

Hello,

Thank you for your response.
We have tested your issue using another version of the QT plugin and found that it can successfully convert HTML to PDF. Please download the new plugin from the following link. Additionally, during testing, please ensure that both the input file and plugin are placed in the correct file path in Azure. When we were testing, we uploaded them to the "/site/wwwroot" directory, here we have attached our testing code for your reference.
QT plugin: https://www.e-iceblue.com/downloads/att ... lugins.zip
Testing code:
Code: Select all
            string htmlString = System.IO.File.ReadAllText(@"sample.html");
            string fileName = "HtmltoPdf.pdf";
            string pluginPath = "plugins";
            Spire.Pdf.HtmlConverter.Qt.HtmlConverter.PluginPath = pluginPath;
            Spire.Pdf.HtmlConverter.Qt.HtmlConverter.Convert(htmlString, fileName, true, 100000, new Size(1080, 1000), new PdfMargins(0), Spire.Pdf.HtmlConverter.LoadHtmlType.SourceCode);

Best Regards,
Swain
E-iceblue support team
User avatar

Swain.Wang
 
Posts: 34
Joined: Thu Jun 01, 2023 3:55 am

Tue Jun 13, 2023 11:23 am

Hi ,
Thanks for your response

I have tried your plugin also with path you describe but no luck

below is my code

var signatureFileFullPath = Path.Combine(_appFolders.SignatureRequestFolder, q.ToString(), signaturePage);
//wwwroot\wwwroot\SignatureRequestDocuments\cb14acf9-b9b3-4c96-b137-8624ce511071\sample.pdf (signatureFileFullPath azure )

HtmlConverter.PluginPath = _appFolders.SpirePlugin; //wwwroot\wwwroot\SpirePDF\plugins (plugin path on azure)
PdfMargins margin = new PdfMargins();
margin.Top = 60;
margin.Bottom = 90;
var renderSignaturePageView = "";
try
{
SignaturePageViewModel spViewModel = new SignaturePageViewModel();
spViewModel.SignatureRecipients = signatureRequest.SignatureRecipients;


renderSignaturePageView = await _viewRenderService.RenderToStringAsync("Shared/Signature.cshtml", spViewModel);
}
catch (Exception ex)
{
throw new UserFriendlyException("Render string error: " + ex.Message);
}

try
{
HtmlConverter.Convert(renderSignaturePageView, signatureFileFullPath, true, 30000, new Size(816, 1056), margin, LoadHtmlType.SourceCode);
Logger.Debug("SignaturePage Created Successfully");
}
catch (Exception ex)
{
throw new UserFriendlyException("Html to pdf conversion fail " + ex.Message);
}

PdfDocument signedPage = new PdfDocument();
try
{
signedPage.LoadFromFile(signatureFileFullPath, FileFormat.PDF);
Logger.Debug("SignaturePage Fetch Successfully");
}
catch (Exception ex)
{
throw new UserFriendlyException("Signature Page Path " + ex.Message + " Path :" + signatureFileFullPath);
}

But i got error file not found while execute method LoadFromFile() and also i checked folder where file is not generated htmltopdf in signatureFileFullPath

Also i have attached some images

jenishItact
 
Posts: 18
Joined: Tue Mar 21, 2023 5:34 am

Wed Jun 14, 2023 10:17 am

Hello,

Thanks for your feedback.
We suspect that the reason for your issue is incorrect configuration of file paths. I have uploaded my complete project for your reference, and you can download it from the link below and publish it to Azure for testing. If everything goes well, you will find the generated pdf files in the 'wwwroot/pdfresult' directory. We look forward to your further feedback.
https://www.e-iceblue.com/downloads/attachment/33625demo.zip

Sincerely,
Swain
E-iceblue support team
User avatar

Swain.Wang
 
Posts: 34
Joined: Thu Jun 01, 2023 3:55 am

Thu Jun 15, 2023 6:36 am

Hi,

I have tried with project you sent and publish it on azure but still no luck

I have attach images of all my tracking also put exception handling in code

so i found that there is no error given while convert html to pdf code line but also it is not generating pdf file in given path

Please take a look and suggest me what i am missing

jenishItact
 
Posts: 18
Joined: Tue Mar 21, 2023 5:34 am

Thu Jun 15, 2023 9:56 am

Hello,

Thanks for your reply.
On my side, after the project is published to Azure, PDF files can be generated normally. I have uploaded a guidance document to the attachment. Please follow the steps in the document to republish the project and test it. Looking forward to your feedback.

Sincerely,
Swain
E-iceblue support team
User avatar

Swain.Wang
 
Posts: 34
Joined: Thu Jun 01, 2023 3:55 am

Thu Jun 15, 2023 1:24 pm

Hi,

As you describe i have azure published your project but still its not convert html to pdf and generate file in folder

Look attachmnets

I am using FreeSpire.pdf(8.6.0) and also tried with this but not working

Not sure what is excat issue?

Please try with make empty /pdfresult folder and check

jenishItact
 
Posts: 18
Joined: Tue Mar 21, 2023 5:34 am

Fri Jun 16, 2023 9:27 am

Hello,

Thanks for your reply.
We suspect that this issue may be related to the Azure region. We are using Azure in China. Could you please tell us if you have made any changes to the code or input file I provided? If not, please provide us with the configuration items for this project in Azure (as shown in the attached screenshot) for further investigation. Thank you in advance.

Sincerely,
Swain
E-iceblue support team
User avatar

Swain.Wang
 
Posts: 34
Joined: Thu Jun 01, 2023 3:55 am

Fri Jun 16, 2023 1:11 pm

Hi,

I have attched my azure configuration screens

I just put try catch block in code as defined in image Code Changes Try catch block and make empty pdfresult folder.png

and made empty pdfresult folder

it works locally but not on azure

jenishItact
 
Posts: 18
Joined: Tue Mar 21, 2023 5:34 am

Mon Jun 19, 2023 8:10 am

Hello,

Sorry for the late reply due to the weekend.
Regarding your issue, as mentioned before, on our side, the project I provided can works both locally and on Azure. So we suspect that this issue may be related to the Azure region. We have checked the Azure configuration details provided by you but did not find any issues. We have also contacted Azure technical support in the China region, but unfortunately, we have not received any useful information. For your situation, we recommend that you also contact Azure technical support in your region to confirm if there are any other solutions available to resolve your issue. We apologize for any inconvenience caused. In addition, we will further investigate the cause of this issue. Once there is any progress, I will inform you in time.

Sincerely,
Swain
E-iceblue support team
User avatar

Swain.Wang
 
Posts: 34
Joined: Thu Jun 01, 2023 3:55 am

Return to Spire.PDF

cron