I am reading microsoft word byte data from database(multiple records/files 500 or 600 records) and trying to convert to pdf. For testing purpose i have set byteCompleteLetterPdfback to null. I have to later on save it back to database..I am looping through collection and trying to use Parallel.ForEach to use threading to speed up the process. Is Save operation threadsafe?
I am using Aspose.Words v15.1.0.
var file = dbContext.Letters.Where(x=> x.ByteData != null).Select(y=> y);
Parallel.ForEach(files, new ParallelOptions { MaxDegreeOfParallelism = 2 }, file =>
Thanks for you inquiry. Yes, Aspose.Words does support multi-threading. The only thing you need to make sure is that you
always use separate Document instances per each thread. One thread should use one Document object.
If you are facing any issue while using Aspose.Words, please let us know. We will then provide you more information about your query along with code.
Thanks for your reply. As mentioned, i am using above code to convert to pdf. I get error "Attempted to read or write protected memory. Memory is corrupted".
I get above unhandled exception in ConvertToPdfWithAspose method. Sometimes application closes without even displaying any error. I face the same error when i convert word byte to html and return the string inside Parallel.ForEach loop.
Also note, sometimes it works fine..But most of the time gives error.
Thanks for your inquiry. I have tested the scenario with some test documents and have not found the shared issue. Could you please attach your input Word documents here for testing? I will investigate the issue on my side and provide you more information.
1. Have you used code i posted above or you made any changes?
2. How many documents have you tried processing? I was processing almost 50-100 documents…
3. Are you reading byte data from database?
You can use any word document. with some content in it. and populate byte data(doc document) in your database. I have table with three columns LetterId, WordCompleteLetter(meaning full word document as byte …I want to convert this to full pdf) and WordContent(only content inside document …i want to convert this to html)…
Please find attached file with code i have used. Please note i am adding all processed documents in collection “ConcurrentBag”.If i removed and dont add in collection also it breaks before only when processing the files…
Note: You should call method “ProcessDocuments()” on button click event. Also include Aspose 15.1.0 as dll. Also process 100-200 documents…try it more than once…
Thanks for your inquiry. I used the same code shared in your first post. I tested it with simple documents (around 3000 documents). I read the documents from disk and passing bytes of date to ConvertToPdfWithAspose method.
It would be great if you please share following detail for investigation purposes.
Please attach your input Word documents.
Please
create a standalone/runnable simple application (for example a Console
Application Project) that demonstrates the code (Aspose.Words code) you used to generate
your output document
Please compress your documents, you’re getting this problem with, in .rar or .zip format and share it via SkyDrive, DropBox or any free file sharing service. Once we have your input Word
documents, we will investigate it on our side and provide you more
information.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
Enables storage, such as cookies, related to analytics.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.