We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

PDF is not getting generated out of HTML when published the API on AWS Lambda

Hi Team,

We are using Syncfusion HTML to PDF and "Syncfusion.HtmlToPdfConverter.Net.Windows" package in our .NET Core 6 application. The PDF is getting generated totally fine on my local machine but fails once the API is published to AWS Lambda and throws the following error:

"Blink files are missing at C:\VS2022_workspaces\cicadagreen.visualstudio.com\Redi4\Redi4_Serverless_Api\bin\Debug\net6.0\runtimes\win-x64\native"

Not sure why this is happening. Please help!!

Thanks,

Shradha Chauhan


12 Replies

SN Santhiya Narayanan Syncfusion Team April 11, 2023 10:10 AM UTC

We have a separate package named as “Syncfusion.HtmlToPdfConverter.Net.Aws” for perform HTML to PDF conversion in AWS lamda. We need to install this package to perform HTML to PDF conversion in AWS. We have attached the sample with latest Syncfusion AWS package for your reference,

Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/AWSLambdaNet61651249268

For Binaries missing exception,

 1.Copy the BlinkBinariesAWS folder in parallel to the csproj file and select the “copy if newer” in binary files copy to output directory property.

image

 

2.We need to set the Blink binaries path in Function.cs file using BlinkConverterSettings class.

blinkConverterSettings.BlinkPath =  "BlinkBinariesAWS";

 

Note: From next weekly release we do not need to set the Blink binaries path and do not need to copy the binaries folder in parallel to the project.

Please refer the below UG documentation for more information,
UG: https://help.syncfusion.com/file-formats/pdf/convert-html-to-pdf/aws

 Kindly publish the provided sample on your end and let us know the result.




SH Shradha April 13, 2023 09:39 AM UTC

Hi Team,

Thanks for your immediate response. We followed the same steps in our project but again getting error. Following is the stack trace of the error:

"Syncfusion.Pdf.PdfException: Blink files are missing at /var/task/BlinkBinariesAws at Syncfusion.HtmlConverter.BlinkConverter.Convert(String url) at Syncfusion.HtmlConverter.BlinkConverter.Convert(String htmlString, String baseurl) at Syncfusion.HtmlConverter.HtmlToPdfConverter.Convert(String html, String baseurl) at Redi4_Serverless_Api.Controllers.GetHtmlForEopsController.FnConvertHtmlToPdf(Int32 eopId, String clientName)"

We installed " Syncfusion.HtmlToPdfConverter.Net.Aws" package and copied the "BlinkBinariesAWS" folder to our project and also updated the Copy to Output Directory property of all three files inside "BlinkBinariesAWS" folder. Following attached are the images for your reference of our implementation. Please let us know what gone wrong in our implementation.

package.png

blinkFolder.png

code.png

Thanks,

Shradha Chauhan



SN Santhiya Narayanan Syncfusion Team April 14, 2023 01:12 PM UTC

We were able to reproduce the reported issue with provided details on our end. Currently, we are analysing on this and will update the further details on April 18th 2023.



SN Santhiya Narayanan Syncfusion Team April 19, 2023 09:09 AM UTC

We have included the fix for this issue “Blink binaries are missing for html converter” in our latest weekly release (21.1.41).

Please use the below link to download our latest weekly NuGet,

NuGet Link: https://www.nuget.org/packages/Syncfusion.HtmlToPdfConverter.Net.Aws/21.1.41



SH Shradha April 19, 2023 02:32 PM UTC

Hi Team,

Thank you so much Syncfusion Team for your quick response to our queries and we really appreciate your hard work.

We installed the latest version of "Syncfusion.HtmlToPdfConverter.Net.Aws" ​(21.1.41) and then published our API on AWS Lambda. Following mentioned is the error that was logged in our database-

Failed to extract the tar.br files Could not find file '/opt/dotnetcore/store/x64/net6.0/syncfusion.htmltopdfconverter.net.aws/21.1.41/lib/netstandard2.1/aws.tar.br'.

Following image shows the error that we received in our controller when put a breakpoint there.



Yellow color highlighted line is the place where error is thrown.

We have created a separate layer for the installed packages. Attached file here contains the list of all packages that we upload to AWS Lambda.

Please let us know the way to resolve this issue. It would be highly appreciable If you could create a sample similar to our case so that we could identify where we are doing wrong.

Thanks

Shradha Chauhan


Attachment: PackageLayerInstallation_62b90ca6.zip



SN Santhiya Narayanan Syncfusion Team April 20, 2023 02:27 PM UTC

We have checked the reported issue and the HTML to PDF conversion works fine with AWS lambda function in the latest version 21.1.41 on our end. We can perform the conversion in AWS lambda without setting the blink path In latest version. We have ensured the conversion in AWS lambda function with default path on our end . We have attached the sample link below for your reference,

Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/HTML_to_PDF_Lambda-1464021243

Note: We have changed the NuGet package structure for BlinkBinariesAWS to runtimes folder From v21.1.XX (i.e runtimes\linux\native).

Kindly try the provided sample on your end and let us know the result




VK Vikas Kumar Gupta replied to Santhiya Narayanan May 25, 2023 11:24 AM UTC

Hi, 

Thanks for providing the solution. We are successfully able to generate the PDF using a c# client. Can you please guide us how do we call the lambda function using Angular 15.


Regards

~Vikas



SN Santhiya Narayanan Syncfusion Team May 26, 2023 03:05 PM UTC

Currently we are checking on this and will update the further details on May 30th,2023



DO Devon Orn May 29, 2023 09:36 AM UTC

If a user is unable to access the ap.setup login page, you must check the connection between the router and the device. A user is advised to create a wired connection using the Ethernet cable that comes along with the device. 


SN Santhiya Narayanan Syncfusion Team May 30, 2023 04:48 PM UTC

Currently we are creating the sample for your requirement and will update the further details on May 31st,2023



SG Sivaram Gunabalan Syncfusion Team May 31, 2023 04:51 PM UTC

We are facing the complexities to create the Angular sample to call the lambda function. We will update the further details on June 2nd, 2023.



SN Santhiya Narayanan Syncfusion Team June 2, 2023 04:59 PM UTC

we are facing issue with aws-sdk in angular application, kindly try below code in your side and let us know the result. 


const AWS = require('aws-sdk')
        AWS.config.update({
  accessKeyId: 'your key id',
  secretAccessKey: 'Your access key'
});
const lambda = new AWS.Lambda();
const params = {
  FunctionName: 'Lambda name',
  Payload: 'https://www.google.com'
};

 

lambda.invoke(params, (err: Error, data: any) => {
  if (err) {
    // Handle error
  } else {
    // Process the data returned by the Lambda function
  }

 



Loader.
Up arrow icon