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.

Tue May 09, 2023 1:43 pm

Hello IceBlue stuff.
I have a situation when i tried to convert "AT ENAV - eDesk - Fascicoli automatici (2).docx". The execution behind took around 1 minute to produce converted.pdf file. The converted file has a lot of artifacts related to the images like
1) lose original color of image (take al look on the header)
2) lose company image in the blue box on the left size of the first page.

and so on. can you help me?

fabrizio.lazzarotto
 
Posts: 20
Joined: Mon Feb 28, 2022 4:16 pm

Wed May 10, 2023 2:40 am

Hi,

Thanks for your feedback.
I have done a test with your file, using the latest Spire.Office (8.4.1), but I am not able to fully reproduce your issue, the original color of image is not lost, in addition, the conversion process cost about 5 or 6 seconds to finish. Could you please share us with the following messages to help us reproduce your issue and work out a solution for you. Thanks for your corporation.
1) your test code.
2) your application type. Such as Console App .NET Framework 4.8.

Best regards,
Triste
E-iceblue support team
User avatar

Triste.Dai
 
Posts: 1000
Joined: Tue Nov 15, 2022 3:59 am

Wed May 10, 2023 6:09 am

Hello team.
we are using Spire.Officefor.NETStandard 8.4.1 instead Spire.Office because our code run behind NET 7 on linux system.

We tried to use Spire.Office with a bad result (Check log below)

---> System.TypeInitializationException: The type initializer for 'Gdip' threw an exception.
---> System.PlatformNotSupportedException: System.Drawing.Common is not supported on non-Windows platforms. See aka.ms/systemdrawingnonwindows for more information.
at System.Drawing.LibraryResolver.EnsureRegistered()
at System.Drawing.SafeNativeMethods.Gdip.PlatformInitialize()
at System.Drawing.SafeNativeMethods.Gdip..cctor()
--- End of inner exception stack trace ---
at System.Drawing.SafeNativeMethods.Gdip.GdipLoadImageFromDelegate_linux(StreamGetHeaderDelegate getHeader, StreamGetBytesDelegate getBytes, StreamPutBytesDelegate putBytes, StreamSeekDelegate doSeek, StreamCloseDelegate close, StreamSizeDelegate size, IntPtr& image)
at System.Drawing.Image.InitializeFromStream(Stream stream)
at System.Drawing.Image.LoadFromStream(Stream stream, Boolean keepAlive)
at System.Drawing.Image.FromStream(Stream stream, Boolean useEmbeddedColorManagement, Boolean validateImageData)
at sprꡫ.귟(Byte[] A_0)
at sprꡫ..ctor(PointF A_0, SizeF A_1, Byte[] A_2, spr䁁 A_3)
at spr爊.권(sprꓱ A_0, sprꦷ A_1)
at spr爊.㚔(spr煤 A_0)
at spr猃.권(spr湹 A_0, SizeF A_1, RectangleF A_2, spr걏 A_3)
at spr猃.귟(XmlDocument A_0, SizeF A_1, RectangleF A_2, spr걏 A_3)

this is our code that we are using to convert word to pdf.


Code: Select all
            byte[] content = <miss code >
            using MemoryStream readMs = new(content);
            using MemoryStream writeMs = new();
            Document document = new();
            document.LoadFromStream(readMs, FileFormat.Auto);
            if (document.IsContainMacro)
            {
                document.ClearMacros();
            }

            ToPdfParameterList pdfParameterList = new()
            {
                IsEmbeddedAllFonts = true,
                DisableLink = true
            };

            document.SaveToStream(writeMs, pdfParameterList);
            return writeMs.ToArray();

fabrizio.lazzarotto
 
Posts: 20
Joined: Mon Feb 28, 2022 4:16 pm

Wed May 10, 2023 9:25 am

Hi,

Thanks for your feedback.
I have tested your code with Spire.Office for .NET Standard 8.4.1 on CentOS 7, but I was unable to fully replicate the problem you reported, only the second issue you mentioned appeared. I have attached a document containing my results for your review.

I will report the issues that I was able to reproduce to our development team, they will investigate and fix it, sorry for the inconvenience caused. Please let me know if you have any further questions or concerns.

Best regards,
Triste
E-iceblue support team
User avatar

Triste.Dai
 
Posts: 1000
Joined: Tue Nov 15, 2022 3:59 am

Thu May 11, 2023 8:54 am

Hello Triste,
we used a official microsoft alpine linux image, from the microsoft regisitry, to create our docker image that is running our code.

This is the container registry url: mcr.microsoft.com/dotnet/aspnet:7.0-alpine AS build

Do you know (technically speaking) the required linux libraries the environment must have? If it works correctly in CentOS may because alpine doesn't have the same libraries by default.

if you can give that information i could install'em and test it again

fabrizio.lazzarotto
 
Posts: 20
Joined: Mon Feb 28, 2022 4:16 pm

Fri May 12, 2023 9:10 am

Hi,

Thank you for bringing the bug to our attention. We apologize for any inconvenience it may have caused and appreciate your effort in providing us with feedback.

We understand that you have encountered an issue while using our product and that it is difficult to fully reproduce the problem on our end. In response to your inquiry regarding the required Linux libraries for the environment, we do not have a comprehensive list of libraries .

To further investigate this issue, we kindly request that you provide us with your testing project and Dockerfile. With these materials, we can conduct thorough tests. You can send them to us via email ([email protected]) or attach them here, thanks for your assistance.

Again, thank you for reaching out to us. We hope to work together to resolve this issue promptly.

Best regards,
Triste
E-iceblue support team
User avatar

Triste.Dai
 
Posts: 1000
Joined: Tue Nov 15, 2022 3:59 am

Thu May 25, 2023 8:26 am

Hello support, do you have any feedback from the internal investigations?

fabrizio.lazzarotto
 
Posts: 20
Joined: Mon Feb 28, 2022 4:16 pm

Thu May 25, 2023 10:13 am

Hi,

Thank you for your inquiry. We would like to suggest that you use the latest version of Spire.Officefor.NETStandard_8.5.3. This new version has optimized the effectiveness of document conversion. Please download from Nuget and have a test.
If you encounter any issues during testing, please do not hesitate to contact us at any time and we will be happy to assist you further.

Best regards,
Triste
E-iceblue support team
User avatar

Triste.Dai
 
Posts: 1000
Joined: Tue Nov 15, 2022 3:59 am

Thu May 25, 2023 10:45 am

Hi Triste,
it has been migrated and tested with letest version and I confirm it is more fast and stable that version n° 8.4.1. In the final pdf remains only a few artifacts (take a look on "converted" attachment) ;but i have now a critical license issue (check attached image) appear only if I use version n° 8.5.3. do you know why?

fabrizio.lazzarotto
 
Posts: 20
Joined: Mon Feb 28, 2022 4:16 pm

Fri May 26, 2023 6:05 am

Hi,

Thanks for your feedback.
As our product undergoes continuous updates and iterations, the method of applying licenses for Spire.Doc has been adjusted. We kindly request that you utilize the following code to resolve the issue.
Code: Select all
Spire.Doc.License.LicenseProvider.SetLicenseKey("your license key") ;
Spire.License.LicenseProvider.SetLicenseKey("your license key");

In addition, I did not find your attachment. We have tested your document using our latest version of Spire.Officefor.NETStandard_8.5.3 on Linux-docker desktop, Linux system, and Linux with docker, and the result document seems to be fine.
We kindly request that you provide us with a simple demo that can reproduce the issue you are facing so that we can assist you better. Thank you for your cooperation.

Best regards,
Triste
E-iceblue support team
User avatar

Triste.Dai
 
Posts: 1000
Joined: Tue Nov 15, 2022 3:59 am

Fri May 26, 2023 8:23 am

i confirm the license issue has been fixed.

I attached the version of document that i tool you in the previous text.

Have a good day

PS: about the code, it is not easy to extract from our layers. the base code used follow that example below:

Code: Select all
            byte[] content = <miss code >
            using MemoryStream readMs = new(content);
            using MemoryStream writeMs = new();
            Document document = new();
            document.LoadFromStream(readMs, FileFormat.Auto);
            if (document.IsContainMacro)
            {
                document.ClearMacros();
            }

            ToPdfParameterList pdfParameterList = new()
            {
                IsEmbeddedAllFonts = true,
                DisableLink = true
            };

            document.SaveToStream(writeMs, pdfParameterList);
            return writeMs.ToArray();

fabrizio.lazzarotto
 
Posts: 20
Joined: Mon Feb 28, 2022 4:16 pm

Mon May 29, 2023 11:17 am

Hi,

Thanks for your feedback.
We apologize for any inconvenience this may have caused and would like to assist you in resolving this issue as quickly as possible.
I have prepared a simple project that we would like you to download and test from the following link: https://www.e-iceblue.com/downloads/demo/WebApplication.zip. Please set the license key and font path manually.

Once you have tested this implementation and confirmed that the project works well, please attempt to modify the code and Dockerfile to reproduce the issues you have been experiencing. If you are able to reproduce the problem, we kindly ask that you share your modified project with us via Google Drive or OneDrive so that we can investigate further.

We appreciate your cooperation and look forward to hearing back from you soon.

Best regards,
Triste
E-iceblue support team
User avatar

Triste.Dai
 
Posts: 1000
Joined: Tue Nov 15, 2022 3:59 am

Mon May 29, 2023 2:59 pm

Hello Triste,
I saw this code in your console application and i have and idea to how we could fix our "fonts" issue from our code, indeed we currently doesn't use any method to declare "custom fonts's path"
iceblue.PNG



i will let you know our final results

fabrizio.lazzarotto
 
Posts: 20
Joined: Mon Feb 28, 2022 4:16 pm

Tue May 30, 2023 2:08 am

Hi,

Thanks for your feedback.
Docker containers have limited access to system files, which can sometimes lead to font-related problems. We can mount a data volume to our container or copy the fonts from the host machine and specified a private font path. This approach ensures that the necessary fonts are available within the container, without requiring us install the fonts in the container.

Please feel free to test the demo we provided and let us know your feedback. We appreciate your cooperation and patience as we work towards resolving this issue.

Best regards,
Triste
E-iceblue support team
User avatar

Triste.Dai
 
Posts: 1000
Joined: Tue Nov 15, 2022 3:59 am

Return to Spire.PDF

cron