Add svg export example

BobLd
2020-04-06 10:22:24 +01:00
parent 3d45e72f44
commit 6412f14ceb

@@ -614,4 +614,32 @@ using (var document = PdfDocument.Open(@"document.pdf"))
### Results
Viewing the exported html file using [hocrjs](https://github.com/kba/hocrjs):
![hocr example](https://github.com/UglyToad/PdfPig/blob/master/documentation/Document%20Layout%20Analysis/hocr%20example.png)
![hocr example](https://github.com/UglyToad/PdfPig/blob/master/documentation/Document%20Layout%20Analysis/hocr%20example.png)
## [SVG - work in progress](https://github.com/UglyToad/PdfPig/blob/master/src/UglyToad.PdfPig.DocumentLayoutAnalysis/Export/SvgTextExporter.cs)
### Description
Converts the pdf page to SVG (Scalable Vector Graphics).
### References
- https://en.wikipedia.org/wiki/Scalable_Vector_Graphics
### Usage
```csharp
SvgTextExporter exporter = new SvgTextExporter();
var options = new ParsingOptions() { ClipPaths = true }; // true if clipped path are needed
using (var document = PdfDocument.Open(@"document.pdf", options ))
{
for (var i = 0; i < document.NumberOfPages; i++)
{
var page = document.GetPage(i + 1);
// Convert page to text
var svg = exporter.Get(page);
// Save text to an html file
File.WriteAllText("document.html", svg);
}
}
```
### Results