PdfImagebox Create Selection

Started by iPhiTech, February 12, 2018, 07:37:31 PM

Previous topic - Next topic

iPhiTech

Possible to create a selection area in pdfImagebox and get the image selected.Thank you for the feedback



Richard Moss

Hello,

If by "PdfImageBox" you mean the example project from our blog post (https://www.cyotek.com/blog/extending-the-imagebox-component-to-display-the-contents-of-a-pdf-file-using-csharp), then this is just a normal ImageBox control which exposes a GetSelectedImage method to return the image selection.

Regards;
Richard Moss
Read "Before You Post" before posting (https://forums.cyotek.com/cyotek-webcopy/before-you-post/). Do not send me private messages. Do not expect instant replies.

All responses are hand crafted. No AI involved. Possibly no I either.

iPhiTech

yes i want to add selection in pdfimagebox

Richard Moss

Hello,

Not sure what to suggest - I grabbed the old source code from that demo, upgraded it to use the ImageBox package and was able to draw selection regions perfectly well.

Does your code have anything that clears the SelectionRegion property?
Read "Before You Post" before posting (https://forums.cyotek.com/cyotek-webcopy/before-you-post/). Do not send me private messages. Do not expect instant replies.

All responses are hand crafted. No AI involved. Possibly no I either.

iPhiTech

#4
image grab is now working, but the draw select or the rectangle highlight are not showing , do you have skype ? iwant to donate if my projects done

Richard Moss

I can't reproduce it not drawing the selection region, are you able to post your code?
Read "Before You Post" before posting (https://forums.cyotek.com/cyotek-webcopy/before-you-post/). Do not send me private messages. Do not expect instant replies.

All responses are hand crafted. No AI involved. Possibly no I either.

Richard Moss

Hello,

The PDF ImageBox sample from the Cyotek website uses a fairly old source code version of the ImageBox control that predates by around 6 months the improvements which added selection regions etc.

Install the CyotekImageBox NuGet package, then delete the now unused ImageBox.cs, ImageBoxBorderStyle.cs, ImageBoxGridDisplayMode.cs and ImageBoxGridScale.cs files from the project. The PdfImageBox sample will then use the latest ImageBox control which offers the selection region behaviour.

I had assumed you'd already done this as your screenshot shows the new properties, but the code you posted looks like an unmodified copy of the Cyotek blog sample.

Regards;
Richard Moss
Read "Before You Post" before posting (https://forums.cyotek.com/cyotek-webcopy/before-you-post/). Do not send me private messages. Do not expect instant replies.

All responses are hand crafted. No AI involved. Possibly no I either.

iPhiTech

The Imagebox controll still shows the PDF ?

Richard Moss

Yes, the PDF sample will continue to load the PDF. The sample uses the GhostScript API to convert PDF pages into images which are then loaded into the ImageBox. Upgrading the sample to used the embedded source version to the more up to date package won't break that.
Read "Before You Post" before posting (https://forums.cyotek.com/cyotek-webcopy/before-you-post/). Do not send me private messages. Do not expect instant replies.

All responses are hand crafted. No AI involved. Possibly no I either.

iPhiTech


iPhiTech

still not draw some highlight area.

iPhiTech

Severity Code Description Project File Line Suppression State
Warning CS0436 The type 'ImageBoxSelectionMode' in 'E:\Selection\Revise2\Revise2\PdfImageBoxSample\PdfImageBoxSample\ImageBoxSelectionMode.cs' conflicts with the imported type 'ImageBoxSelectionMode' in 'Cyotek.Windows.Forms.ImageBox, Version=1.2.0.0, Culture=neutral, PublicKeyToken=58daa28b0b2de221'. Using the type defined in 'E:\Selection\Revise2\Revise2\PdfImageBoxSample\PdfImageBoxSample\ImageBoxSelectionMode.cs'. PdfImageBoxSample E:\Selection\Revise2\Revise2\PdfImageBoxSample\PdfImageBoxSample\PdfImageBox.cs 34 Active

iPhiTech

Thanks Sir the code is now working  ;D

Richard Moss

Thanks for letting me know! I confess I'm really confused over what the actual problem was but I'm glad you got it resolved.

I'm sure you've fixed this by now, but in regards to your build warning, the solution is to delete the source code file ImageBoxSelectionMode.cs from your project as it is already a part of the compiled version. Again though I'm confused as how that file is there in the first place as I'm pretty sure it was written after the PDF sample was to begin with.

Still, glad you got it resolved - good luck with your project!
Read "Before You Post" before posting (https://forums.cyotek.com/cyotek-webcopy/before-you-post/). Do not send me private messages. Do not expect instant replies.

All responses are hand crafted. No AI involved. Possibly no I either.

iPhiTech

ill remake the PDfImagebox fresh then added the image selection from nugget follow your instruction then boom .add the other feature then done.