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!
![]() |
I need help Adding with page count |
Post Reply ![]() |
Author | |
sachinda ![]() Beginner ![]() ![]() Joined: 15 Mar 25 Location: Sri lanka Status: Offline Points: 2 |
![]() ![]() ![]() ![]() ![]() Posted: 15 Mar 25 at 7:06PM |
Hi all I need big help with adding page count .
i want to add page numbers to each pdf page...if a pdf page has 2 images and user want 3 copies then it must need to be print as
copy 1 of 3 copy 1 of 3 copy 2 of 3 copy 2 of 3 copy 3 of 3 copy 3 of 3...... like this .... but my output always printing copy 1 of 3 in the all pages... but the console output will give me the correct text and pdf output give the wrong text .Here is my code. function printService.PrintImageFromStream(fin: TStream;reqid, rtype: string; ncopies, npages: Integer): Integer; var DPL: TDebenuPDFLibrary1114; i,c,imgID,imgsID, unlockResult, iPrintOptions, res: Integer; cPrinter: WideString; err, pageText: string; begin Result := 0; try DPL := TDebenuPDFLibrary1114.Create; with DPL do try unlockResult := unlockKey('0000'); if unlockResult = 1 then begin cPrinter := DPL.NewCustomPrinter(GetPrinterName(rtype)); DPL.SetupCustomPrinter(cPrinter, 4, ncopies); DPL.SetupCustomPrinter(cPrinter, 7, 2); for c := 1 to ncopies do begin for i := 1 to npages do begin fin.Position := 0; CompressImages(1); imgID := AddImageFromStream(fin, -i); if imgID > 0 then begin SelectImage(imgID); SetPageDimensions(ImageWidth, ImageHeight); SetOrigin(1); if DrawImage(0, 0, ImageWidth, ImageHeight) <> 1 then raise Exception.Create('unsupported image'); pageText := Format('Copy %d of %d', [c, ncopies]); AllocConsole; Writeln('pageText ', pageText); DPL.SetTextColor(0, 0, 0); DPL.SelectFont(AddStandardFont(5)); DPL.SetTextSize(36); DPL.DrawText(50, 226, pageText); SelectPage(NewPage); end else raise Exception.Create('unsupported image'); end; end; iPrintOptions := DPL.PrintOptions(1, 0,'veloprint[' + reqid + ']'); res := DPL.PrintDocument(cPrinter, 1, npages, iPrintOptions); if res <> 0 then begin Result := 200; end else begin ShowErrorNotification('Printer error'); raise Exception.Create('[error] [' + reqid + '] ' + 'PrintImageFromStream: Printer error'); end; end else raise Exception.Create('[error] [' + reqid + '] ' + 'DPL licence error'); finally DPL.Free; end; except On E: Exception do begin raise Exception.Create(err); end; end; end; Edited by sachinda - 15 Mar 25 at 7:15PM |
|
![]() |
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