question

FelipeOlavarra-9680 avatar image
0 Votes"
FelipeOlavarra-9680 asked Castorix31 commented

How to draw rectangles over a pdf through an AxAcroPdf control?

I need to draw rectangles or lines over a pdf using as UI a AxAcroPdf control.

I tried taking the mouse events from a AxAcroPdf control and it seems not possible. I also tried using a transparent PictureBox over a AxAcroPdf control to get the mouse events from the PictureBox instead to pass the coordinates from the form to coordinates in the pdf, but the PictureBox isn't really transparent, so blocks the visibility of the AxAcroPdf control.

Any suggestions?

dotnet-visual-basicwindows-forms
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I don't see exactly what you want to do by drawing over a pdf, but a workaroud is to convert the pdf into a Bitmap to set it in a PictureBox, where you can draw anything in Paint event
I did a test by using Windows.Data.Pdf to convert the first page of a PDF into a Bitmap, and a simple DrawEllipse in PictureBox1_Paint :

134690-draw-on-pdf.jpg




1 Vote 1 ·
draw-on-pdf.jpg (65.4 KiB)

Thanks a lot i will try it, but it is possible to convert the modified image back to pdf?

0 Votes 0 ·
Castorix31 avatar image Castorix31 FelipeOlavarra-9680 ·

Then It is easier to use iText 7


0 Votes 0 ·

0 Answers