简体   繁体   中英

How to draw a pixels on PDF page using PDFsharp?

I want to draw pixels on PDF files randomly. I am using PDFsharp to create a PDF file. But I didn't get pixel draw option in PDFsharp. Is there any way to draw a pixel on PDF file using PDFsharp?

PDF files do not have pixels (it's a vector format).

You can draw lines, circles, rectangles - or add a bitmap that only contains a pixel.

This is a variation of what I do.

        #region Helper that adds a rectangle to coordinates. Helps visualize container. Uncomment to see extents of container 'rect'.

        XPen pen = new XPen(XColors.Black, 1);

        gfx.DrawRectangle(pen, 0, 0, 0, 1.0);

        #endregion

It creates a rectangle of size one pixel

You can also draw a line of length one pixel.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM