Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - Print document on custom paper size
  FAQ FAQ  Forum Search   Register Register  Login Login

Print document on custom paper size

 Post Reply Post Reply
Author
Message
hirdan View Drop Down
Beginner
Beginner


Joined: 22 Aug 14
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote hirdan Quote  Post ReplyReply Direct Link To This Post Topic: Print document on custom paper size
    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
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
hirdan View Drop Down
Beginner
Beginner


Joined: 22 Aug 14
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote hirdan Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
hirdan View Drop Down
Beginner
Beginner


Joined: 22 Aug 14
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote hirdan Quote  Post ReplyReply Direct Link To This Post 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.


Edited by hirdan - 26 Aug 14 at 1:55PM
Back to Top
JensBP View Drop Down
Beginner
Beginner
Avatar

Joined: 19 Dec 06
Location: Denmark
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote JensBP Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
hirdan View Drop Down
Beginner
Beginner


Joined: 22 Aug 14
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote hirdan Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
AndrewC View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 08 Dec 10
Location: Geelong, Aust
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
sudip View Drop Down
Beginner
Beginner


Joined: 09 Jan 15
Location: Kolkata
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote sudip Quote  Post ReplyReply Direct Link To This Post 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


Edited by sudip - 09 Jan 15 at 1:55PM
Back to Top
LuProch View Drop Down
Beginner
Beginner
Avatar

Joined: 01 Feb 13
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote LuProch Quote  Post ReplyReply Direct Link To This Post 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: Debenu Quick PDF Library 11 don't support A6?
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store