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