Print Page | Close Window

Debenu Quick PDF Library 11 don't support A6?

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=3222
Printed Date: 24 Apr 24 at 8:54AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Debenu Quick PDF Library 11 don't support A6?
Posted By: shawn
Subject: Debenu Quick PDF Library 11 don't support A6?
Date Posted: 01 Dec 15 at 2:41PM
Hi,
I use Debenu Quick PDF Library 11 for printing. It seems the library doesn't support paper size from 69 to 118(A6 is 70). To be specific, I use SetupCustomPrinter() set paper size and it always return 0 for the above paper size. 

I am wondering whether it is a limitation of Debenu Quick PDF Library 11 or a bug?
If it is a limitation, does Debenu Quick PDF Library 12 support paper size from 69 to 118. 

Thanks ahead!



Replies:
Posted By: shawn
Date Posted: 01 Dec 15 at 2:52PM
From document, it seems SetupCustomPrinter() only support paper size from 1 to 68. And we need set paper height and width if customer size is needed?


Posted By: LuProch
Date Posted: 12 Jan 18 at 10:22AM
I had the same problem - to print a pre-existing PDF file in A6 portrait format to a printer to the same paper format. The idea was to put the A6 paper to the center of the A4 paper tray. I use the newest version of Quick PDF Library - 14.11.

First I tried to use the DMPAPER code. This doesn't work, because the SetupCustomPrinter function accepts only values 1 to 68.

quickPDF.SetupCustomPrinter(customPrinter, 1, 70); // 1 - paper size, 70 - A6


Then I tried to set the size in millimetres. This worked only with a virtual printer (to PDF), but not with a physical printer (to paper). I tried three different physical printers and it always printed to the top left corner of A4. (There was a bug in older Quick PDF versions, where SetupCustomPrinter(customPrinter, 1, 0) returned 0. This is fixed in newer versions, where it returns 1. But functionality stays the same.)

quickPDF.SetupCustomPrinter(customPrinter, 1, 0); // 1 - paper size, 0 - specify custom size
quickPDF.SetupCustomPrinter(customPrinter, 2, 1480); // 2 - paper length, 148 mm
quickPDF.SetupCustomPrinter(customPrinter, 3, 1050); // 3 - paper width, 105 mm


Finally I discovered a workaround. You can alter the PDF itself - add new A4 page, cut the A6 page (or basically any page size) and paste it into the top of the new A4 page, where you center it horizontally. Then you print the resulting A4 page normally and put A6 paper to the center of the A4 paper tray. You can just print and not save the changes to file, the original PDF file stays unchanged. Here is my code (simplified for document with only one page):

quickPDF.LoadFromFile(pdfPathName, ""); // file, password

quickPDF.SetOrigin(1); // origin of coordinates - top left
quickPDF.SetMeasurementUnits(1); // measure in millimetres

double outputPageWidth = 210.0; // A4 page width
double outputPageHeight = 297.0; // A4 page height

quickPDF.SelectPage(1); // select first page
double inputPageWidth = quickPDF.PageWidth();
double inputPageHeight = quickPDF.PageHeight();

quickPDF.NewPage(); // insert new page
quickPDF.SetPageDimensions(outputPageWidth, outputPageHeight); // set size of new page - A4 portrait

int captureID = quickPDF.CapturePage(1); // capture first page, also removes page from document

quickPDF.SelectPage(1); // select new page (now first page)
quickPDF.DrawCapturedPage(captureID, (outputPageWidth - inputPageWidth) / 2.0, 0, inputPageWidth, inputPageHeight); // draw captured page into new page - horizontally center, vertically top

string customPrinter = quickPDF.NewCustomPrinter(printerName); // printer name

quickPDF.SetupCustomPrinter(customPrinter, 9, paperSource); // paper source
quickPDF.SetupCustomPrinter(customPrinter, 1, 9); // paper size - A4
quickPDF.SetupCustomPrinter(customPrinter, 11, 1); // orientation - portrait

int options = quickPDF.PrintOptions(0, 0, documentName); // fit/shrink - no, rotate/center - no, document title

if (quickPDF.PrintDocument(customPrinter, 1, 1, options) == 0) // print one page
{
    // handle error
}



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