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 - PrintDocument() crashing application
  FAQ FAQ  Forum Search   Register Register  Login Login

PrintDocument() crashing application

 Post Reply Post Reply
Author
Message
stakon View Drop Down
Team Player
Team Player


Joined: 09 Oct 09
Status: Offline
Points: 22
Post Options Post Options   Thanks (0) Thanks(0)   Quote stakon Quote  Post ReplyReply Direct Link To This Post Topic: PrintDocument() crashing application
    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.


Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3529
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 09 Oct 09 at 10:46AM
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

Back to Top
stakon View Drop Down
Team Player
Team Player


Joined: 09 Oct 09
Status: Offline
Points: 22
Post Options Post Options   Thanks (0) Thanks(0)   Quote stakon Quote  Post ReplyReply Direct Link To This Post Posted: 09 Oct 09 at 12:08PM
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.

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