Starting without an Input File and saving to PDF

Is it possible to build a Word Doc (adding text and images) without reading a Word Document from disk first. Then save the creation as a PDF.

I just want one blank page with no margins, header, etc… nothing … like a blank sheet of paper.

Please send me a code example.

@adventurousbooks,

Please try using the following code:

Document doc = new Document();
//doc.Save("E:\\temp\\19.3.docx"); // this will produce a blank Word document

DocumentBuilder builder = new DocumentBuilder(doc);
builder.Writeln("This will write a paragraph");
Shape img = builder.InsertImage("E:\\temp\\aspose.words.jpg"); // this will insert an image

doc.Save("E:\\temp\\19.3.pdf"); // save document with some text and an image

Hope, this helps.

Thanks Awais,

How do I set the document so it is just one page and is (17 inches wide, 11 inches height) with zero margins and gutters. I need just a one page blank page to insert stuff.

Have a good day,

@adventurousbooks,

Please try using the following code:

Document doc = new Document();

PageSetup ps = doc.FirstSection.PageSetup;
ps.PageWidth = 17 * 72;
ps.PageHeight = 11 * 72;
ps.LeftMargin = 0;
ps.TopMargin = 0;
ps.RightMargin = 0;
ps.BottomMargin = 0;
ps.Gutter = 0;

// now you can use DocumentBuilder to insert different elements
DocumentBuilder builder = new DocumentBuilder(doc);
doc.Save("E:\\temp\\19.3.docx");