mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-10-08 00:14:35 +08:00
Updated Home (markdown)
25
Home.md
25
Home.md
@@ -65,6 +65,31 @@ byte[] b = builder.Build();
|
|||||||
|
|
||||||
The resulting bytes are a valid PDF document and can be saved to the file system, served from a web server, etc.
|
The resulting bytes are a valid PDF document and can be saved to the file system, served from a web server, etc.
|
||||||
|
|
||||||
|
You can use document builder to visualise what pdf pig has done for document reading.
|
||||||
|
```cs
|
||||||
|
using UglyToad.PdfPig;
|
||||||
|
using UglyToad.PdfPig.Writer;
|
||||||
|
|
||||||
|
using (var document = PdfDocument.Open(pdf))
|
||||||
|
{
|
||||||
|
var builder = new PdfDocumentBuilder{};
|
||||||
|
var pageBuilder = builder.AddPage(document, pageNumber);
|
||||||
|
pageBuilder.SetStrokeColor(255,0,0);
|
||||||
|
var page = document.GetPage(pageNumber);
|
||||||
|
foreach(var word in page.GetWords())
|
||||||
|
{
|
||||||
|
var box = word.BoundingBox;
|
||||||
|
pageBuilder.DrawRectangle(box.BottomLeft, (decimal)box.Width, (decimal)box.Height);
|
||||||
|
}
|
||||||
|
|
||||||
|
builder.ToImage().Display();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
View this gist that goes through some basic beginner examples: https://gist.github.com/cordasfilip/c6d2510b358323dc2f71c843460cbcdf
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Contents ##
|
## Contents ##
|
||||||
|
|
||||||
More details on the API can be found here.
|
More details on the API can be found here.
|
||||||
|
Reference in New Issue
Block a user