How to save doc to pdf with correct margin

Dear all
I have an issue and need your helps to fix it.
I load a doc file and then I save to two files. One is doc and the other is pdf. I use the following codes to do that

Document doc=new Document("D:\\report.doc");
DocumentBuilder builder = new DocumentBuilder(doc);
//insert QRCode to the doc file
 builder.InsertImage(QRCode, 50, 50); 
//Save to a new doc file
doc.Save("D:\\result.doc,SaveFormat.Doc)
//Also save to a pdf file
doc.Save("D:\\result.pdf,SaveFormat.Pdf)

when I open result.doc, It look like very good
But when I open the result result.pdf, then the QRCode is not good as the result.doc file
You can see it in the picture below
So what is the solution to fix this error.
Thanks so much
image.jpg (281.5 KB)
image.jpg (222.8 KB)

@dvcuong150181,

Have you also tried the latest (21.10) version of Aspose.Words for .NET on your end? In case the problem still remains, then please ZIP and upload your input Word document and Aspose.Words generated PDF file showing the undesired behavior here for testing. We will then investigate the issue with your particular files on our end and provide you more information.

Dear Sir,
I have just downloaded the lastest version of Aspose but the same problem ocurred. So I zip 3 files: one is doc file(Result.DOC), one is pdf file that 's converted from aspose(Result_PDF_From_Aspose.Pdf) and the last is the pdf file that’s created by print Doc to PDF (Result_Print_Doc_to_PDFPrinter.pdf).
Pls help. Thanks so much
Result.zip (679.5 KB)

@dvcuong150181,

The problem occurs because you are using a very old 16.6 version of Aspose.Words for .NET on your end (Result_PDF_From_Aspose.Pdf was actually produced by 16.6 version). Please double check that you are indeed using the latest 21.10 version of Aspose.Words for .NET on your end.

But, after an initial test with the licensed latest (21.10) version of Aspose.Words for .NET, we were unable to reproduce this issue on our end. Please see the following output PDF file generated on our end:

C# code we used on our end is:

Document doc = new Document(@"C:\Temp\result\\Result.doc");
doc.Save(@"C:\Temp\\result\\21.10.pdf");

So, we suggest you to please upgrade to the latest version of Aspose.Words for .NET.

Dear Sir, I change the initial code to the following code and It’s OK
Document doc=new Document(“D:\report.doc”);
DocumentBuilder builder = new DocumentBuilder(doc);
//insert QRCode to the doc file
builder.InsertImage(QRCode, 50, 50);
//Save to a new doc file
doc.Save(“D:\result.doc”,SaveFormat.Doc)
**//Load again. **
doc=new Document(“D:\result.doc”);
//Then save to PDF. It’s OK
doc.Save(“D:\result.pdf”,SaveFormat.Pdf)

@dvcuong150181,

It is great that you were able to resolve the problem on your end. In case you have further inquiries or may need any help in future, please let us know by posting a new thread in Aspose.Words’ forum.