Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Thu Apr 14, 2016 7:41 pm

We have a word document that has colored circles in a cell in a table. These are created by making a shape in word and setting the fill color (e.g. Red).

If I save as pdf in word they show up. But if I use Spire doc to convert to PDF they dont. Do you know of a work around or some setting I need?

ppdevs
 
Posts: 20
Joined: Sat Jan 09, 2016 7:23 pm

Fri Apr 15, 2016 2:13 am

Hello,

Thanks for your feedback.
Our Spire.Doc supports to convert shape in Word to PDF. Please provide us your word document can replicate this issue for investigation.

Thank you in advance.
Caroline
E-iceblue support team
User avatar

caroline.zhang
 
Posts: 291
Joined: Mon Mar 07, 2016 9:22 am

Tue Apr 19, 2016 6:39 am

Hi,

Has your issue been resolved?
Could you please give us some feedback?

Thanks and Best Regards,
Caroline
E-iceblue support team
User avatar

caroline.zhang
 
Posts: 291
Joined: Mon Mar 07, 2016 9:22 am

Tue Jul 09, 2024 11:48 am

Hello,

Sorry to bring up this old thread, but I'm having the exact same issue.

What can I do to solve it? I'm using the latest version of Spire.Doc (12.6.10)

enmendoza
 
Posts: 4
Joined: Tue Jul 09, 2024 11:42 am

Wed Jul 10, 2024 6:41 am

Hi,

Thank you for your inquiry.
I have simulated a document and converted it into a PDF. The shapes can be displayed normally (as shown in the picture below). If you are not using the latest version, I recommend upgrading to the latest version for testing as our new version has more fixes. If you still encounter problems after using the latest version, please provide the document for us to further investigate. Thanks in advance!

Spire.Doc for .Net12.7.3: https://www.e-iceblue.com/Download/down ... t-now.html
Spire.Doc for Java 12.6.2: https://www.e-iceblue.com/Download/doc-for-java.html

Sincerely,
Doris
E-iceblue support team
User avatar

Doris.Liu
 
Posts: 460
Joined: Mon Nov 07, 2022 8:10 am

Thu Jul 11, 2024 9:42 am

Hello Doris,

Thanks for your fast reply.

I've just tested it with the latest version, but I got the same error: Message: Object reference not set to an instance of an object.

I'm trying to merge two documents. That works OK, the document gets created without any issues, but when I try to convert it to PDF, it fails.

This is the merge code:
Code: Select all
                   
// Load the attachment
attachmentDoc.LoadFromFile(HostingEnvironment.MapPath($"~/output/temp.file"), FileFormat.Docx);

// add page break
doc.LastSection.Paragraphs[doc.LastSection.Paragraphs.Count - 1].AppendBreak(BreakType.PageBreak);

// Merge
foreach (Section sec in attachmentDoc.Sections)
{
    doc.Sections.Add(sec.Clone());
}


This is the code from where I get the error afterward:
Code: Select all
doc.SaveToFile(docxOutputPath, FileFormat.Docx); // Works OK
doc.SaveToFile(pdfOutputPath, FileFormat.PDF); // Fails


The only thing that I've found that makes the conversion break, are the shapes. If I remove them from the file (attached), it works.

Can you please check to see if you find the error?

enmendoza
 
Posts: 4
Joined: Tue Jul 09, 2024 11:42 am

Fri Jul 12, 2024 7:10 am

Hi,

Thank you for your sharing.
I still can't reproduce the issue you mentioned, I uploaded my project for your reference. Please download it and run it directly, we would greatly appreciate it if you could inform us of your results.

Sincerely,
Doris
E-iceblue support team
User avatar

Doris.Liu
 
Posts: 460
Joined: Mon Nov 07, 2022 8:10 am

Fri Jul 12, 2024 9:09 am

Hi Doris,

Thanks for the project. I've tested it an it works fine, the issue comes when you get this file and merge it into another, and then try to convert to PDF the merged one.

Can you please test that?

enmendoza
 
Posts: 4
Joined: Tue Jul 09, 2024 11:42 am

Fri Jul 12, 2024 9:52 am

Hi,

Thank you for your quick feedback.
I modified the code but I still can't reproduce the issue. I uploaded the project again. If you still have problems with the test, please provide similar project for us to further investigate. Thanks in advance for your assistance!

Sincerely,
Doris
E-iceblue support team
User avatar

Doris.Liu
 
Posts: 460
Joined: Mon Nov 07, 2022 8:10 am

Wed Jul 17, 2024 10:15 am

Thanks Doris for following the incident.

I couldn't replicate the behavior either. The only workaround that I could find is to create a new instance of Spire doc, load the word document into that instance and then perform the conversion.

Code: Select all
try
{
    doc.SaveToFile(pdfOutputPath, FileFormat.PDF);
}
catch (Exception e)
{
    Document docX = new Document();

    // Load a Word document
    docX.LoadFromFile(docxOutputPath);

    // Save the document to PDF
    docX.SaveToFile(pdfOutputPath, FileFormat.PDF);

    // Dispose resources
    docX.Dispose();
}

enmendoza
 
Posts: 4
Joined: Tue Jul 09, 2024 11:42 am

Thu Jul 18, 2024 7:37 am

Hello,

Thank you for your response.
If you are unable to reproduce the issue, kindly confirm whether it was caused by the document you tested previously. If so, please provide us with the files you used for the merge, and we will conduct further investigations. We appreciate your assistance.

Sincerely,
Doris
E-iceblue support team
User avatar

Doris.Liu
 
Posts: 460
Joined: Mon Nov 07, 2022 8:10 am

Return to Spire.Doc