Windows 8.1

The PDF Creator .NET Library enables you to create secure PDF documents on the fly and to view, print and process existing PDF documents. If you have any questions about PDF Creator .Net, please post them here.
Post Reply
cliffeh
Posts: 5
Joined: Tue Mar 23 2010

Windows 8.1

Post by cliffeh » Mon Dec 23 2013

Some of the settings seem to have broken in Windows 8 / 8.1. What we're doing works OK in Win7 but in Win8 the font is not right, and the orientation is portrait, not landscape.

I've tried this using the latest 4.5 driver, and the 5.0 driver.

This is C# code, and the pages variable is an array of WPF Canvas objects:

Code: Select all

var hPrinter = DriverInit(PDFPRINTERNAME);

//set as default
CDISetDefaultPrinter(hPrinter);

//set sheet size
SetPaperSize(hPrinter, 1);  //Letter size

//set resolution options
SetResolution(hPrinter, 200);
SetJPEGCompression(hPrinter, 1);
SetJPegLevel(hPrinter, 7);

//set orientation
SetOrientation(hPrinter, 2);  //Landscape Orientation

//set filename
SetDefaultFileName(hPrinter, filename);
//Filename Options
SetFileNameOptions(hPrinter, 1 | 2 | 256);  //256 = Enable Encryption

//Margins
SetHorizontalMargin(hPrinter, 0);
SetVerticalMargin(hPrinter, 0);
//Permission
SetPermissions(hPrinter, -64 + 4); //allow only printing
//SetDefaultConfig
SetDefaultConfig(hPrinter);

//Enable
EnablePrinter(hPrinter, PDFLICENSEE, PDFACTIVATIONCODE);

LocalPrintServer ps = new LocalPrintServer();
PrintQueue pq = ps.DefaultPrintQueue;

XpsDocumentWriter xpsW = PrintQueue.CreateXpsDocumentWriter(pq);


FixedDocument doc = new FixedDocument();

foreach (Canvas cv in pages) {

    FixedPage pg = new FixedPage();
    pg.Children.Add(cv);

    PageContent pc = new PageContent();

    ((IAddChild)pc).AddChild(pg);

    doc.Pages.Add(pc);
}

xpsW.Write(doc);

RestoreDefaultPrinter(hPrinter);
DriverEnd(hPrinter);
Thanks!
Cliffe

Jose
Amyuni Team
Posts: 550
Joined: Tue Oct 01 2002
Contact:

Re: Windows 8.1

Post by Jose » Wed Feb 12 2014

Hello,

Just an update on this post:

The customer contacted support and this issue was not related to the Amyuni printer driver.

Thank
Get PDF Suite, the expert .NET developer toolkit for PDF conversion, creation and editing - www.amyuni.com/pdfsuite

Post Reply