|
Here we vectorize all the text in the document.
static void VectorizeDocText1(string inDocName) {
var op = new VectorizeTextOperation();
using var doc = new Doc();
doc.Read(Server.MapPath(inDocName));
op.Vectorize(doc);
doc.Save(Server.MapPath("VectorizedSample.pdf"));
}
Private Shared Sub VectorizeDocText1(inDocName As String)
Dim vecOp As New VectorizeTextOperation()
Dim doc As New Doc()
doc.Read(Server.MapPath(inDocName))
vecOp.Vectorize(doc)
doc.Save(Server.MapPath("VectorizedSample.pdf"))
End Sub
Here we Vectorize all but the bold text.
static void Vectorizing2(object sender, ProcessingObjectEventArgs e) {
var font = e.Object as FontObject;
if (font != null && font.BaseFont.Contains("Bold"))
e.Cancel = true;
}
static void VectorizeDocText2(string inDocName) {
var op = new VectorizeTextOperation();
Doc doc = new Doc();
doc.Read(Server.MapPath(inDocName));
// Use the 'Vectorizing' method to decide which fonts to vectorize
op.ProcessingObject += new ProcessingObjectEventHandler(Vectorizing2);
op.Vectorize(doc);
doc.Save(Server.MapPath("VectorizedSample.pdf"));
}
Private Shared Sub Vectorizing2(sender As Object, e As ProcessingObjectEventArgs)
Dim theFont As FontObject = TryCast(e.[Object], FontObject)
If theFont <> Nothing AndAlso theFont.BaseFont.Contains("Bold") Then
e.Cancel = True
End If
End Sub
Private Shared Sub VectorizeDocText2(inDocName As String)
Dim vecOp As New VectorizeTextOperation()
Dim doc As New Doc()
doc.Read(Server.MapPath(inDocName))
' Use the 'Vectorizing' method to decide which fonts to vectorize
vecOp.ProcessingObject += New ProcessingObjectEventHandler(Vectorizing2)
vecOp.Vectorize(doc)
doc.Save(Server.MapPath("VectorizedSample.pdf"))
End Sub
Vectorize all the external fonts.
static void Vectorizing3(object sender, ProcessingObjectEventArgs e) {
var font = e.Object as FontObject;
if (font != null && font.EmbeddedFont != null)
e.Cancel = true;
}
static void VectorizeDocText3(string inDocName) {
var op = new VectorizeTextOperation();
Doc doc = new Doc();
doc.Read(Server.MapPath(inDocName));
// Use the 'Vectorizing' method to decide which fonts to vectorize
op.ProcessingObject += new ProcessingObjectEventHandler(Vectorizing3);
op.Vectorize(doc);
doc.Save(Server.MapPath("VectorizedSample.pdf"));
}
Private Shared Sub Vectorizing3(sender As Object, e As ProcessingObjectEventArgs)
Dim theFont As FontObject = TryCast(e.[Object], FontObject)
If theFont <> Nothing AndAlso theFont.EmbeddedFont <> Nothing Then
e.Cancel = True
End If
End Sub
Private Shared Sub VectorizeDocText3(inDocName As String)
Dim vecOp As New VectorizeTextOperation()
Dim doc As New Doc()
doc.Read(Server.MapPath(inDocName))
' Use the 'Vectorizing' method to decide which fonts to vectorize
vecOp.ProcessingObject += New ProcessingObjectEventHandler(Vectorizing3)
vecOp.Vectorize(doc)
doc.Save(Server.MapPath("VectorizedSample.pdf"))
End Sub
|