- Home
- Forum
- ASP.NET MVC (Classic)
- error when converting doc to pdf
error when converting doc to pdf
Server Error in '/' Application.
Parameter is not valid.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Exception Details: System.ArgumentException: Parameter is not valid.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. |
Stack Trace:
|
Hi
Andrea,
Thank
you for your interest in Syncfusion products.
Essential
DocIO uses GDI+ functionalities for converting a Word document to PDF. Whereas
some of the GDI+ functionalities are not supported in Windows Azure websites
and this is known limitation in Windows Azure environment. Hence the mentioned
error is thrown while deploying the Word to PDF conversion in Azure websites.
As a workaround, kindly use Azure cloud services to convert Word documents to
PDF and call this service from Azure web site.
Please
let us know if you have any other questions.
Regards,
Sathish
Thank you for your update.
As mentioned earlier, currently Azure doesn’t provide full-fledged support for GDI functionalities. Due to this limitation in Azure, when we convert the Word document as PDF document using Essential DocIO, the conversion process become fails because Word document to PDF conversion depends on GDI functionalities. So it is a known limitation in Word document to PDF conversion using DocIO until complete GDI functionalities are supported in Azure.
As a workaround you shall make use of Azure cloud service to convert a Word document as Pdf and use that cloud service as service reference in your azure web site. We have prepared a sample to illustrate the same.
Please find the sample for Azure cloud service from below link:
http://www.syncfusion.com/downloads/support/directtrac/general/GeneratePdf_ColudService2143814054.zip
Please find the sample using cloud service as service reference from below link:
http://www.syncfusion.com/downloads/support/directtrac/general/WordToPdfConversion-329039872.zip
Please let us know if you have any other questions.
Regards,
Sathish
Did this situation get any better since then ?
I created a ticket http://www.syncfusion.com/forums/120526/azure-hosted-syncfusion-doctopdfconverter-converttopdf-a-generic-error-occurred-in-gdi because I am facing the same problem.
Is creating a Cloud Service hosted application is the only workaround ?
Thanking you in advance.
Thank you for contacting Syncfusion support,
Currently GDI+ functionalities are not supported in Windows Azure websites and this is known limitation in Windows Azure environment. Till Windows Azure supports full-fledged on GDI+ functionalities we can use below sample as work around solution.
Please find the sample for Azure cloud service from below link:
http://www.syncfusion.com/downloads/support/directtrac/general/GeneratePdf_ColudService2143814054.zip
Please find the sample using cloud service as service reference from below link:
http://www.syncfusion.com/downloads/support/directtrac/general/WordToPdfConversion-329039872.zip
Regards,
Narendran
Thank you for contacting Syncfusion support.
A support incident to track the status of the your query has been created under your account. Please log on to our support website to check for further updates,
https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents
Please let me know if you have any questions.
Regards,
Sarath
I'm facing the same problem on Azure. Is it possible, as suggested by Ian, to convert image based on bitmap instead of metadata? This should fix easily your issue.
Thank you for contacting Syncfusion support.
A support incident to track the status of the your query has been created under your account. Please log on to our support website to check for further updates,
https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents
Please let me know if you have any questions.
Regards,
Sarath
Thank you for your update.
We regret to let you know that the support for “Word to PDF conversion in Azure environment” is not yet implemented and we have already logged this as a feature request in our database. We will implement this feature in any of our upcoming releases The feature implementation would also greatly depend on the factors such as product design, code compatibility and complexity. We request you to visit our website periodically for feature related updates.
As a workaround you shall make use of Azure cloud service to convert a Word document as Pdf and use that cloud service as service reference in your azure web site.
Thanks,
Sethumanikkam.Y
Thank you for contacting Syncfusion support.
A support incident to track the status of your query has been created under your account. Please log on to our support website to check for further updates,
https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents
Please let us know if you need further clarifications regarding this,
Thank you for contacting Syncfusion support.
We regret to let you know that the support for “Word to PDF and PPTX to PDF conversions in Azure environment” is not yet implemented and we have already logged this as a feature request in our database. We will implement this feature in any of our upcoming releases. The feature implementation would also greatly depend on the factors such as product design, code compatibility and complexity. We request you to visit our website periodically for feature related updates.
A support incident to track the status of your query has been created under your account. Please log on to our support website to check for further updates,
https://www.syncfusion.com/account/login
Please let us know if you need further clarifications regarding this.
Thanks,
Sethumanikkam.Y
Thank you for contacting Syncfusion support.
We regret to let you know that the support for “Word to PDF and PPTX to PDF conversions in Azure environment” is not yet implemented and we have already logged this as a feature request in our database. We will implement this feature in any of our upcoming releases. The feature implementation would also greatly depend on the factors such as product design, code compatibility and complexity. We request you to visit our website periodically for feature related updates.
Thanks,
Sethumanikkam.Y
We regret for the inconvenience caused.
Still we have not resolved GDI limitations specific to Azure environment. We have plans to resolve these limitations in near future and we are working towards finding the alternate solution for these limitations. At this moment we cannot provide any concrete timeline for this feature. We will let you know once this feature has been implemented.
Please let us know if you have any other questions.
Thanks,
Sethumanikkam.Y
We regret for the inconvenience caused.
Due to the GDI+ limitation, DocIO doesn’t provide the support for Word to PDF conversion in Azure platform using Azure WebJob.
As mentioned in the previous update, we have plans to resolve these limitations (GDI+ limitation in Azure platform) in Azure environment. At this moment, we cannot provide any concrete timeline for this feature. Let you know once this feature has been implemented.
Please let us know if you have any other questions.
Thanks,
Sivasubramani.
Daniel
Thank you for your update.
We are glad to inform you that the support for Word to PDF conversion using Essential DocIO in Azure has been already provided in our latest Essential Studio version (since v15.3.0.26).
You can download our Essential Studio 2017 Volume 3 - v15.3.0.26 from the following link.
https://www.syncfusion.com/forums/131983/essential-studio-2017-volume-3-release-v15-3-0-26-is-available-for-download
Please find the below KB link to know more about Word to PDF conversion in Azure Environment:
https://www.syncfusion.com/kb/7751/is-it-possible-to-perform-word-to-pdf-conversion-in-azure-environment
Please let us know if you have any other questions.
Regards,
Sethumanikkam.Y
System.Runtime.InteropServices.ExternalException (0x80004005): A generic error occurred in GDI+.
at System.Drawing.Graphics.CheckErrorStatus(Int32 status)
at System.Drawing.Graphics.DrawImage(Image image, Single x, Single y, Single width, Single height)
at System.Drawing.Graphics.DrawImage(Image image, RectangleF rect)
at Syncfusion.DocIO.Rendering.DrawingContext.DrawPicture(WPicture picture, LayoutedWidget ltwidget)
at Syncfusion.DocIO.Rendering.DrawingContext.Draw(IWidget widget, LayoutedWidget layoutedWidget)
at Syncfusion.DocIO.Rendering.DrawingContext.Draw(LayoutedWidget layoutedWidget, Boolean isHaveToInitLayoutInfo)
at Syncfusion.DocIO.Rendering.DrawingContext.DrawBehindWidgets(LayoutedWidgetList behindWidgets, IWidget ownerWidget, Int32 length, Boolean isHaveToInitLayoutInfo)
at Syncfusion.DocIO.Rendering.DrawingContext.Draw(Page page)
at Syncfusion.DocIO.DLS.Rendering.DocumentLayouter.DrawToImage(Int32 startPageIndex, Int32 noOfPages, ImageType imageType, MemoryStream stream)
at Syncfusion.DocIO.DLS.Convertors.WordToImageConverter.ConvertToImage(WordDocument document, ImageType imageType, MemoryStrAlso, could you please provide us the input Word document which used at your end. Thereby, we will check and provide you the confirmation whether the reported problem will be fixed in 2018 Volume 4 SP1 release.
Note: If you have any confidential data in your Word document, please replace with some dummy data and provide us the same. We just need your document to recreate the problem you face.
Hi Bart,
Greetings from Syncfusion.
From the given details, we suspect that the input Word document contains metafile images. Currently, the metafile images (*.wmf, *.emf) in Word document are not supported while converting to PDF in Azure environment which is already a known limitation. We have already considered this exception problem at our end and will provide fix to skip the exception to convert the given Word document as PDF. The fix will be included in our 2018 Volume 4 SP1 release which is expected to be rolled out in February 2019.
Also, could you please provide us the input Word document which used at your end. Thereby, we will check and provide you the confirmation whether the reported problem will be fixed in 2018 Volume 4 SP1 release.
Note: If you have any confidential data in your Word document, please replace with some dummy data and provide us the same. We just need your document to recreate the problem you face.
Regards,Dilli babu.
Good day,
Thank you for your update.
We are glad to announce that starting with version 17.1 (2019 Vol 1) in our Essential DocIO library, to avoid this exception, if the word document holds “wmf” and “emf” image, we have replaced the original image with the default “RedX” image.
Please find the release notes details from the below link:
https://help.syncfusion.com/aspnetmvc/release-notes/v17.1.0.38?type=all#docio
Please let us know if you need further assistance in this.
Regards,
Vijayasurya A
Hi,
I'm using Syncfusion.DocToPdfConverter.ClientProfile (version 20.4.0.52) to convert a Word document in PDF.
Code runs in a Dynamics 365 CE plugin (cloud hosted).
I'm getting this error:
System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]: A generic error occurred in GDI+. (Fault Detail is equal to Exception details:
ErrorCode: 0x80040224
Message: A generic error occurred in GDI+.
TimeStamp: 2023-03-10T14:41:45.4838781Z
OriginalException: PluginExecution
There are no images in the Word document, just plain text and some tables.
The GDI+ eception should be fixed, as described in previous posts. So what's causing this exception?
Best regards,
Ernst Wolthaus
Hi Ernst,
The previous updates and solutions in the forums are related to Support for
Word to PDF conversion in Azure environment.
But you are facing the problem in a Dynamics 365 CE plugin (cloud hosted). We have
already analyzed about the Word to PDF conversion feasibility in this environment
and found that Microsoft Dynamics has limited support for GDI+. So Word to PDF
conversion is not supported in Microsoft Dynamics using DocToPDFConverter (internally
used GDI+) which is already a known limitation.
To resolve this problem, we suggest you to use the Syncfusion.DocIORenderer.Net.Core
NuGet package in which internally we used the SkiaSharp library to convert a
Word document to PDF and provide us confirmation whether the reported problem
gets resolved or not using this solution.
Refer the below code snippet to convert Word to PDF using DocIORenderer.
|
//Open the existing Word document. using (WordDocument wordDocument = new WordDocument(inputDocumentStream, FormatType.Automatic)) { //Create an instance of DocIORenderer. using (DocIORenderer renderer = new DocIORenderer()) { //Convert Word document into PDF document. using (PdfDocument pdfDocument = renderer.ConvertToPDF(wordDocument)) { //Save the PDF. MemoryStream pdfStream = new MemoryStream(); pdfDocument.Save(pdfStream); } } } |
Regards,
Suriya Balamurugan.
- 30 Replies
- 23 Participants
-
AI Andrea Inglese
- Jun 26, 2014 02:08 PM UTC
- Mar 13, 2023 02:12 PM UTC