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 > Sample Code
  New Posts New Posts RSS Feed - Removing document from QuickPDF
  FAQ FAQ  Forum Search   Register Register  Login Login

Removing document from QuickPDF

 Post Reply Post Reply
Author
Message Reverse Sort Order
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 Topic: Removing document from QuickPDF
    Posted: 15 Oct 18 at 10:41PM
Try it with new instances for each printout and let us see if it works then.
Cheers,
Ingo

Back to Top
kumarp11 View Drop Down
Beginner
Beginner


Joined: 09 Oct 18
Location: United States
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote kumarp11 Quote  Post ReplyReply Direct Link To This Post Posted: 15 Oct 18 at 9:00PM
Thanks. Here is the code snippet again for your kind reference..

PDFLibrary quickPdf = _objQuickPdf as PDFLibrary;
                int result = quickPdf.LoadFromString(data, null); - Data here is a UTF-8 byte stream
                if (result != 1)
                {
                    //Log statement
                }
                if (quickPdf.NewPage() == 0)
                {
                    Log("The page could not be added");
                }
                int captureID = quickPdf.CapturePage(1);
                if (captureID == 0)
                {
                    Log("QuickPDF: The specified page does not exist, or it is the only page in the document");
          
                }
                if (quickPdf.SetOrigin(1) != 1)
                {
                    Log("QuickPDF: Failed to set origin for the new page");
                }
                quickPdf.SetMeasurementUnits(1);
                if (pageScaling.ToUpper() == "TRUE")
                {
                    double scaleFactor = scalePercentage;
                    double horizBorder = width * (1.0 - scaleFactor) / 2;
                    double vertBorder = height * (1.0 - scaleFactor) / 2;
                    if (quickPdf.DrawCapturedPage(captureID, horizBorder, vertBorder, width - 2 * horizBorder, height - 2 * vertBorder) == 0)
                    {
                        Log("QuickPDF: An invalid CaptureID was specified");
                    }
                }
                else
                {
                    if (quickPdf.DrawCapturedPage(captureID, xPosition, yPosition, width, height) == 0)
                    {
                        Log("QuickPDF: An invalid CaptureID was specified");
                    }
                }
                int iPrintOptions = quickPdf.PrintOptions(0, 0, ticketName);
                int printreturnvalue = quickPdf.PrintDocument(PrinterName, 1, 1, iPrintOptions);
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: 15 Oct 18 at 8:58PM
mmmmh... i can't see a code snippet ;-)
Try it with new instances for each printout and let us see if it works then.

Cheers,
Ingo

Back to Top
kumarp11 View Drop Down
Beginner
Beginner


Joined: 09 Oct 18
Location: United States
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote kumarp11 Quote  Post ReplyReply Direct Link To This Post Posted: 15 Oct 18 at 6:19AM
It is not a loop. We are just picking the data from dependent system and processing it. We are just getting the data and printing it.
We are not using one instance for each printing. 
We are just creating the Debenu instance once in our project during project startup. while printing for each print  ,we are using
 PDFLibrary quickPdf = _objQuickPdf as PDFLibrary;
which is nothing but the assignment ,not creating the new instance and using this for printing as mentioned in the code snippet.

PDF content is in UTF-8 byte stream
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: 13 Oct 18 at 12:19PM
What's before and after your code?
Is it a loop?
There's no free...?
Do you use the one instance for each print job?
If yes: I would free it starting a new instance for each printing.
What's about the pdf-content... encrypted or not?
If yes: Do the unencryption first...

Cheers,
Ingo

Back to Top
kumarp11 View Drop Down
Beginner
Beginner


Joined: 09 Oct 18
Location: United States
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote kumarp11 Quote  Post ReplyReply Direct Link To This Post Posted: 12 Oct 18 at 6:53PM
Hi,
I am using the below code to print a PDF file. I am printing multiple tickets one after another. When I try to issue quickPDF.RemoveDocument(DocID) after issuing quickPDF.PrintDocument(), print is always coming out blank, even though print function is returning 1 and when I comment out quickPDF.RemoveDocument(DocID) print is coming out fine. I am using quickPDF.SelectedDocument() after quickPdf.LoadFromString() to get the documentID of document just loaded. I want to remove old document which has already been printed before loading new document using quickPdf.LoadFromString()

PDFLibrary quickPdf = _objQuickPdf as PDFLibrary;
                int result = quickPdf.LoadFromString(data, null); - Data here is a UTF-8 byte stream
                if (result != 1)
                {
                    //Log statement
                }
                if (quickPdf.NewPage() == 0)
                {
                    Log("The page could not be added");
                }
                int captureID = quickPdf.CapturePage(1);
                if (captureID == 0)
                {
                    Log("QuickPDF: The specified page does not exist, or it is the only page in the document");
          
                }
                if (quickPdf.SetOrigin(1) != 1)
                {
                    Log("QuickPDF: Failed to set origin for the new page");
                }
                quickPdf.SetMeasurementUnits(1);
                if (pageScaling.ToUpper() == "TRUE")
                {
                    double scaleFactor = scalePercentage;
                    double horizBorder = width * (1.0 - scaleFactor) / 2;
                    double vertBorder = height * (1.0 - scaleFactor) / 2;
                    if (quickPdf.DrawCapturedPage(captureID, horizBorder, vertBorder, width - 2 * horizBorder, height - 2 * vertBorder) == 0)
                    {
                        Log("QuickPDF: An invalid CaptureID was specified");
                    }
                }
                else
                {
                    if (quickPdf.DrawCapturedPage(captureID, xPosition, yPosition, width, height) == 0)
                    {
                        Log("QuickPDF: An invalid CaptureID was specified");
                    }
                }
                int iPrintOptions = quickPdf.PrintOptions(0, 0, ticketName);
                int printreturnvalue = quickPdf.PrintDocument(PrinterName, 1, 1, iPrintOptions);
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