Print Page | Close Window

Change paper size problem

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=1582
Printed Date: 06 May 25 at 4:26PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Change paper size problem
Posted By: mythcyrax
Subject: Change paper size problem
Date Posted: 29 Sep 10 at 11:11AM

 Hello,

    In my application I need to print PDF documents on different paper sizes (A1, A3, A4...). The problem is that I cannot change the printer's default paper size. What am I doing wrong?

void QuickPDF_Print()

{

QuickPDFAX0721.PDFLibrary qp = new QuickPDFAX0721.PDFLibrary();

int result = qp.UnlockKey("my key...");

if (result == 1)

{

// Load the document that you want to print into memory

qp.LoadFromFile(Filename);

qp.SetPageSize("A4");

// Set the paramters for the PrintDocument function

string PrinterName = PrintingOptions.Printer;

int StartPage = 1; // Set first page number

int EndPage = qp.PageCount(); // Set last page number

// Set the paramters for the PrintOptions function

int PageScaling = 1;

int AutoRotateCenter = 1;

string Title = Filename;

// Assign the options for printing to an int variable

int Options = qp.PrintOptions(PageScaling, AutoRotateCenter, Title);

// Print the document with the required paramters and options specified

qp.PrintDocument(PrinterName, StartPage, EndPage, Options);

}

}




Replies:
Posted By: Rowan
Date Posted: 20 Oct 10 at 2:04PM
To acoomplish what you're trying to do you'll need to use the custom printer functions.

NewCustomPrinter
http://www.quickpdflibrary.com/help/quickpdf/NewCustomPrinter.php - http://www.quickpdflibrary.com/help/quickpdf/NewCustomPrinter.php

SetupCustomPrinter
http://www.quickpdflibrary.com/help/quickpdf/SetupCustomPrinter.php - http://www.quickpdflibrary.com/help/quickpdf/SetupCustomPrinter.php

Some info on the custom printer functions here:

http://help.quickpdflibrary.com/questions/53/how-do-i-use-the-setupcustomprinter-function - http://help.quickpdflibrary.com/questions/53/how-do-i-use-the-setupcustomprinter-function

And here is some JScript sample code which demonstrates how to use the functions:

--------------------------------------------------------
/* Create a custom printer and specify your own settings  */

// Load a sample file from the input folder

QP.LoadFromFile(GetInputFolder() + "JavaScript.pdf"); 

// Create the custom printer

CustomPrinter = QP.NewCustomPrinter("Microsoft XPS Document Writer");

// Setup the settings for the customer printer

// Medium quality

QP.SetupCustomPrinter(CustomPrinter, 5, 2); 

// Monochrome

QP.SetupCustomPrinter(CustomPrinter, 6, 1); 

// Horizontal Duplex

QP.SetupCustomPrinter(CustomPrinter, 7, 3);

// Configure print options

iPrintOptions = QP.PrintOptions(0, 0, "Printing Sample");

// Print the current document to the default printing 
// using the options as configured above

QP.PrintDocument(CustomPrinter, 1, 1, iPrintOptions);
--------------------------------------------------------

So you need to setup the printer and the paper size for your customer printer before you call the PrintDocument function.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk