Print Page | Close Window

Print document on custom paper size

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=2961
Printed Date: 08 May 24 at 12:44PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Print document on custom paper size
Posted By: hirdan
Subject: Print document on custom paper size
Date Posted: 22 Aug 14 at 10:39AM
Hi,
I have an existing PDF document which has the size 4x6 inch (orientation: landscape).
I want to print it with Quick PDF on a label printer in exactly the original size. I tried to use the SetupCustomPrinter function to set length and width of the page but it doesn't work. Output size is always A4, even if I specify a custom length/ width. The size changes if I use the DMPAPER_XXX parameter with the SetupCustomPrinter function, but the DEVMODE data structure doesn't provide the required paper size for me.
Any solutions on this? Why is the paper size not changing even if I set it?

Thanks in advance and kind regards
Daniel



Replies:
Posted By: Ingo
Date Posted: 22 Aug 14 at 7:35PM
Hi Daniel,

SetupCustomPrinter changes the properties of a custom printer created first with the NewCustomPrinter.
And for working with NewCustomPrinter you should use GetPrinterNames, too.
You should read here:
http://www.debenu.com/docs/pdf_library_reference/SetupCustomPrinter.php
and the further linked pages, too.

Cheers and welcome here,
Ingo



-------------
Cheers,
Ingo



Posted By: hirdan
Date Posted: 25 Aug 14 at 7:55AM
Hi Ingo,
I'm aware of the NewCustomPrinter function and I'm already using it. SetupCustomPrinter works fine for other parameters (like orientation for example) but unfortunately not for the paper length and width. Any other suggestions on this?

Thanks and kind regards
Daniel


Posted By: hirdan
Date Posted: 26 Aug 14 at 1:36PM
So I use the following code, but the page is always printed in A4 format. I use PDF Creator for testing, which works fine if I print different sized documents in MS Word for example.

string custom_printer = this.pdf_lib.NewCustomPrinter("SamplePrinter");
this.pdf_lib.SetupCustomPrinter(custom_printer, 11, 2); // orientation
this.pdf_lib.SetupCustomPrinter(custom_printer, 2, 1000); // length
this.pdf_lib.SetupCustomPrinter(custom_printer, 3, 1500); // width
this.pdf_lib.PrintDocument(custom_printer, 1, this.pdf_lib.PageCount()this.pdf_lib.PrintOptions(0, 0, "Sample"));

Anyway, if I use this.pdf_lib.SetupCustomPrinter(custom_printer, 1, 27); for example, the paper size changes as expected.


Posted By: JensBP
Date Posted: 28 Aug 14 at 11:54AM
Hi Daniel

Have you tried with this sequence:
SetupCustomPrinter(custom_printer, 1, 0); //Set PaperSize to Zero
SetupCustomPrinter(custom_printer, 2, 1000); //Set PaperLength to 100mm
SetupCustomPrinter(custom_printer, 3, 1500); //Set PaperWidth to 150mm

According to Microsoft documentation the PaperSize can be set to 0 when the size id set by PaperLength and PaperWidth.

I have not tested this.

Jens Bejer Pedersen


Posted By: hirdan
Date Posted: 28 Aug 14 at 12:44PM
Hi Jens and thank you for your response.

I already found this part of the documentation before and tested it. Anyway SetCustomPrinter returns 0 (error) if you try to set the paper size to 0. According to the QuickPDF documentation the paper size parameter supports only values between 1 and 68.


Posted By: AndrewC
Date Posted: 01 Dec 14 at 9:37AM
This seems to be a bug in DQPL.  I have changed the code to allow for option 0 to be specified for PaperSize to allow for customer page sizes to be used.  I won't have time to test it but the fix will be part of the next release.

Andrew.


Posted By: sudip
Date Posted: 09 Jan 15 at 1:54PM
I tried with the latest update and coded as per latest documentation. But it doesn't work

My (equivalent) C++ code is like :

      cPrinter=oPdf.NewCustomPrinter(cActualPrinter);
      oPdf.SetupCustomPrinter(cPrinter,0,0);
      oPdf.SetupCustomPrinter(cPrinter,2,nPaperLength*10);
      oPdf.SetupCustomPrinter(cPrinter,3,nPaperWidth*10);

It doesn't print custom paper size. Is there any mistake in my code?

Can anyone please help

Thanks
Sudip


Posted By: LuProch
Date Posted: 12 Jan 18 at 10:46AM
I had a similar problem - to print a pre-existing PDF file in A6 portrait format to a printer to the same paper format. I was not able to make it work with the SetupCustomPrinter function alone, but I found a workaround. You can alter the PDF itself - add new A4 page, cut the original page (A6 or any other page size) and paste it into the top of the new A4 page, where you center it horizontally (or left or right or anywhere you need it). Then you print the resulting A4 page normally and put A6 paper to the center of the A4 paper tray.

See my answer here: http://www.quickpdf.org/forum/debenu-quick-pdf-library-11-dont-support-a6_topic3222.html" rel="nofollow - Debenu Quick PDF Library 11 don't support A6?



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