PdfiumViewer icon indicating copy to clipboard operation
PdfiumViewer copied to clipboard

PdfiumViewer Delete page

Open oristech opened this issue 6 years ago • 5 comments

when I delete current page viewer duplicates the next page and deletes the last page from the viewer.

oristech avatar Apr 24 '19 16:04 oristech

It's late, but maybe you can paste your codes here. I've used DeletePage, works fine

iimax avatar Jun 28 '19 02:06 iimax

Thanks for returning my request.

I am using the below code

// PdfRenderer does not support changes to the loaded document,

        // so we fake it by reloading the document into the renderer.



        int page = pdfViewer1.Renderer.Page;

        var document = pdfViewer1.Document;

        pdfViewer1.Document = null;

        document.DeletePage(page);

        pdfViewer1.Document = document; 

        pdfViewer1.Renderer.Page = page;

//--so what is happening here is after execution of this delete code the viewer deleting the current page and the last page of the file. Also other thing I saw was it duplicating the 2nd page of the view after the delete operation.

So if you delete page 1 out 40 page file .. t his delete operation will delete page 1 and page 40. And refresh the view with duplicate of 2nd page. So user will thing that delete operation is fine but its not this code deletes the wrong page and make one extra page which wrong.

If you don’t see issue like this please point me toward the fix .

Thanks,

Syed Ahmed | Manager IT and System

Oristech (o) 830-515-4308 | (f) 830-625-7240 |[email protected] mailto:[email protected] | http://www.oristech.com/ www.oristech.com

From: iimax [email protected] Sent: Thursday, June 27, 2019 9:28 PM To: pvginkel/PdfiumViewer [email protected] Cc: oristech [email protected]; Author [email protected] Subject: Re: [pvginkel/PdfiumViewer] PdfiumViewer Delete page (#195)

It's late, but maybe you can paste your codes here. I've used DeletePage, works fine

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pvginkel/PdfiumViewer/issues/195?email_source=notifications&email_token=AHVHMEOS7FPRGLLZ5HGJLBTP4VZKLA5CNFSM4HIFZYTKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYY325Q#issuecomment-506576246 , or mute the thread https://github.com/notifications/unsubscribe-auth/AHVHMENOWJSPT6HAZMBF6WTP4VZKLANCNFSM4HIFZYTA . https://github.com/notifications/beacon/AHVHMEK574ZLVJGGX7NOBELP4VZKLA5CNFSM4HIFZYTKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYY325Q.gif

oristech avatar Jun 28 '19 17:06 oristech

I can reproduce the issue, but do not found a fix yet. I think the problem is in PdfFile.DeletePage(int pageNumber) . Tried dump page bitmap/ GetPdfText after DeletePage, same issue. I'm still working on it.

iimax avatar Jul 09 '19 02:07 iimax

Thanks a lot. I m currently a complex workaround. I m deleting pages using PDFBox then re loading the file in the viewer. This is very resource intensive process. It wud be much appreciated if this issue resolved.

Syed Ahmed | Manager IT and System

Oristech (o) 830-515-4308 | (f) 830-625-7240 |[email protected] mailto:[email protected] | http://www.oristech.com/ www.oristech.com

From: iimax [email protected] Sent: Monday, July 8, 2019 9:26 PM To: pvginkel/PdfiumViewer [email protected] Cc: oristech [email protected]; Author [email protected] Subject: Re: [pvginkel/PdfiumViewer] PdfiumViewer Delete page (#195)

I can reproduce the issue, but do not found a fix yet. I think the problem is in PdfFile.DeletePage(int pageNumber) . Tried dump page bitmap/ GetPdfText after DeletePage, same issue. I'm still working on it.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pvginkel/PdfiumViewer/issues/195?email_source=notifications&email_token=AHVHMELYPLRVISIPOAUDC6TP6PZKBA5CNFSM4HIFZYTKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZO4JGQ#issuecomment-509461658 , or mute the thread https://github.com/notifications/unsubscribe-auth/AHVHMELAF26RGRVQHW7G7ZLP6PZKBANCNFSM4HIFZYTA . https://github.com/notifications/beacon/AHVHMENX2XC746RR2I4A47TP6PZKBA5CNFSM4HIFZYTKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZO4JGQ.gif

oristech avatar Jul 09 '19 14:07 oristech

After some digging, thought the bug is in the core. I add deletePage in "PdfiumViewer.Demo\MainForm.cs" OpenFile() pdfViewer1.Document?.Dispose(); var document = OpenDocument(form.FileName); document.DeletePage(0); pdfViewer1.Document = document; the issue is same. maybe you can try https://github.com/ArgusMagnus/PDFiumSharp which can take advantage of the actively released https://github.com/bblanchon/pdfium-binaries

iimax avatar Jul 21 '19 12:07 iimax