Export to PDF from Word365 wrong for some pictures (not all)

Marc Al 206 Reputation points
2021-06-11T08:33:36.963+00:00

Hello,

I have a software that fills some datas in word (via mailmerge).
The documents opens perfectly in Word but when I want to export it to PDF, the picture is wrong (a part of the picture is in the wrong part of the picture and the scale is wrong).
I have no problem using the Microsoft printer to PDF

Can someone please help me? What can I do? The picture is a WMF file.

Here is an example file with the problem

https://1drv.ms/w/s!AgP8E8OqJdIcjPRKoD7WwJPLyQ9VMA?e=FEsVes

Thank you
Marc

Microsoft 365 and Office | Word | For business | Windows
0 comments No comments
{count} votes

Accepted answer
  1. Marc Al 206 Reputation points
    2021-06-18T08:02:12.427+00:00

    Hello,

    I decided to use exactly the workaround I gave in the original message (print to PDF printer) (I am not a fan of buying a software (Acrobat) if I can do it with a PDF printer that works.
    After that I have seen that If I use the parameter EmfType.EmfOnly with the line New Metafile(......
    I have no problem with the exportation. There is only a problem with the quality of the picture that is "less good" than normal WMF.

    Marc

    0 comments No comments

4 additional answers

Sort by: Most helpful
  1. Marc Al 206 Reputation points
    2021-06-13T05:29:25.227+00:00

    Hello,
    The Metafile is done in C#(that launches the mailmerge). The user of the document can resize the picture in the "base document" so with a png or a bitmap the picture has quality problems.
    Is there something I can change here?
    Thank you

    Here is how I create my metafile
    var PanelGraph = Graphics.FromImage(bp);
    var _hdc = PanelGraph.GetHdc();
    var _metaFile = new Metafile(astr_Graph, _hdc, new Rectangle(0, 0, bp.Width, bp.Height), MetafileFrameUnit.Pixel);
    var CurGraph = Graphics.FromImage(_metaFile);
    CurGraph.Clear(SystemColors.Window);
    // Drawing inside the Metafile
    DrawPosWithNewView (...........)
    // End of drawing
    CurGraph.Dispose();
    _metaFile.Dispose();
    PanelGraph.ReleaseHdc(_hdc);
    PanelGraph.Dispose();
    bp.Dispose();

    0 comments No comments

  2. Emi Zhang-MSFT 30,046 Reputation points Microsoft External Staff
    2021-06-14T07:12:04.977+00:00

    Hi @Marc Al ,
    I downloaded your sample and export from Word to PDF and open the PDF file in Edge without problem picture:
    105250-388.png

    My Office 365 detail version number:
    105197-389.png

    What kind of browser did you use?
    How did you open PDF file? From browser or PDF reader?
    Try to install the latest updates for Office 365, and change the default browser.
    Just checking in to see if the information was helpful. Please let us know if you would like further assistance.


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  3. Marc Al 206 Reputation points
    2021-06-14T16:46:38.947+00:00

    Hello,

    It is wrong in your picture. If you look at the green triangle, it is on the right in the word document while it is on the left in the png (and is is smaller than in the word document)
    105370-image.png

    And in your png

    105467-image.png

    Marc

    0 comments No comments

  4. Marc Al 206 Reputation points
    2021-06-17T05:29:18.36+00:00

    Hello,

    Yes, I guess I will have to force the use of the Microsoft printer and not export from word directly
    Thank you
    Marc


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.