mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-10-07 16:04:34 +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.
|
||||
|
||||
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 ##
|
||||
|
||||
More details on the API can be found here.
|
||||
|
Reference in New Issue
Block a user