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!
![]() |
PrintDocument() crashing application |
Post Reply ![]() |
Author | |
stakon ![]() Team Player ![]() Joined: 09 Oct 09 Status: Offline Points: 22 |
![]() ![]() ![]() ![]() ![]() Posted: 09 Oct 09 at 10:02AM |
Good day,
I have recently started to use your QuickPDF dll for C++. I find it very friendly and contains most things i will need. Although most features run smoothly, unfortunately i have encountered the following problem: When using PrintDocument() my program crashes when trying to execute: result = QuickPDFPrintDocument(instanceID, sp1, StartPage, EndPage,Options); which is located in the QuickPDFDLL0715.cpp file. Here is my code before invoking PrintDocument(): int res;//check var for returned results std::string selectedPrinter; std::string printerNames = QP.GetPrinterNames();//Printers in string seperated by comma std::string token; std::istringstream iss(printerNames); while ( getline(iss, token, ',') )//tokenize and get firsst printer { selectedPrinter = token; break;//only take the 1st printer } std::string customPrinterName; customPrinterName = QP.NewCustomPrinter(selectedPrinter);//create new custom printer from the one we selected //Setup various values of the printer... res = QP.SetupCustomPrinter(customPrinterName,6,1);//Color = monochrome res = QP.SetupCustomPrinter(customPrinterName,11,2);//Orientation = landscape //Setup varous print options int printOptions = QP.PrintOptions(0,0,"Custom Title of document");//scaling,rotation,title QP.PrintDocument(customPrinterName,1,2,printOptions);//print the pages within this range ***HERE THE PROGRAM CRASHES*** Note that all the above arguments are checked and all "res" values return success. Any ideas? Thanx in advance, Stakon. |
|
![]() |
|
Ingo ![]() Moderator Group ![]() ![]() Joined: 29 Oct 05 Status: Offline Points: 3529 |
![]() ![]() ![]() ![]() ![]() |
Hi Stakon!
Is the content of customPrinterName correct? Is the content identical to the printer in your system? BTW: There's a good sample for you in the brandnew "QuickPDF library demo" Rowan talked about in the general section here. Try it. Cheers and welcome here, Ingo |
|
![]() |
|
stakon ![]() Team Player ![]() Joined: 09 Oct 09 Status: Offline Points: 22 |
![]() ![]() ![]() ![]() ![]() |
Hello again,
I have just downloaded your demo, it looks very nice. It helped me resolve the error.I found what caused it: When calling QP.GetPrinterNames() the Printer names are separated by commas and each one is within quotes "". So in my above example the string tokens are within quotes.I will trimm my string from the "" and hope everything runs smoothly. Stakon. |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store