We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Converting Word to PDF created white Background / cannot overlay


we want to convert 2 word files to PDF (one document with the letter header / footer and another for the specific content). We convert both documents to PDF using your DocToPDFConverter class and want to overlay both resulting files, saving the resulting PDF.

Both documents are currently created with another word library but we also have the problems if we create a new document with Word.

When we overlay the pages of both PDFs the resulting file only contains the last page. It seems you set the PDF Background to white instead of transparent when converting the Word document, resulting in the second document overlaying the first one completely. 

When i convert both word files using http://www.freepdfconvert.com/ and overlay the resulting PDF files i have no problems. I also tried to save the converted files first and loading them like the externally converted files but that also did not work

Sample Code:

void Main()
    // Convert existing word files to pdf
    PdfDocument invoice = WordToPdf(@"c:\test\invoice.docx");
    PdfDocument logo = WordToPdf(@"c:\test\logo.docx");
    // or load pdf files converted using http://www.freepdfconvert.com/
    // PdfLoadedDocument logo = new PdfLoadedDocument(@"C:\test\logo.pdf");
    // PdfLoadedDocument invoice = new PdfLoadedDocument(@"C:\test\invoice.pdf");
    // Overlaying According to sample. 
    var doc = new PdfDocument();
    var page = doc.Pages.Add();
    var g = page.Graphics;

    // overlay the first page of both source files. Using the externally converted files work, converted using SyncFusion only shows the last page
    g.DrawPdfTemplate(logo.Pages[0].CreateTemplate(), PointF.Empty, page.GetClientSize());
    g.DrawPdfTemplate(invoice.Pages[0].CreateTemplate(), PointF.Empty, page.GetClientSize());

PdfDocument WordToPdf(string wordDocPath)
    WordDocument wordDoc = new WordDocument(wordDocPath);
    DocToPDFConverter converter = new DocToPDFConverter();
    PdfDocument pdfDoc = converter.ConvertToPDF(wordDoc);
    return pdfDoc;

Just create two new word documents (word 2013) with some text on different lines.  I attached the new word documents and externally converted files i am used to try the overlay (simple files that have the text "foo" and "bar")

I tried setting the background of the loaded word files to Transparent or none, playing with the pdf layers, ... Nothing helped.

Any help is appreciated 

Best regards,

Attachment: test_6988f16a.zip

1 Reply

PH Praveenkumar H Syncfusion Team November 12, 2014 04:22 AM UTC

Hi Felix,

Thank you for using syncfusion products,

We have analyzed your code and found that it is an issue, we have logged the issue report and will fix this internally.

Please let us know if you need further assistance.

With Regards,

Live Chat Icon For mobile
Up arrow icon