Conversion of word to pdf with original document dimensions using spire doc

1.2k Views Asked by At

How to convert word file to a PDF, so that the page setup like margins and orientations of source documents and output PDF want to same.I tried the following code from E-ICEBLUE.

'Load Document
Dim document As New Document()
document.LoadFromFile("E:\work\documents\TestSample.docx")

'Convert Word to PDF
document.SaveToFile("toPDF.PDF", FileFormat.PDF)

'Launch Document
System.Diagnostics.Process.Start("toPDF.PDF")

But the converted PDF don't have the full document.Its header and footer is not showing and right side of the document is cutting. How to solve this ? This is my converted pdf

1

There are 1 best solutions below

0
On

Here demo with code.

Try your doc file and generate pdf. look code

http://www.e-iceblue.com/LiveDemo/Spire.Doc/Conversion.html

With Header and footer

http://www.e-iceblue.com/LiveDemo/Spire.Doc/Header-and-Footer.html