I am passing the html code to create a aspose.pdf document using the stream. The below code works normally in my local system & errors out on the line where i create new document saying unable to initialize the document.
var objLoadOptions = new HtmlLoadOptions();
objLoadOptions.PageInfo.Margin.Bottom = 10;
objLoadOptions.PageInfo.Margin.Top = 10;
objLoadOptions.PageInfo.Margin.Right = 15;
objLoadOptions.PageInfo.Margin.Left = 15;
var pdfHtmlTemplate = htmldata; // generated html data.
**** //Errors out in this line
var doc = new Aspose.Pdf.Document(new memoryStream(Encoding.UTF8.GetBytes(pdfHtmlTemplate)), objLoadOptions);
using MemoryStream documentStream = new MemoryStream();
doc.Save(documentStream, SaveFormat.Pdf);
documentStream.Close();
return Constants.GeneratePDFSuccessMessage;
}
This is not working after deploying to the linux docker container - Need you support in getting this resolved.
@pvaidhya92
To ensure a timely and accurate response, please attach the following resources here for testing:
- Your input document.
- Please create a simple Docker application (source code without compilation errors) that helps us to reproduce your problem on our end. Please attach Visual Studio application.
As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.
PS: To attach these resources, please zip and upload them.
After a bit of debugging, i could see two errors - please let me know if this will help you !
We are using ASP mcr.microsoft.com/dotnet/aspnet:6.0 AS base and Linux Docker Container
I am getting this errrError_Message_from_Code.PNG (8.1 KB)
In local it works fine as i am using windows Machine - Is there an alternative for us to resolve this issue - It says System.Drawing.Common is not supported on non-Windows platforms. See Breaking change: System.Drawing.Common only supported on Windows - .NET | Microsoft Learn for more information. in the inner exception & i could see that some threads that system .drawing is not supported on non windows machines?
How can i resolve this issue ! Need help !
@pvaidhya92
We suggest you please upgrade to the latest version of Aspose.PDF for .NET 22.7 and let us know how it goes on your side.
Regarding the System.Drawing.Common issue, please check the following article.
If you still face problem, please share the working Docker application here for testing. We will investigate the issue and provide you more information on it.
docker_aspose.pdf.zip (145.1 KB)
I changed to 22.7 and still am facing the same issue - i created a small application to try this on a new small app referring to this link : How to run Aspose.PDF in Docker|Aspose.PDF for .NET - that is also not working on my docker container.sampleDocker.PNG (118.9 KB)
Attached the sample project & i am facing the issue after updating to the latest version of aspose.pdf
@pvaidhya92
We have logged this problem in our issue tracking system as PDFNET-52145. You will be notified via this forum thread once this issue is resolved.
We apologize for your inconvenience.
I am happy to get into a call to explain in case if we need more details on the same.
@pvaidhya92
Please note that we only provide support via forums. If there is any further detail is required, we will ask you in this forum thread. Thanks for your cooperation.
Thanks Tahir,
To add additional information, Is it anything related to the license of the ASPOSE.PDF - We are in progress of getting the license for ASPOSE.PDF & the client wants to validate while the procurement is in progress.
In my Machine its not working for (Without License + Linux Docker container + ASP.NET CORE 6.0) or the same stack with windows docker also.
I am currently using it without license in ASP.NET CORE 6.0. I am facing the issue both in Linux & Windows Docker Containers. Our focus is to get this code running in the Linux container only - just wanted to support you with additional information - that i tried meanwhile - Attaching the code of Window Docker not working in the same thread.WebApplication3-Windows.zip (246.1 KB)
@pvaidhya92
We have logged this detail in our issue tracking system. We will inform you once there is an update available on this issue.
@tahir.manzoor
I am using .net6 and 23.1.0 version of aspose.pdf, I am facing the same issue as reported above. is there a way with which this combination can work?
PS: there is no option of using windows system.
@hiteshdutt
Aspose.PDF.Drawing NuGet package was released, DLL in this package doesn’t have System.Drawing.Common dependency.
You only need to install Aspose.PDF.Drawing instead of Aspose.PDF. Aspsoe.PDF with Drawing contains Aspose.Drawing inside, installing neither System.Drawing nor Aspose.Drawing is required.
This assembly correctly works under Linux environment. It will be published as separated assembly until we sure that this works absolutely perfect and may replace current System.Drawing-based assembly by 100%. When we ensure that, we will replace System.Drawing version with Aspose.Drawing one.
1 Like
@asad.ali Thank you. It works