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!
Removing document from QuickPDF |
Post Reply |
Author | |
kumarp11
Beginner Joined: 09 Oct 18 Location: United States Status: Offline Points: 13 |
Post Options
Thanks(0)
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); |
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
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 |
|
kumarp11
Beginner Joined: 09 Oct 18 Location: United States Status: Offline Points: 13 |
Post Options
Thanks(0)
|
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
|
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
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 |
|
kumarp11
Beginner Joined: 09 Oct 18 Location: United States Status: Offline Points: 13 |
Post Options
Thanks(0)
|
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); |
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
Try it with new instances for each printout and let us see if it works then.
|
|
Cheers,
Ingo |
|
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