ReplaceText
ReplaceText(string, int, string, TextState)
Reemplaza el texto del archivo PDF en la página especificada.TextState
El objeto (familia de fuentes, color) se puede especificar para reemplazar el texto.
public bool ReplaceText(string srcString, int thePage, string destString, TextState textState)
Parámetro | Escribe | Descripción |
---|---|---|
srcString | String | La cadena a ser reemplazada. |
thePage | Int32 | Número de página (0 significa “todas las páginas”). |
destString | String | La cadena reemplazada. |
textState | TextState | Estado del texto (color del texto, fuente, etc.). |
Valor_devuelto
Devuelve verdadero si se realizó un reemplazo.
Ejemplos
El ejemplo muestra cómo reemplazar texto en la primera página del documento PDF y establecerTextState
propiedades de texto para el nuevo texto.
// abrir documento
Document doc = new Document(inFile);
// Crear fuente y marcarla para incrustarla
Aspose.Pdf.Text.Font font = FontRepository.FindFont("Courier New");
font.IsEmbedded = true;
// crear objeto PdfContentEditor para editar texto
PdfContentEditor editor = new PdfContentEditor();
editor.BindPdf(doc);
// crear objeto de estado de texto
TextState textState = new TextState();
textState.Font = font;
textState.FontSize = 17;
textState.FontStyle = FontStyle.Bold | FontStyle.Italic;
textState.ForegroundColor = Color.Red;
// cambia el texto con la fuente especificada
editor.ReplaceText("hello world", 1, "hi world", textState);
// guardar documento
doc.Save(outFile);
Ver también
- class TextState
- class PdfContentEditor
- espacio de nombres Aspose.Pdf.Facades
- asamblea Aspose.PDF
ReplaceText(string, string)
Reemplaza texto en el archivo PDF.
public bool ReplaceText(string srcString, string destString)
Parámetro | Escribe | Descripción |
---|---|---|
srcString | String | La cadena a ser reemplazada. |
destString | String | Reemplazo de cuerda. |
Valor_devuelto
Devuelve verdadero si se realizó un reemplazo.
Ejemplos
El ejemplo muestra cómo reemplazar texto en un documento PDF.
// abrir documento
Document doc = new Document(inFile);
// crear objeto PdfContentEditor para editar texto
PdfContentEditor editor = new PdfContentEditor();
editor.BindPdf(doc);
// cambiar texto
editor.ReplaceText("hello world", "hi world");
// guardar documento
doc.Save(outFile);
Ver también
- class PdfContentEditor
- espacio de nombres Aspose.Pdf.Facades
- asamblea Aspose.PDF
ReplaceText(string, int, string)
Reemplaza el texto en el archivo PDF en la página especificada.
public bool ReplaceText(string srcString, int thePage, string destString)
Parámetro | Escribe | Descripción |
---|---|---|
srcString | String | La picadura a ser reemplazada. |
thePage | Int32 | Número de página (0 para todas las páginas) |
destString | String | Reemplazo de cuerda. |
Valor_devuelto
Devuelve verdadero si se realizó un reemplazo.
Ejemplos
El ejemplo muestra cómo reemplazar texto en un documento PDF en la página especificada.
// abrir documento
Document doc = new Document(inFile);
// crear objeto PdfContentEditor para editar texto
PdfContentEditor editor = new PdfContentEditor();
editor.BindPdf(doc);
// cambiar texto
editor.ReplaceText("hello world", 1, "hi world");
// guardar documento
doc.Save(outFile);
Ver también
- class PdfContentEditor
- espacio de nombres Aspose.Pdf.Facades
- asamblea Aspose.PDF
ReplaceText(string, string, TextState)
Reemplaza el texto en el archivo PDF utilizandoTextState
objeto.
public bool ReplaceText(string srcString, string destString, TextState textState)
Parámetro | Escribe | Descripción |
---|---|---|
srcString | String | Cadena a reemplazar |
destString | String | Reemplazo de cuerda |
textState | TextState | Estado del texto (color del texto, fuente, etc.) |
Valor_devuelto
Devuelve verdadero si se realizó un reemplazo.
Ejemplos
El ejemplo muestra cómo reemplazar texto y establecerTextState
propiedades de texto para el nuevo texto.
// abrir documento
Document doc = new Document(inFile);
// Crear fuente y marcarla para incrustarla
Aspose.Pdf.Text.Font font = FontRepository.FindFont("Courier New");
font.IsEmbedded = true;
// crear objeto PdfContentEditor para editar texto
PdfContentEditor editor = new PdfContentEditor();
editor.BindPdf(doc);
// crear objeto de estado de texto
TextState textState = new TextState();
textState.Font = font;
textState.FontStyle = FontStyle.Bold | FontStyle.Italic;
// cambia el texto con la fuente especificada
editor.ReplaceText("hello world", "hi world", textState);
// guardar documento
doc.Save(outFile);
Ver también
- class TextState
- class PdfContentEditor
- espacio de nombres Aspose.Pdf.Facades
- asamblea Aspose.PDF
ReplaceText(string, string, int)
Reemplaza el texto en el archivo PDF y establece el tamaño de fuente.
public bool ReplaceText(string srcString, string destString, int fontSize)
Parámetro | Escribe | Descripción |
---|---|---|
srcString | String | Cadena a ser reemplazada. |
destString | String | Reemplazo de cuerda. |
fontSize | Int32 | Tamaño de fuente. |
Valor_devuelto
Devuelve verdadero si se realizó un reemplazo.
Ejemplos
El ejemplo muestra cómo reemplazar texto y establecer el tamaño de fuente para el nuevo texto.
// abrir documento
Document doc = new Document(inFile);
// Crear fuente y marcarla para incrustarla
Aspose.Pdf.Text.Font font = FontRepository.FindFont("Courier New");
font.IsEmbedded = true;
// crear objeto PdfContentEditor para editar texto
PdfContentEditor editor = new PdfContentEditor();
editor.BindPdf(doc);
// cambia el texto con la fuente especificada
editor.ReplaceText("hello world", "hi world", 14);
// guardar documento
doc.Save(outFile);
Ver también
- class PdfContentEditor
- espacio de nombres Aspose.Pdf.Facades
- asamblea Aspose.PDF